Jump to content

Whats wrong with this $_GET script? (5 lines)


spfoonnewb

Recommended Posts

What is wrong with it ?

Errors out: [b]Pharse error: syntax error, unexpected ',' in /root/script.php on line 3[/b]

[code]<?php

if (empty($_GET["g"]) OR (isset($_GET["g"]) != "index", "subpage1", "subpage2", "subpage3", "subpage4")) {
echo "Invalid Request.";
}

else {

?>

Content...

<?php

}

?>[/code]
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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.