Search
Left Quote    You have to THINK anyway, so why not think BIG?
- Donald Trump    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: Checking Status of Admin and Super Admin while logging in
  This user is offline  rituz
  Subject: "Checking Status of Admin and Super ..." Posted: @ 9:29 am on Apr 14 2015   
Member #: 1462
Rank: User - (1)
Since: 04/14/15
Posts: 1
From: Maharashtra

Working on a Project which have several admins and one super admin.. I have created a common table for admin's. Tables have fields username,passwo rd,location and status.
I have created a single login page. For admin I need username and location in session.But for super admin I need only username in session.The problem is that while logging in for any admin/superadmi n it opens in a same page..i.e s_activity.php. The php code is as shown below:


Code:
<?php
include("c onnect.php" ;);
session_start( );
$Username=$_POS T["t1" ;];
$Password=$_POS T["t2" ;];
$Status=$_POST[ "t3"] ;
$location=$_POS T["l1" ;];
$q=mysql_query( "select * from admin_login where username='$User name'"); $rs=mysql_fetch _row($q);
if(($rs[0]==$Us ername)&&am p;($rs[1]==$Pas sword)&& ;($rs[4]==$loca tion)&& ($rs[3]==$Statu s))
{
if($_SESSION[& quot;status&quo t;]=admin)
{
$_SESSION[" ;user"]=$U sername;
$_SESSION[" ;location" ]=$location;
echo "<scrip t type='text/java script' language='javas cript'>
alert('Admin logged in successfully');
</script> ";
header("Re fresh:0;http:// localhost/e_cla ssified/admin/a _activity.php&q uot;);
}
else
{
echo "<scrip t type='text/java script' language='javas cript'>
alert('Incorrec t details, Enter correct details');
</script> ";
header("Re fresh:0;http:// localhost/e_cla ssified/super admin/login.htm l");
}
}
if(($rs[0]==$U sername)&&a mp;($rs[1]==$Pa ssword)&&am p;($rs[3]==$Sta tus))
{
if($_SESSION[&q uot;status" ;]==sadmin)
{
$_SESSION[" ;user"]=$U sername;
echo "<scrip t type='text/java script' language='javas cript'>
alert('Super Admin logged in successfully');
</script> ";
header("Re fresh:0;http:// localhost/e_cla ssified/super%2 0admin/s_activi ty.php");< br /> }
else
{
echo "<scrip t type='text/java script' language='javas cript'>
alert('Incorrec t details, Enter correct details');
</script> ";
header("Re fresh:0;http:// localhost/e_cla ssified/super admin/login.htm l");
}
}
?>




    Viewed: 2,726 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Checking Status of Admin and Su..." Posted: @ 8:12 pm on Apr 16 2015    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

Why is logging in opening into the same page an issue exactly? You could just change the header redirect to a different page.

Also, what specific issue are you dealing with here? Is there an error you're getting? If so, what does it say? Which line or variable is referenced?




-bs0d | AllSyntax.com

    Viewed: 2,704 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2017; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank