求助!php中session验证用户登录出错!~

来源:百度知道 编辑:UC知道 时间:2024/05/31 18:55:04
求助!php中session验证用户登录出错!~不晓得哪里错了,就是不能登录.求助各位哥哥姐姐们指点指点,在些多谢!~希望加QQ:6021947
建表代码:
CREATE TABLE user(
id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
username VARCHAR(50)NOT NULL,
password VARCHAR(50)NOT NULL,
mail VARCHAR(255),
homepage VARCHAR(255),
leves VARCHAR(10) NOT NULL DEFAULT 'admin',
create_time VARCHAR(19) NOT NULL,
PRIMARY KEY (id));

表里的记录如下:
select * from user;
id username password mail homepage leves create_time
1 1 1 1 1 admin 1

PHP 页面:

<?php
session_start();
include("config.inc.php");
include("dbconnect.inc.php");
if($_GET["do"]=="logout") {
session_unset();
header("Location:index.php");
}
if($_GET["do"] == "1") {
$username = mysql_real_escape_string($_POST["username"]);
$passw

if(md5($password) == $row["password"])
以 MP5 加密用户提交来的密码。然后对比数据库里的。你数据库里的并不是 MD5 加密过的。永远都对不上号的。

改成这样再试试
if($password == $row["password"])