//Function Register
function aiweb_register(){
$characters = "0123456789abcdefghijklmnopqrstuvwxyz";
for($p = 0; $p < 5; $p++) {
$captcha .= $characters[mt_rand(0, strlen($characters))];
}
$limit = mssql_num_rows(mssql_query("SELECT * FROM MEMB_INFO"));
if($this->registerON == "OFF"){
$error = 1;
echo "<font color='RED'>".error10."</font>";
}
elseif($limit >= $this->maxregister){
$error = 1;
echo "<font color='RED'>".error11."</font>";
}
else{
echo "
<form method='POST'>
<table width='600' align='center' border='0' cellspacing='5' cellpadding='5' class='register_table'>
<tr>
<td align='left'>".accountid.":</td>
<td align='left'><input type='text' name='user' size='20' maxlength='20'></td>
<td align='left'><font color='red'><small>".info1."</small></font></td>
</tr>
<tr>
<td align='left'>".password.":</td>
<td align='left'><input type='password' name='pass' size='20' maxlength='20'></td>
<td align='left'><font color='red'><small>".info1."</small></font></td>
</tr>
<tr>
<td align='left'>".repassword.":</td>
<td align='left'><input type='password' name='pass2' size='20' maxlength='20'></td>
</tr>
<tr>
<td align='left'>".email.":</td>
<td align='left'><input type='text' name='mail4e' size='20' maxlength='20'></td>
</tr>
<tr>
<td align='left'>".secquestion.":</td>
<td align='left'>
<select name='secq'>
<option value='When you're born?'>When you're born?</option>
<option value='Who is your favorite hero?'>Who is your favorite hero?</option>
<option value='What's your first name?'>What's your first name?</option>
<option value='What's your favorite item?'>What's your favorite item?</option>
<option value='What's your dog name?'>What's your dog name?</option>
<option value='Who is your favorite character?'>Who is your favorite character?</option>
</select>
</td>
</tr>
<tr>
<td align='left'>".secanswer.":</td>
<td align='left'><input type='text' name='seca' size='20' maxlength='20'></td>
</tr>
<tr>
<td align='left'>".botcheck.":</td>
<td align='left'><input type='test' name='cpu' size='5' value='".$captcha."' readonly style='font-size:14px';></td>
<td align='left'><input type='text' name='cap' size='5' maxlength='5'></td>
</tr>
<tr>
<td align='left'><input type='submit' class='reg_but' name='regni' value='".submit."'></td>
<td align='left'><input type='reset' class='reg_but' value='".reset."'></td>
</tr>
</table>
</form>
";
}
if(isset($_POST[regni])){
$user = $this->cValue(addslashes(htmlspecialchars($_POST[user])));
$pass = $this->cValue(addslashes(htmlspecialchars($_POST[pass])));
$repass = $this->cValue(addslashes(htmlspecialchars($_POST[pass2])));
$mail = addslashes(htmlspecialchars($_POST[mail4e]));
$cap = addslashes(htmlspecialchars($_POST[cap]));
$cpu = addslashes(htmlspecialchars($_POST[cpu]));
$secq = addslashes(htmlspecialchars($_POST[secq]));
$seca = addslashes(htmlspecialchars($_POST[seca]));
$sex = addslashes(htmlspecialchars($_POST[sex]));
$date = date('d/m/Y');
$query = mssql_query("SELECT mail_addr FROM MEMB_INFO WHERE mail_addr='$mail'");
$row = mssql_fetch_row($query);
$query2 = mssql_query("SELECT memb___id FROM MEMB_INFO WHERE memb___id='$user'");
$row2 = mssql_fetch_row($query2);
if(empty($user))
{
$error = 1;
echo "<font color='RED'>".error1."</font>";
}
elseif($user == $row2[0]){
$error = 1;
echo "<font color='RED'>".error9."</font>";
}
elseif(strcasecmp($user, $row[0]) == 1){
$error = 1;
echo "<font color='RED'>".error28."</font>";
}
elseif(preg_match("/[^a-zA-Z0-9]/i", $user)){
$error = 1;
echo "<font color='RED'>".error7."</font>";
}
elseif(empty($pass)){
$error = 1;
echo "<font color='RED'>".error2."</font>";
}
elseif(preg_match("/[^a-zA-Z0-9]/i", $pass)){
$error = 1;
echo "<font color='RED'>".error7."</font>";
}
elseif(empty($repass)){
$error = 1;
echo "<font color='RED'>".error3."</font>";
}
elseif($pass != $repass){
$error = 1;
echo "<font color='RED'>".error4."</font>";
}
elseif(empty($mail)){
$error = 1;
echo "<font color='RED'>".error5."</font>";
}
elseif($mail == $row[0]){
$error = 1;
echo "<font color='RED'>".error8."</font>";
}
elseif($cap != $cpu){
$error = 1;
echo "<font color='RED'>".error6."</font>";
}
elseif(empty($seca)){
$error = 1;
echo "<font color='RED'>".error12."</font>";
}
if($error == 0){
if($this->md5_p == "On"){
$query = mssql_num_rows(mssql_query("SELECT memb_guid FROM MEMB_INFO"));
$id = $query+1;
$insert = mssql_query("INSERT INTO MEMB_INFO (memb_guid,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,GoldChannelTime,GoblinCoin,WCoinP,WCoin,SCFExtWarehouse,SCFLuckyCoins,SCFWareVipCount,SCFVipDays,SCFVipMoney,SCFIsVip) VALUES ('$id','$user',[dbo].[fn_md5]('$pass','$user'),'[MU]AIWeb','111111111111','$mail',$date,$date,'2012-01-20','2012-01-20','1','0','0','$secq','$seca',1,0,0,0,0,0,0,0,0,0)");
}
if($this->md5_p == "Off"){
$insert = 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 ('$user','$pass','[MU]AIWeb','111111111111','$mail',$date,$date,'2012-01-20','2012-01-20','1','0','0','$secq','$seca')");
$set_vi = 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 ('2012','1','1234','$user','$user','1','7','6','3','6','6','2012-01-20 01:52:00','0')");
}
echo "<font color='GREEN'>".greetings."</font>";
}
}
}
//END OF Register