Jump to content

User lvl redirect....


jerry89

Recommended Posts

hey.. I have posted few days ago post , about user access lvl.. I have get good fedback...

but heres come other problem now :( ..

 

When i include the php code in, it wont redirect, it just pass to the admin page.

I am including the login.php file.

 

and this is the code i m using

 

if ($user == 'admin') {
    header('Location: http://localhost/staff.php');
elseif ($user == 'client') {
    header('Location: http://localhost/client/client.php');
elseif ($user == 'guest') {
   header('Location: http://localhos/guest/guest.php');
}else {
    header('Location: http://localhost/index.php');
}
exit;

 

 

hope you can help.. if you need to more know , just PM or ask..

 

thanks

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/146510-user-lvl-redirect/
Share on other sites

That code is missing some brackets, leave the mall off or keep them all on.

 

if ($user == 'admin') {
    header('Location: http://localhost/staff.php');
}elseif ($user == 'client') {
    header('Location: http://localhost/client/client.php');
}elseif ($user == 'guest') {

 

See if that gets you your redirect.

Link to comment
https://forums.phpfreaks.com/topic/146510-user-lvl-redirect/#findComment-769190
Share on other sites

Read up on the header command:

 

http://uk.php.net/header

 

Take note of what it says:

 

Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.
Link to comment
https://forums.phpfreaks.com/topic/146510-user-lvl-redirect/#findComment-769298
Share on other sites

to be honest I dont think I have problem with the header....

 

I think i might have something else wrong..

I think of a "session.php" hmm which makes me wonder does need to be inside.."session" something about user lvl ? "

IF so could you please help?

 

I am newbie to php.. but i learn fast.

 

 

Link to comment
https://forums.phpfreaks.com/topic/146510-user-lvl-redirect/#findComment-769942
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.