<?
include "../config.php";
$account = secure($_POST['acc']);
$email = secure($_POST['email']);
$password = secure($_POST['pass']);
$repassword = secure($_POST['cpass']);
$question = secure($_POST['ques']);
$answer = secure($_POST['anse']);
$regtime = date('Y-m-d H:i:s');
if ((preg_match("/[^a-zA-Z0-9_-]/", $account))){
echo'Може да изплозвате само букви и цифри!';}
else {
check_inject();
$username_check = mssql_query("SELECT memb___id FROM MEMB_INFO WHERE memb___id='$account'");
$username_verify = mssql_num_rows($username_check);
$email_check = mssql_query("SELECT mail_addr FROM MEMB_INFO WHERE mail_addr='$email'");
$email_verify = mssql_num_rows($email_check);
if (empty($account) or empty($email) or empty($password) or empty($repassword) or empty($question) or empty($answer)) {
echo "<table class='sort-table' width='450' border='0' cellpadding='0' cellspacing='0' align='center'><tr><td class='left'>Some field are empty</td></tr></table><br />";
$error = 1;
}
elseif ($username_verify > 0) {
echo "<table class='sort-table' width='450' border='0' cellpadding='0' cellspacing='0' align='center'><tr><td class='left'>Account is already in use,
choose another!</td></tr></table><br />";
$error = 1;
}
elseif ($email_verify > 0) {
echo "<table class='sort-table' width='450' border='0' cellpadding='0' cellspacing='0' align='center'><tr><td class='left'>E-Mail is already in use,
choose another!</td></tr></table><br />";
$error = 1;
}
elseif ($password != $repassword) {
echo "<table class='sort-table' width='450' border='0' cellpadding='0' cellspacing='0' align='center'><tr><td class='left'>Please retype again the new password!</td></tr></table><br />";
$error = 1;
}
if ($error != 1) {
$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 ('$account','$password','DrakEWeb','1','$email','$regtime','$regtime','$regtime','$regtime','1','0','0','$question','$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,'$account','$account',1,'7','6','3','6','6','$regtime','0' )");
echo "<table class='sort-table' width='450' border='0' cellpadding='0' cellspacing='0' align='center'><tr><td class='left'>Your account - <font color='#d2288c'>$account</font> has been created successfully on <font color='#d2288c'>$regtime</font>!</td></tr></table><br />";
}}
?>