23.04.2011, 10:15
(
Последний раз редактировалось XFlawless; 23.04.2011 в 10:28.
Причина: Added MD5 and salt hashing
)
PHP код:
function sanitizeString($var){
$var = stripslashes($var);
$var = htmlentities($var);
$var = strip_tags($var);
return $var;
}
PHP код:
function sanitizeSQL($var){
$var = mysql_real_escape_string($var);
$var = sanitizeString($var);
return $var;
}
These codes are efficient and enhances security against SQL and XSS attacks.
If you want more security against passwords use this technique:
PHP код:
$Salt1 = "#$@#%#$!@$@#1234223233";
$Salt2 = "#*$(#@$&AJDSU#341224334";
$Hash = md5("$Salt1$password$Salt2");