kkiboo Posted July 20, 2010 Share Posted July 20, 2010 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. Database is Oracle 11g, I am using PHPRunner. This is the script for the event that happens after a successful login: <?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 ?> So, the login (not showed) goes through but when it executes this 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. 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? (I know how to do it for mysql) m._.m Any help is appreciated, thank you. Quote Link to comment https://forums.phpfreaks.com/topic/208290-phprunner-switchcase-not-working-properly/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.