We have a login page that we have people login to access information. We want to be able to deny access to a certain link depending on what password they enter.
the login informatin is pulled from the DEALER_NUM and PASSWORD field in the table. I have created a field called PASSWORD2 which is what we will be using for the special access if thats what you want to call it.
I am stumped on how exactly to write it, but in a nutshell again. The Dealer Number will always be the same and just need to check which password they are inputting and if they input the 2nd one I will add what it needs to deny
//PARSE LOGIN (if user just sent un and pw, check db for login)
if ($login) {
$rh_legaluser = mysql_query("select id from dealers where DEALER_NUM = '$login' and PASSWORD = '$password'");
$num_rows = mysql_num_rows($rh_legaluser);
if ( $num_rows > 0) {
//checks to see if user is Canadian or American
if(substr($login, 0, 1)=='C'){
setcookie(dealerLogin,"$login",null,"/"); //set cookie to keep track of login
$dealerLogin = $login; //necessary as cookies aren't available right away
echo "<script>document.location.href='http://www.domain.com/secure/can/index.php';</script>";
}else{
setcookie(dealerLogin,"$login",null,"/"); //set cookie to keep track of login
$dealerLogin = $login; //necessary as cookies aren't available right away
}
} else {
$noLogin = "Unable to login. The supplied username and password were incorrect.";
}
}
Here is for the login prompt
//LOGIN PROMPT
} else { //not logged in - display prompt to do so
if ($noLogin) {
$contentHTML .= "<p> $noLogin</p>
<p>Please try again</p>";
}
$headerHTML = '<div class="header">Please Log In</div><br>';
$contentHTML .= '
<form action="'.$PHP_SELF.'?'.$QUERY_STRING.'" method="post">
<div class="element" style="width: 50%;">
<div class="subhead_em">Returning Dealers</div>
<table border="0">
<tr>
<td>Dealer ID</td><td><input type="text" name="login" value="'.$login.'"></td>
</tr>
<tr>
<td>Password</td><td><input type="password" name="password"></td>
</tr>
</table>
<input type="submit" value="Login">
Thanks in advance