PHP登录验证页面怎么错了,分不是问题
登录:<html><head><metahttp-equiv="Content-Type"content="text/hrml;charset=UTF-8"/><titl...
登录:
<html>
<head>
<meta http-equiv="Content-Type" content="text/hrml;charset=UTF-8"/>
<title>Login</title>
</head>
<body>
<form action="logincheck_1.php" method='POST' >
<table border='1' cellpadding='0' cellspacing='0' width='80%' bgcolor='ABCDEF'>
<tr>
<td align='right'>用户名:</td>
<td><input type="text" name="username" id=""/></td>
</tr>
<tr>
<td align='right'>密码:</td>
<td><input type="password" name="password" id=""/></td>
</tr>
<tr>
<td colspan='2' align="center" >
<input type="submit" name='log' value='登录'/>
<a href="register.php">注册</a>
</td>
</tr>
</table>
</form>
</body>
注册:
<?php
if(!isset($_POST['log'])){
exit('非法访问!');
}
$username = htmlspecialchars($_POST['username']);
$password = MD5($_POST['password']);
//包含数据库连接文件
include('mysql_connect.php');
//检测用户名及密码是否正确
$check_query = mysql_query("select userid from user_list where username='$username' and password='$password' limit 1");
if($result = mysql_fetch_array($check_query)){
//登录成功
session_start();
$_SESSION['username'] = $username;
$_SESSION['userid'] = $result['userid'];
echo $username,' 欢迎你!进入 <a href="my.php">用户中心</a><br />';
echo '点击此处 <a href="login.php?action=logout">注销</a> 登录!<br />';
exit;
} else {
exit('登录失败!点击此处 <a href="javascript:history.back(-1);">返回</a> 重试');
}
?> 展开
<html>
<head>
<meta http-equiv="Content-Type" content="text/hrml;charset=UTF-8"/>
<title>Login</title>
</head>
<body>
<form action="logincheck_1.php" method='POST' >
<table border='1' cellpadding='0' cellspacing='0' width='80%' bgcolor='ABCDEF'>
<tr>
<td align='right'>用户名:</td>
<td><input type="text" name="username" id=""/></td>
</tr>
<tr>
<td align='right'>密码:</td>
<td><input type="password" name="password" id=""/></td>
</tr>
<tr>
<td colspan='2' align="center" >
<input type="submit" name='log' value='登录'/>
<a href="register.php">注册</a>
</td>
</tr>
</table>
</form>
</body>
注册:
<?php
if(!isset($_POST['log'])){
exit('非法访问!');
}
$username = htmlspecialchars($_POST['username']);
$password = MD5($_POST['password']);
//包含数据库连接文件
include('mysql_connect.php');
//检测用户名及密码是否正确
$check_query = mysql_query("select userid from user_list where username='$username' and password='$password' limit 1");
if($result = mysql_fetch_array($check_query)){
//登录成功
session_start();
$_SESSION['username'] = $username;
$_SESSION['userid'] = $result['userid'];
echo $username,' 欢迎你!进入 <a href="my.php">用户中心</a><br />';
echo '点击此处 <a href="login.php?action=logout">注销</a> 登录!<br />';
exit;
} else {
exit('登录失败!点击此处 <a href="javascript:history.back(-1);">返回</a> 重试');
}
?> 展开
2017-02-16
展开全部
有什么提示,或是什么情况,只是说个错了,不明白!
更多追问追答
追问
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\AppServ\www\logincheck_1.php on line 13
追答
mysql_fetch_array()参数设置有错!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询