<html> |
<!-- 一个简单的表单 --> |
<form action= "" method= "post" > |
username:<input type= "text" name= "username" ><br> |
password:<input type= "password" name= "password" ><br> |
<input type= "submit" name= "submit" value= "Login" > |
</form> |
</html> |
<?php |
include 'conn.php' ; //连接数据库文件 |
|
if (! empty ( $_POST [ 'submit' ])){ |
$username = str_replace ( " " , "" , $_POST [ 'username' ]); |
$sql = "select * from b_information where `username`='$username'" ; |
$query = mysql_query( $sql ); |
$row = mysql_fetch_array( $query ); |
$us = is_array ( $row ); |
//print_r(md5($_POST['password'].SALT)); |
//echo $us; |
if ( $us && $row [ 'password' ]==md5( $_POST [ 'password' ].SALT)){ |
echo "yes" ; |
} else { |
if ( $us ){ |
echo "ps wrong" ; |
} else { |
echo "no this user" ; |
} |
} |
|
} |