如果你通过如下的方法进行验证 <pre> ////////////////////////// USED FOR AUTHENTICATION //////////////////////// function authenticate_user(){ Header("WWW-Authenticate: Basic realm=\"Restricted Admin Area\""); Header("HTTP/1.0 401 Unauthorized"); echo "You are not authorized to enter this section of the site!\n"; exit; } if(!isset($PHP_AUTH_USER)) { authenticate_user(); } else { $sql = "SELECT * FROM admins WHERE adminUsername='$PHP_AUTH_USER' && adminPassword='$PHP_AUTH_PW'"; $r = mysql_query($sql); if(@mysql_num_rows($r) < 1){ authenticate_user(); } } ////////////////////////// USED FOR AUTHENTICATION //////////////////////// </pre> 可以,由于在 mysql 里面密码是加密的,所以你可能需要这样来验证!! $sql = "SELECT * FROM admins WHERE adminUsername='$PHP_AUTH_USER' && adminPassword='PASSWORD($PHP_AUTH_PW)'"; |