Rumah >pembangunan bahagian belakang >tutorial php > 这个php登陆代码总是不成功。请看看这是哪里有有关问题
这个php登陆代码总是不成功。请看看这是哪里有问题 ?
<?php<br /> <br /> session_start();<br /> $conn=mysql_connect("localhost","admin","admin") or die ("数据库链接错误".mysql_error());<br /> mysql_select_db('member',$conn) or die("选择数据库有错".mysql_error());<br /> <br /> define(ALL_PS, "php123");<br /> <br /> if($_POST[submit])<br /> {<br /> $username=str_replace(" ","",$_POST[username]);<br /> $sql="select * from user_list where 'username' ='$username'";<br /> $query=mysql_query($sql);<br /> $ps = $us ? md5($_POST[password].ALL_PS)==$row[password] : FALSE;<br /> <br /> if($ps){<br /> $_SESSION[uid]=$row[uid];<br /> $_SESSION[user_shell]=md5($row[username].$row[password].ALL_PS);<br /> echo "ok";<br /> }else{<br /> echo "no";<br /> }<br /> <br /> }<br /> <br /> ?><br /> <br /> <form action="" method="post""><br /> 用户:<input type="text" name="user" /><br /><br /> 密码:<input type="password" name="password" /><br /><br /> <input type="submit" name="submit" value="tttt" /><br /> </form><br />
if($_POST['submit'])<br /> {<br /> $username=str_replace(" ","",$_POST['username']);<br /> $sql="select * from user_list where `username` ='$username'";<br /> $query=mysql_query($sql);<br /> $row = mysql_fetch_assoc($query);<br /> $ps = $row['username'] ? md5($_POST['password'].ALL_PS)==$row[password] : FALSE;<br />