How do I add more values that can authenticate to echo "ACCESS"
Aka add more variables aside from "a" so I can type http://url/file.php?auth=a
OR auth=b
OR auth=c
, etc.
My code:
<?php
$auth = ("a");
if(@$_REQUEST["auth"]!="$auth"){
echo ("ACCESS DENIED");
}
else {
echo "ACCESS";
}
?>
I think you want in_array
:
$auth = array('a', 'b', 'c');
if (!in_array(@$_REQUEST["auth"], $auth)) {
echo ("ACCESS DENIED");
}
else {
echo "ACCESS";
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.