spfoonnewb Posted January 3, 2007 Share Posted January 3, 2007 What is wrong with it ?Errors out: [b]Pharse error: syntax error, unexpected ',' in /root/script.php on line 3[/b][code]<?phpif (empty($_GET["g"]) OR (isset($_GET["g"]) != "index", "subpage1", "subpage2", "subpage3", "subpage4")) {echo "Invalid Request.";}else {?>Content...<?php}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/32642-whats-wrong-with-this-_get-script-5-lines/ Share on other sites More sharing options...
Jessica Posted January 3, 2007 Share Posted January 3, 2007 OR is mysql. || is PHP. Also, the rest of that line is wrong. isset will return a bool value (true or false, and will never equal those strings), PLUS You can't check for multiple values that way. You could make an array of those values and check if the "g" is in the array, or you would have to do this:[code]if (empty($_GET["g"]) || ($_GET["g"] != "index" && $_GET["g"] != "subpage1")){echo "Invalid Request.";}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/32642-whats-wrong-with-this-_get-script-5-lines/#findComment-151889 Share on other sites More sharing options...
spfoonnewb Posted January 3, 2007 Author Share Posted January 3, 2007 Same problem. Quote Link to comment https://forums.phpfreaks.com/topic/32642-whats-wrong-with-this-_get-script-5-lines/#findComment-151890 Share on other sites More sharing options...
Jessica Posted January 3, 2007 Share Posted January 3, 2007 See my additions to the above comment. Plus, that isn't the SAME error, it's a new one. Before it was ; and now it is ,My comment should explain why it was an unexpected , - you can't use that syntax. Quote Link to comment https://forums.phpfreaks.com/topic/32642-whats-wrong-with-this-_get-script-5-lines/#findComment-151891 Share on other sites More sharing options...
spfoonnewb Posted January 3, 2007 Author Share Posted January 3, 2007 Thank you.That happens to work.. grr.. ;D[code]<?phpif (empty($_GET["g"]) || ($_GET["g"] != "index" && $_GET["g"] != "subpage1" && $_GET["g"] != "subpage2")) {echo "Invalid Request.";}else {?>Content...<?php}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/32642-whats-wrong-with-this-_get-script-5-lines/#findComment-151897 Share on other sites More sharing options...
Jessica Posted January 3, 2007 Share Posted January 3, 2007 You may want to make it use an array as you have a large list and I bet you will add more. use in_array to check. Good luck. Quote Link to comment https://forums.phpfreaks.com/topic/32642-whats-wrong-with-this-_get-script-5-lines/#findComment-151902 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.