<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Sales Leader - INDEX</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="GenImg/SLStyles.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#9999CC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="750" border="0" cellpadding="0" cellspacing="0" bgcolor="GhostWhite" class="MainTable">
<tr>
<td width="212" height="67" valign="top"><img src="GenImg/SalesLeader.jpg" width="212" height="65"></td>
<td class="HeaderSliver"> </td>
</tr>
<tr>
<td height="546"> </td>
<td valign="top"> <form action="php-bin/Login.php" method="post" enctype="multipart/form-data" name="Login" target="_top" id="Login">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="BodyText">
<tr>
<td width="18%"> </td>
<td width="2%"> </td>
<td width="80%" class="BTBold">Login Page</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right">User Name</td>
<td> </td>
<td><input name="UserName" type="text" class="FieldBase" size="30" maxlength="24"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right">Password</td>
<td> </td>
<td><input name="Password" type="password" class="FieldBaseOptA" size="30" maxlength="24"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input name="Submit" type="submit" class="FieldBase" value="Log in"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<?php include("HTMLFrags/DefFoot.frag");?>
</body>
</html>
Thats the index.php where i can log in..and heres the login.php script:
<?php
$ErrorChecker = array();
$GreenLite = "true";
$SetDate;
if(!empty($UserName)){
if(($Length=strlen($UserName)) > 28){
array_push($ErrorChecker,"<span class='Error'>Warning</span><br>Sorry, there's been a system error!<br>");
}
}else{
array_push($ErrorChecker,"<span class='Error'>Your UserName</span><br>You forgot to enter your UserName!<br>");
}
if(!empty($Password)){
if(($Length=strlen($Password)) > 28){
array_push($ErrorChecker,"<span class='Error'>Warning</span><br>Sorry, there's been a system error!<br>");
}
}else{
array_push($ErrorChecker,"<span class='Error'>Your Password</span><br>You forgot to enter your password!<br>");
}
if(empty($ErrorChecker[0])){
include "../php-bin/modz/SLDBI.php";
//====----
$query = "SELECT UserID,Level,Name FROM 00_Users WHERE UserName LIKE '$UserName' AND Password LIKE '$Password' AND Status LIKE 'on'";
$result = mysql_query($query) or die("SL posting of $CompName failed: ".mysql_error());
if ($artrow = mysql_fetch_array($result)) {
do {
$UserID = $artrow["UserID"];
$UserLevel = $artrow["Level"];
$UserRealName = $artrow["Name"];
} while($artrow = mysql_fetch_array($result));
}
mysql_close($dblink);
if(empty($UserID)){
array_push($ErrorChecker,"<span class='Error'>Your Login failed!</span><br>Could verify your identity, please try again.<br>");
}
}
//====----
if(empty($ErrorChecker[0])){
setcookie("SLUser", "UserID&$UserID&Name&$UserRealName","","/");
//Decide where to direct the user based on their
//User level, right now there's just 2 options
//either this is an administrator or it's a
//regular user...
if($UserLevel > 1){
setcookie("SLAdm", "UserID&$UserID&Name&$UserRealName","","/");
header("Location: ../DefConsole.php");
}else{
header("Location: ../AdmConsole.php");
}
}else{
include "../HTMLFrags/ErrorTop.frag";
foreach ($ErrorChecker as $tripper) {
print "$tripper";
}
include "../HTMLFrags/ErrorFoot.frag";
}
//====----
?>