Page 1 of 1

Need help with redirecting to admin login page or user log p

Posted: Wed May 18, 2005 12:34 pm
by lifebalance
Help! Newbie here...

I'm trying to setup the code so that after first login, if the person came in as .../admin.php then the will get that as the default url extension. Or similiarly if they com in as .../ a user then they will get that url extension as the default.

Here is the code.

if ($admin !="") {$adminLocation = "admin.php";}
else
{$adminLocation = "admin.php";}
header("Location: http://www...com/.../admin.php"); /* Redirect browser */
header("Location: http://www...com/.../"); /* Redirect browser */
exit;

Currently, the user portion of this is working fine. If I swap the admin line and the user line in the code then the admin url works fine.

Help :roll:
Thanks in advance!

Posted: Wed May 18, 2005 1:18 pm
by hawleyjr
First Off please review how to post code.

viewtopic.php?t=21171

Here is your answer:

Code: Select all

if ($admin !="") {
$adminLocation = "admin.php";
}else{
$adminLocation = "nonadmin.php";
} 

header("Location: $adminLocation"); /* Redirect browser */ 
exit;