Here is the MD5 alternative:
<?PHP $user_name = $_POST['u_name']; $password = $_POST['pass']; //db connection string $db = mysql_connect("localhost","root","pass"); mysql_select_db("my_database",$db); //replace the above values with your actual database val //We will now retrive the password from the database $sql_query = mysql_query("SELECT password FROM user_data WHERE user_name='$user_name'",$db); $rs = mysql_fetch_row($sql_query); //comparing passwords Note before we can compare the password we use md5() to encrypt the $password becuase the password that we retrive from the database is in the encrypted form. if(md5($password) != $rs[0]) echo "ERROR: Invalid User"; else echo "Congrats, Password is correct!"; ?>
( I pulled this off http://www.phpbuddy.com/ ) Although this shows you how fast and easy it is to use MD5 and personally I prefer it over PEAR