<? Error_Reporting (E_ALL & ~E_NOTICE);
function auth($user_name ,$user_pass) {
mysql_connect(" localhost","roo t","") or die("ERROR:1");
mysql_select_db ("Kasya") or die("ERROR:2");
$query = "SELECT * FROM `user_info` VALUES('user_na me','user_pass' )";
$result = mysql_query($qu ery);
$inf = mysql_fetch_arr ay($result);
if($inf['user_name'] == $user_name and $inf['user_pass'] == $user_pass) {
echo("Access Allow!");
}
else {
die("Access Denied! Invalid Username or Password!");
}
}
echo "
<form action='$PHP_SE LF' method='post'>
UserName: <input type='text' name='name'><br/>
Password: <input type='password' name='pass'><br/>
<input type='submit' name='ok' value='Enter'>
</form>
";
$user = $_POST['user'];
$pass = $_POST['pass'];
$ok = $_POST['ok'];
auth($user,$pas s);
?>
Errors:
Warning: mysql_fetch_arr ay(): supplied argument is not a valid MySQL result resource in w:\home\localho st\www\kasya\db .php on line 9
function auth($user_name ,$user_pass) {
mysql_connect(" localhost","roo t","") or die("ERROR:1");
mysql_select_db ("Kasya") or die("ERROR:2");
$query = "SELECT * FROM `user_info` VALUES('user_na me','user_pass' )";
$result = mysql_query($qu ery);
$inf = mysql_fetch_arr ay($result);
if($inf['user_name'] == $user_name and $inf['user_pass'] == $user_pass) {
echo("Access Allow!");
}
else {
die("Access Denied! Invalid Username or Password!");
}
}
echo "
<form action='$PHP_SE LF' method='post'>
UserName: <input type='text' name='name'><br/>
Password: <input type='password' name='pass'><br/>
<input type='submit' name='ok' value='Enter'>
</form>
";
$user = $_POST['user'];
$pass = $_POST['pass'];
$ok = $_POST['ok'];
auth($user,$pas s);
?>
Errors:
Warning: mysql_fetch_arr ay(): supplied argument is not a valid MySQL result resource in w:\home\localho st\www\kasya\db .php on line 9
Comment