我正在使用以下代碼行以保護通過PHP腳本進行登錄或類似登錄。請讓我知道是否足以抵禦攻擊,或者我需要添加更多的行以使代碼更安全。安全PHP登錄腳本
// To protect MySQL injection (more detail about MySQL injection)
$username = stripslashes($username);
$password = stripslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
根本不使用'mysql_ *'是一個開始。 –
PDO:http://php.net/manual/en/book.pdo.php。教程:http://net.tutsplus.com/tutorials/php/php-database-access-are-you-doing-it-correctly/ – ashley
像@BenFortune說,沒有'mysql_ *'功能。另外,你是否保存簡單的密碼? –