I hope you can help me with a little problem i've got. I have a login script thats working fine and it redirects the users to there appropriate homepages. The way the users are different is defined by there usertype which is stored in the database table 'users'. The extra bit want to add is a third user which gets redirected to there homepage. Right now theres only two different user groups admin and call center i would like to add the engineers as well.
The script below is the login script and i've added the engineeers redirect. I don't know how to add final bit. I've used a else again and thats were the error occurs. Does anyone know how 2 get the final section working
any answers would be cool
Heres the script
Code: Select all
<?php
session_start();
include('redirect.php');
$_SESSION['UserID'] = $_POST['UserID'];
$UserID=$_SESSION['UserID'];
$connection = mysql_connect("", "", "");
$Usertype = mysql_query("select Usertype from users where UserID= '$UserID'");
mysql_select_db ("");
$result = mysql_query("SELECT * from users WHERE UserID='$UserID'");
$row = mysql_fetch_assoc($result);
if (!isset($_POST['UserID']) || !isset($_POST['Password']) ||
$_POST['UserID']=='' || $_POST['Password']=='')
{
echo "<center><h1>LOGIN WARNING</h1><br></center>";
echo "<h3>You are are not an employee of S.E Services </h3><br>";
echo "<h3>Go away</h3>";
}
elseif ($_POST['Password'] !=$row['Password'])
{
echo "<h1>You have entered the wrong password</h1>";
echo "<h1>Please re-type</h1>";
}
elseif ($row['Usertype']==0)
{
$_SESSION['Usertype'] = 0;
redirect ('Administration/AdminHomepage.php');
}
else
{
$_SESSION['Usertype'] = 1;
redirect ('Call%20Center/Call%20center%20Homepage.htm');
}
else //this bit doesn't work
{
$_SESSION[['Usertype'] = 2;
redirect ('Engineers/Engineers%20Homepage.htm');
}
?>