السلام عليكم جميعا ً ..
هل بالإمكان مساعدتي لمعرفة سبب الخطأ الذي يظهر عند استعراض الصفحة التي تحتوي على هذا الكود
علماً بأني أستخدم Web-developer Server suite
Apche2.2
PHP5
:
<? include("connection.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p> </p>
<table width="627" border="0" id="table1">
<tr valign="top">
<td height="14">
<table width="99%" border="0" id="table2">
<tr>
<td width="93%" valign="top">
<b><font face="Times New Roman, Times, serif" color="#FF0000">
*This page for system administrator only.</font></b><table width="52%" border="0" id="table3">
<tr>
<td bgcolor="DDE3E6">
<table width="99%" border="0" id="table4">
<tr align="left">
<form name="form1" method="post" action="administrator.php">
<td width="28%" bgcolor="DDE3E6" valign="middle"><b>
User Name</b></td>
<td width="65%" bgcolor="DDE3E6" valign="middle">
<input name="username" type="text" size="18" maxlength="25">
</td>
</tr>
<tr align="left">
<td width="28%" bgcolor="DDE3E6" valign="middle"><b>
Password</b></td>
<td width="65%" bgcolor="DDE3E6" valign="middle">
<input name="password" type="password" size="20" maxlength="25">
</td>
</tr>
</form>
<tr align="left">
<td width="28%" bgcolor="DDE3E6" valign="middle"> </td>
<td width="65%" bgcolor="DDE3E6" valign="middle">
<div align="left"><img src="images/ResetButton.gif" width="70" height="24" onClick="document.forms[0].reset()">
<img src="images/EnterButton.gif" width="70" height="24" onClick="document.forms[0].submit()"></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p> </p>
<?
if($hit == "true")
{
if(empty($username) || empty($password))
{
echo "<font face='Times New Roman, Times, serif' color='#FF0000'> please fill all fields,, </font>";
}
else if(!(preg_match("/^[a-zA-Z0-9]+$/",$username)) || !(preg_match("/^[a-zA-Z0-9]+$/",$password)))
{
echo "<font face='Times New Roman, Times, serif' color='#FF0000'> you can use alphabet and numeric values only,, </font>";
}
else
{
include("connection.php");
$user = $_POST['username'];
$pass = $_POST['password'];
$sql = "select * from admin where name='". $user ."' and passwd='". $pass ."'";
$result = execute_query($sql);
if(mysql_num_rows($result) != 0)
{
setcookie("admin",$user);
header('Location:view_report.php');
}
else
{
echo "user name or password is not correct,,";
}
}
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>علما بان الخطأ الذي يظهر هو:
Notice: Undefined variable: hit in C:\www\vhosts\localhost\aou\administrator.php on line 52
السطر المذكور في الخطأ هو:
if($hit == "true")