<?php session_start();
include_once("include/Connection.php");
$userid=$_POST['userid'];
$password=$_POST['password'];
$loginSql = "SELECT * FROM admin2 WHERE admin_name='$userid' and admin_psw='$password'";
$loginQuery=mysql_query($loginSql);
$num_row = mysql_num_rows($loginQuery);
$login = mysql_fetch_array($loginQuery);
$user = $login['admin_name'];
$password = $login['admin_psw'];
echo $user;
echo $password;
if($num_row >0)
{
if($user == $userid)
{
$_SESSION['id_gosi'] = $login['id'];
$_SESSION['userid_gosi'] = $login['admin_name'];
header("Location: CustomerMaster.php");
}
else{
header("Location: index.php?msg=2");
exit();}}
else{
header("Location: index.php?msg=1");
}?>
警告:无法修改标头信息 - 已在C:\ wamp \ www \ php_mahavirbhadra \ Admin \ validate_login.php中发送的标头(输出从C:\ wamp \ www \ php_mahavirbhadra \ Admin \ validate_login.php:17开始)在第26行
警告:未知:未释放1个结果集。使用mysql_free_result释放在第0行使用未知的mysql_query()请求的结果集
当我在php上面写入管理员登录代码而不是连接成功完成但是给我上面的错误我能为这个错误做些什么...请给我解决方案....
答案 0 :(得分:2)
打印/回音!!!
/* echo $user;
echo $password;*/
if($num_row >0)
{
if($user == $userid)
{
....
header("Location: CustomerMaster.php");
}
else
{
header("Location: index.php?msg=2");
exit();
}
}
else
header("Location: index.php?msg=1");
?>
永远不会在HEADER之前回复任何内容,因此请删除ECHO $USER, $PASSWORD
提示1-&gt;使用mysqli而不是mysql
提示2-&gt;使用准备好的声明
提示3-&gt;使用mysql_real_escape_string()