I have a forum that runs off a mysql database and I want to be able to use the forum login and p/w to access other areas of the site. The password encryption is custom, but looking through the php files, I can see how it is encrypted, I'm just not savy enough to get it to work. Hopefully someone here can help me.
Here is the section of the code where the passwords are compared...
if (my_crypt($in['current_password'],$row['password']) != $row['password']) {
Here are the my_crypt and get_salt functions:
function my_crypt($str,$salt) {
return crypt($str,substr($salt,0,2));
}
function get_salt() {
srand(time());
$random = "abcdefghijklmnopqrstuvwxyz1234567890";
$salt = substr($random,floor(rand(1,36)),1);
$salt .= substr($random,floor(rand(1,36)),1);
return $salt;
And here is the non functioning select satatement:
$password = my_crypt($password, $salt); //This is my problem...
$sql = "SELECT * FROM $table_name WHERE username = '$username' AND password = '$password'";
Sorry for the long post. I've been searching this site for months and have found TONS of helpful info already...Any help is appreciated...
Kale