谁帮我看下我的这个PHP用户名验证啊

来源:百度知道 编辑:UC知道 时间:2024/09/28 12:27:34
其他别的 还有数据库我都编好了
下面是checklogin.php
<?
require_once('conn.php');
session_start();
$username=$_POST['username'];
$password=$_POST['password'];

到这我该怎么写 就是说如果和数据库的用户名密码一样就echo...else...
?>
我分都用光了 大家帮帮我吧

$sql="select * from XXX where username='$username'";
$result=@mysql_query($sql);
if ($result) {
$rs=@mysql_fetch_array($result);
if ($rs && $rs[username]='$username' && $rs[password]='$password') {
session赋值,跳转...
} else {
echo "user or pass wrong";
} else {
echo "username is null";
}