I have
$CID = $_REQUEST ['cid'];
$UID = $_REQUEST ['uid'];
if ($UID == '0') {
header ( 'Location: url/you-need-to-log-in-before-redirect/' );
} else {
switch ($CID) {
// go to URL1 case number is the same as CID
case "147" :
header ( 'Location: url' . $UID );
break;
case "148" :
header ( 'Location: url' . $UID );
break;
default :
echo "Something went terribly wrong";
}
}
Is this ok? I have a problem of $UID registering as blank which should not be possible as it is always set to be 0 for non-registered users and for registered it's unique. should i use exit() instead of break? or both? Or should i not be using header loaction at all to send users forward...i have hundreds of cases inside this switch case statement. i cant post any actual urls so the 'url' in example is not a variable but just a placeholder for the actuall full address.
Is the zero's type integer? If yes your condition is wrong, because it tests for string but you have an integer.
Try: if ($UID == 0) {
and the same for the switch cases.
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.