This is a function that will encrypt your passwords much better than just md5ing them.
Usage: Add this to your file and then simply use ion_passwd() instead of md5().
function ion_passwd ($var) {
$var = str_replace('"',"",$var);
$var = str_replace("'","",$var);
$var = str_replace('`',"",$var);
$var = str_replace('|',"",$var);
$var = str_replace('%',"",$var);
$var = str_replace('--',"",$var);
$var = str_replace('/',"",$var);
$var = stripslashes($var);
$var = strip_tags($var);
$origvar = $var;
$var = sha1($origvar);
$salt = substr($var,0,4);
$var = ($origvar.$salt);
$var = sha1($var);
return $var;
};
Ok So lets look at what this does exactly..
Says Hey! Im making a new function!
function ion_passwd ($var) {
Replaces certain characters and strips slashes/html.
$var = str_replace('"',"",$var);
$var = str_replace("'","",$var);
$var = str_replace('`',"",$var); // ("character to look for","blank quotes so it replaces the characters with nothing","$var Gets automatically replaced with whatever variable you run through it")
$var = str_replace('|',"",$var);
$var = str_replace('%',"",$var);
$var = str_replace('--',"",$var);
$var = str_replace('/',"",$var);
$var = stripslashes($var);
$var = strip_tags($var);
Keep a clean copy of the actual password.
$origvar = $var;
sha1() The password, then only keep 4 characters, these are added to the actual password to make it harder to break.
$var = sha1($origvar); $salt = substr($var,0,4); $var = ($origvar.$salt);
Then finally it encrypts the password with its salt.
$var = sha1($var); $var = substr($var,0,30); return $var;
Example..
Password: '<b>%%lTest32//\\'
Clean Password: lTest32
RESULT:
f96c64dda78bd4c0dc0509d2c418204763e78eea
Feel free to post any comments, suggestions and so on.
Update: You should always clean your variables, I just added that part to the function so you could all see how to do it.
-IOn Photoshop
This post has been edited by Photoshop: 22 December 2010 - 12:15 PM


Help
This topic is locked
MultiQuote












