Jump to content

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

no it still doesnt work... its just hang on login.php... and I have to refrest to to be able to get inthe staff.php

 

any idea what else could be wrong...

 

check the login.php and tell me where would you put the code, or any other suggestinos please

 

thansk alot

Link to comment
https://forums.phpfreaks.com/topic/146510-user-lvl-redirect/#findComment-769230
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

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.