ostrox
asked on
Login script modification: Admin login only
I need to modify my current login script so that it only enables an administrator with the right admin credentials set to login, so basically it should only select the admin username from the members table.
<?php
session_start();
include("connection.php");
$email=$_POST['email'];
$passwd=$_POST['passwd'];
$email = stripslashes($email);
$passwd = stripslashes($passwd);
$email = mysql_real_escape_string($email);
$passwd = mysql_real_escape_string($passwd);
$sql="SELECT * FROM members WHERE email='admin' and password='admin'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if ($count==1){
$result_array = mysql_fetch_assoc($result);
foreach($result_array as $key => $value)
$_SESSION[$key] = $value;
header("location:moveahead.php");
}
else {
header("location:wrong.php");
}
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER