Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php blank $_GET[] detection [duplicate]

I'm looking to detect the $_GET variable name. What I'm trying to detect is:

index.php?login (detect login)
index.php?news (detect news)

I've looked all over and I can't seem to find anyone who has requested this. I'm not looking to detect the value of the variable just that the specific variable exists with no value and if there is a value it is an error. I really appreciate any help.

EDIT: Thanks to a little detective work with the help of zerkms I was able to determine it was being pass through QUERY_STRING so I sent it to a variable through $_SERVER['QUERY_STRING'];

Thank you everyone!

like image 278
Ambiguities Avatar asked May 14 '26 23:05

Ambiguities


1 Answers

Try this

if (isset($_GET['yourvar']) && !strlen($_GET['yourvar']))
    echo "param is set with no value";
like image 98
fuzic Avatar answered May 17 '26 12:05

fuzic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!