Jump to content

PHPRunner Switch/Case not working properly


kkiboo

Recommended Posts

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.