我正在使用以下代码行以保护通过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_ *'功能。另外,你是否保存简单的密码? –