Little PHP problem
Posted: Mon Mar 28, 2011 6:54 am
function create_account($user,$pass,$email)
{
global $db_translation,$db,$a_user;
global $tempID,$email,$pass_enc; //////////
$pass = preg_replace( "/[^A-Za-z0-9]/", "", $pass ); //only letters and numbers
$user = preg_replace( "/[^A-Za-z0-9]/", "", $user ); //only letters and numbers
$pass_enc=sha1(strtoupper($user).':'.strtoupper($pass));
$db->query("INSERT INTO ".$db_translation['accounts']." (".$db_translation['login'].",".$db_translation['encrypted_password'].",".$db_translation['banned'].",".$db_translation['email'].",".$db_translation['flags'].") VALUES ('".$user."','".$pass_enc."','0','".$db->escape($email)."','2')") or ($report = 'Error: '.mysql_error());
$sel="select * from ".$db_translation['accounts']." order by id desc limit 1"; //////////
$tempID=mysql_result(mysql_query($sel), 0, 0); //////////
$forumpass=md5(strtoupper($user).':'.strtoupper($pass)); //////////
if (!$report)
return false;
else
return $report;
}
///////
Main problem is the PASSWORD returning empty value to the db.
why?
{
global $db_translation,$db,$a_user;
global $tempID,$email,$pass_enc; //////////
$pass = preg_replace( "/[^A-Za-z0-9]/", "", $pass ); //only letters and numbers
$user = preg_replace( "/[^A-Za-z0-9]/", "", $user ); //only letters and numbers
$pass_enc=sha1(strtoupper($user).':'.strtoupper($pass));
$db->query("INSERT INTO ".$db_translation['accounts']." (".$db_translation['login'].",".$db_translation['encrypted_password'].",".$db_translation['banned'].",".$db_translation['email'].",".$db_translation['flags'].") VALUES ('".$user."','".$pass_enc."','0','".$db->escape($email)."','2')") or ($report = 'Error: '.mysql_error());
$sel="select * from ".$db_translation['accounts']." order by id desc limit 1"; //////////
$tempID=mysql_result(mysql_query($sel), 0, 0); //////////
$forumpass=md5(strtoupper($user).':'.strtoupper($pass)); //////////
if (!$report)
return false;
else
return $report;
}
///////
Main problem is the PASSWORD returning empty value to the db.
why?