PDA

View Full Version : prfile_updatepassword_complete hook


fogjuice
06-05-2010, 07:08 PM
Hello,

I'm trying to create a small script but seem to be running into problems, can someone tell me if they see anything wrong with this code? I have a bridge between two databases, hence the mysql_connect. This is supposed to update the password on my remote server when the user changes his or her password through vbulletin. However, if the account has not been created on my remote server, then this will create it when the user updates his or her password.

mysql_connect("****","****","******");


$sha_pass_hash = sha1(mysql_real_escape_string(strtoupper($vbulleti n->userinfo['username'])) . ":" . mysql_real_escape_string(strtoupper($savepass)));

$query = mysql_query("SELECT count(*) FROM realmd.account WHERE username='{$vbulletin->userinfo[username]}'");
if(mysql_num_rows($query) > 0)
{
mysql_query("UPDATE realmd.account SET v=0,s=0,sha_pass_hash='$sha_pass_hash', email='{$vbulletin->GPC[email]}' WHERE username='{$vbulletin->userinfo[username]}'");
}
else
{
mysql_query("INSERT INTO realmd.account(username,sha_pass_hash, email, expansion) VALUES('{$vbulletin->userinfo[username]}', '$sha_pass_hash' ,'{$vbulletin->userinfo[email]}',2)");
}