Soooo I’m tearing my hair out.
I am just trying to make a switch that, after a successful login, it checks for the userlevel of the user, passes it to a switch and based on the case, redirects to their respective page. Backend is Oracle 11g.
[php]<?php
// After successful login
function AfterSuccessfulLogin($username,$password,&$data)
{
$sql=“select userlevel from LOGIN where USERNAME=’”.$_SESSION[“UserID”]."’";
$rs = CustomQuery($sql);
if($data=db_fetch_array($rs)){
switch($data[“userlevel”]){
case “admin”:
header(“Location: AUDIT_TABLE_list.php”);
break;
case “redauditor”:
header(“Location: test2.php”);
break;
default:
header(“Location: main.php”); // redirect to main page if no permission is set
break;
}
}
;
} // function AfterSuccessfulLogin
?>[/php]
For the funky variables, forgive me, I’m modding PHPRunner stuff.
So, this logs the user in but it ONLY redirects to the first case specified. (In the code above: AUDIT_TABLE_list.php). If I change the cases to numbers (and equivalently change the datatype on the column to number as well) I get the same problem. If I quote the numbers, it displays the default page. Here are the things I know:
When I sqlplus at the command line, here is what this query returns:
SQL>select userlevel from login;
USERLEVEL
admin
redauditor
Therefore, I know that I did not mispell anything. Is it not fetching the array properly? What’s going wrong? How can I get it to recognize the other cases? Should I just start from scratch and make the switch without using the PHPRunner variables - if so, what does this look like for Oracle?
m._.m Any help is appreciated, thank you.