Hi Guys,
I currently have a login page. This is for both clients and admin staff. If the client types in their username/password i want them to goto index.php, however, if the admin staff put their username/password i want them to be directed to membership.php
In my database i have the table members with a field called "admin". If the member is an admin staff member their value equals yes.
What would i need to add to the following script inorder to get this to function?
<?
session_start();
if ($userid && $password)
{
// if the user has just tried to log in
$db_conn = mysql_connect('localhost', 'username', 'password');
mysql_select_db("psp", $db_conn);
$query = "SELECT * FROM members WHERE login_name='$userid' AND password='$password'";
$result = mysql_query($query, $db_conn);
if (mysql_num_rows($result) >0 )
{
// if they are in the database register the user id
$valid_user = $userid;
session_register("valid_user");
}
}
if (session_is_registered("valid_user"))
{
// logged in successfully to membership area
header ("Location: http://www.prosportsprofits.com/new_psp/membership.php ");
}
else
{
if (isset($userid))
{
// if they've tried and failed to log in
header ("Location: http://www.prosportsprofits.com/new_psp/warning.php ");
}
else
{
// they have not tried to log in yet or have logged out
header ("Location: http://www.prosportsprofits.com/new_psp/warning.php ");
}
}
?>
Cheers,
micmac