I am receiving an error see below (This script used to work on the system I had before this one) I am grateful of any help that I might get.
Here is the error that I am receiving, this used to work fine on another system!
"Notice: Undefined variable: submit in C:\wamp\www\concierge\scripts\authenticate\auth.php on line 7"
The are 2 scripts being used, one is an authentication input interface. index.php
And the other is the authentication processing script. auth.php
See scripts below:
------------------------------------------------------------------------------------------
index.php:
------------------------------------------------------------------------------------------
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Concierge</title>
<!--
@import url(layout/style.css);
-->
<style type="text/css">
<!--
body,td,th {
color: #283A86;
}
-->
</style></head>
<body>
<form method="POST" action="scripts/authenticate/auth.php">
<p> </p>
<p> </p>
<div align="center"> <center>
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#283A86">
<tr>
<td align="center"><img border="0" src="graphics/framing/ltc.gif" width="91" height="91"></td>
<td align="center"><img border="0" src="graphics/framing/top_whole.gif" width="200" height="91"></td>
<td align="center"><img border="0" src="graphics/framing/rtc.gif" width="91" height="91"></td>
</tr>
<tr>
<td align="center"><img border="0" src="graphics/framing/left_whole.gif" width="91" height="171"></td>
<td align="center"> <table border="0" cellpadding="0" cellspacing="0" height="62" bgcolor="#283A86">
<tr>
<td align="center" height="25"> <p align="center"><font color="#FFFFFF"><b>User</b></font></p></td>
<td align="center" height="25"><input type="text" name="login" size="14"></td>
</tr>
<tr>
<td align="center" height="12">_________</td>
<td align="center" height="12"> </td>
</tr>
<tr>
<td align="left" height="13"><font color="#FFFFFF"><b> Password
</b></font> </td>
<td align="center" height="13"><input type="password" name="password" size="14"></td>
</tr>
<tr>
<td align="center" height="6" colspan="2"> </td>
</tr>
<tr>
<td align="center" height="6"> </td>
<td align="center" height="6"> <p align="left">
<input type="submit" value="Login" name="submit">
</td>
</tr>
</table></td>
<center>
<td align="center"><img border="0" src="graphics/framing/right_whole.gif" width="91" height="171"></td>
</center>
</tr>
<tr>
<td align="center"><img border="0" src="graphics/framing/blc.gif" width="91" height="91"></td>
<td align="center"><img border="0" src="graphics/framing/bottom_whole.gif" width="200" height="91"></td>
<td align="center"><img border="0" src="graphics/framing/brc.gif" width="91" height="91"></td>
</tr>
</table>
</center> </div>
</form>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><font color="#808080" size="2">Concierge System </font></td>
</tr>
<tr>
<td align="center"><font color="#808080" size="2">Powered by</font></td>
</tr>
<tr>
<td align="center"><a href="http://www.onina.net" target="_blank"><font size="2" color="#0000FF">Onina</font></a></td>
</tr>
</table>
</center>
</div>
<p align="center"> </p>
</body>
</html>
------------------------------------------------------------------------------------------
auth.php
------------------------------------------------------------------------------------------
<?php
/* Seems to be a problem right here, it looks like I am trying to submit an undefined variable that does not exist but it does, as it should be being passed from the index,php form.
*/
////////////////
if ($submit)
///////////////
{$db = mysql_connect("localhost", "example", "example");
mysql_select_db("concierge", $db);
$sql = "
SELECT privilage
FROM auth
WHERE login = '$login'
AND password = '$password'
";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
$privilage = $row["privilage"];
}
if (!mysql_num_rows($result)) {
header("Location: ../../index.php");
// if the information doesn't match, i.e. returns
// no records, then they shouldn't be there.
} else {
setcookie('username', $_POST['username'], (time()-2592000), '/', '', 0);
setcookie('privilage', $_POST['privilage'], (time()-2592000), '/', '', 0);
}
// Receptionist level
if ($privilage == "receptionist") {
header("Location: ../../employees/receptionist/index2.htm");
// Managers level
} elseif ($privilage == "manager") {
header("Location: ../../employees/managers/index1.htm");
// Administrator level
} elseif ($privilage == "administrator") {
header("Location: ../../admin/index.php");
}
// for each access level, the level is displayed
// as well as the link to the next.php script.
// For expansion, the access level displayed could
// also be stored in a database for dynamic retrieval.
} else {
// if they haven't submitted their username and
// password, then the original form is displayed
?>
<?php
}
?>