Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Help with a small Php login form

SpaceshipSpaceship
Spacemail by SpaceshipSpacemail by Spaceship
SpaceshipSpaceship
Watch

TWM

Web Marketing SpecialistEstablished Member
Impact
9
I have

Code:
<?
$adminuser = "admin";
$clientuser = "client";
$adminpass = "admin";
$clientpass = "client";
if ($user == $adminpass&&$pw == $adminpass || $user == $clientuser&&$pw == $clientpass)
{
   header("Location: http://my-website.com/partner_area/partner_area.php");
}
  else
{
   print("Wrong username or password. Please try again.");
}
?>

How can i alter this so that if admin logs in, it takes him to admin area, and if client logs in, it takes them to client area.
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Code:
<?
$adminuser = "admin";
$clientuser = "client";
$adminpass = "admin";
$clientpass = "client";
if ($user == $adminpass&&$pw == $adminpass)
{
   header("Location: http://my-website.com/partner_area/admin_area.php");
}
  else
{
   print("Wrong username or password. Please try again.");
}
if ($user == $clientuser&&$pw == $clientpass)
{ 
   header("Location: http://my-website.com/partner_area/client_area.php");
}
  else
{
   print("Wrong username or password. Please try again.");
}
?>
 
0
Close
Try this:

Code:
<?
$adminuser = "admin";
$clientuser = "client";
$adminpass = "admin";
$clientpass = "client";
if ($user == $adminpass&&$pw == $adminpass || $user == $clientuser&&$pw == $clientpass)
{
   if( $user == $adminuser ) {
    header( "Location: adminareaurl");  
    }
    else {
   header("Location: http://my-website.com/partner_area/partner_area.php");
   }
}
  else
{
   print("Wrong username or password. Please try again.");
}
?>
 
0
Close
nvm fixed it
 
Last edited:
0
Close
I just checked his code, and it works fine. Perhaps you had a copy error?
 
0
Close
Not sure, but i altered it and it works. I have 6 different usernames/passwords, they all are working great!
 
0
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back