Някой можели да оправи Регистара?

crazzybg

Registered



function register()
{
$reg_account = secure($_POST['reg_account']);
$reg_password = secure($_POST['reg_password']);
$reg_repassword = secure($_POST['reg_repassword']);
$reg_mail = secure($_POST['reg_mail']);
$reg_question = secure($_POST['reg_question']);
$reg_answer = secure($_POST['reg_answer']);
$reg_code = secure($_POST['reg_code']);
$reg_agree = secure($_POST['reg_agree']);
$reg_time = date('Y-m-d H:i:s');

$acc_len = strlen($reg_account);
$pass_len = strlen($reg_password);
$ques_len = strlen($reg_question);
$answ_len = strlen($reg_answer);

check_inject();

$exists_accq = mssql_query("Select * from MEMB_INFO where memb___id='$reg_account'");
$exists_acc = mssql_num_rows($exists_accq);

$exists_mailq = mssql_query("Select * from MEMB_INFO where mail_addr='$reg_mail'");
$exists_mail = mssql_num_rows($exists_mailq);

if(empty($reg_account) or empty($reg_password) or empty($reg_repassword) or empty($reg_mail) or empty($reg_question) or empty($reg_answer) or empty($reg_code)) { echo"<tr><td align='center' class='modules'><b>Error:</b> You can not leave empty fields !</td></tr>"; $error=1; }
else{

if($acc_len < 4) { echo"<tr><td align='center' class='modules'><b>Error:</b> Account must be at least 4 symbols !</td></tr>"; $error=1; }
elseif($exists_acc != 0) { echo"<tr><td align='center' class='modules'><b>Error:</b> Another member has already registered with this account !</td></tr>"; $error=1; }

if($pass_len < 4) { echo"<tr><td align='center' class='modules'><b>Error:</b> Password must be at least 4 symbols !</td></tr>"; $error=1; }
elseif($reg_password != $reg_repassword) { echo"<tr><td align='center' class='modules'><b>Error:</b> Passwords did not match !</td></tr>"; $error=1; }

if(!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$",$reg_mail) && count($_POST)>0 && count($reg_mail)<60) { echo"<tr><td align='center' class='modules'><b>Error:</b> Invalid email address! Only 0-9 a-z and @ and . and _ and - !</td></tr>"; $error=1; }
elseif($exists_mail != 0) { echo"<tr><td align='center' class='modules'><b>Error:</b> Another member has already registered with this email !</td></tr>"; $error=1; }

if($ques_len < 4) { echo"<tr><td align='center' class='modules'><b>Error:</b> Question must be at least 4 symbols !</td></tr>"; $error=1; }
if($answ_len < 4) { echo"<tr><td align='center' class='modules'><b>Error:</b> Answer must be at least 4 symbols !</td></tr>"; $error=1; }
if(md5($reg_code) != $_SESSION['random_value']) { echo"<tr><td align='center' class='modules'><b>Error:</b> Please go back and write the code correctly !</td></tr>"; $error=1; }
if($reg_agree != agree) { echo"<tr><td align='center' class='modules'><b>Error:</b> You must agree with the terms !</td></tr>"; $error=1; }


if($error != 1) {
echo"<tr><td align='center' class='modules'><span class='online'>Account $reg_account successfuly created on $reg_time !</span></td></tr>";

$a = mssql_query("INSERT INTO MEMB_INFO (memb___id,memb__pwd,memb_name,sno__numb,mail_addr,appl_days,modi_days,out__days,true_days,mail_chek,bloc_code,ctl1_code,fpas_ques,fpas_answ) VALUES ('$reg_account','$reg_password','Xproject','1','$reg_mail','$reg_time','$reg_time','$reg_time','$reg_time','1','0','0','$reg_question','$reg_answer')");
$b = mssql_query("INSERT INTO VI_CURR_INFO (ends_days,chek_code,used_time,memb___id,memb_name,memb_guid,sno__numb,Bill_Section,Bill_value,Bill_Hour,Surplus_Point,Surplus_Minute,Increase_Days ) VALUES ('2005','1',1234,'$reg_account','$reg_account',1,'7','6','3','6','6','$reg_time','0' )");
$c = mssql_query("INSERT INTO MEMB_CREDITS (memb___id,credits) VALUES ('$reg_acc','0')");
}}}






Това ми е register.php и да попитам някой може ли да му добави MD5 ?
че като пробвам винаги ми дава грешки :(
Искам MD5 само за паролата и ако мога да попитам какво да напиша в
Login страницата за да е зачита като правилна
 
Това не е частта с php кода. При записването в базата данни се слага md5.
$parola = md5($parola);
 

Горе