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

Help with a small Php login form

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
NamecheapNamecheap
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
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

A browser tab with a favicon next to the page title
Search members
You can now search for members by name, company, location and more. Open the search at the top of any page and choose Members. You will...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back