<?
include "cnn.php";
?>
<?php
$login = stripslashes($_POST['login']);
$name = stripslashes($_POST['name']);
$email = stripslashes($_POST['email']);
$idnumb = stripslashes($_POST['idnumb']);
$pw = stripslashes($_POST['pw']);
$cpw = stripslashes($_POST['cpw']);
$sques = stripslashes($_POST['squest']);
$sansw = stripslashes($_POST['sansw']);
$sql_email_check = mssql_query("SELECT mail_addr FROM MEMB_INFO WHERE mail_addr='$email'"); 
$sql_username_check = mssql_query("SELECT memb___id FROM MEMB_INFO WHERE memb___id='$login'"); 
$email_check = mssql_num_rows($sql_email_check); 
$username_check = mssql_num_rows($sql_username_check); 

if (($email_check > 0) || ($username_check > 0) || empty($login) || empty($name) || empty($email) || empty($idnumb) || empty($pw) || empty($cpw) || empty($sques) || empty($sansw)) 
{ 
    echo "<div class=qdestaques><label>Aten&ccedil;&atilde;o:</label><br />";
	
	if (empty($login) || empty($name) || empty($email) || empty($idnumb) || empty($pw) || empty($cpw) || empty($sques) || empty($sansw))
{ 
echo "Por favor preencha todos os campos!</div>";
}

    elseif($email_check > 0){ 
        echo "'$email' esse e-mail ja esta sendo usando por outro membro!<br /></div>"; 
        $Error=1;
    } 
    elseif ($username_check > 0)
	{ 
        echo "'$login' esse login ja esta sendo usado por outro membro!<br /></div>"; 
         $Error=1;
    } 
elseif ($pw != $cpw) 
{
	echo "As Senhas devem ser iguais!<br /></div>";  $Error=1;
}

}
else
{
$msquery2 = "SET IDENTITY_INSERT MEMB_INFO ON";
$msquery3 = "INSERT INTO MEMB_INFO (memb_guid,memb___id,memb__pwd,memb_name,sno__numb,post_code,addr_info,addr_deta,tel__numb,mail_addr,phon_numb,fpas_ques,fpas_answ,job__code,appl_days,modi_days,out__days,true_days,mail_chek,bloc_code,ctl1_code) VALUES ('1','$login','$pw','$name', '1','1234','11111','$idnumb','12343','$email','$email','$sques','$sansw','1','2003-11-23','2003-11-23','2003-11-23','2003-11-23','1','0','1')";
$msquery4 = "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,'$login','$name',1,'7','6','3','6','6','2003-11-23 10:36:00','0' )";
$msresults= mssql_query($msquery2);
$msresults= mssql_query($msquery3);
$msresults= mssql_query($msquery4);
echo "
<h1>Conta cadastrada</h1>
<div class=qdestaques>
<label>Login: <strong>$login</strong></label>
<label>Senha: <strong>$pw</strong></label>
<label>Nome: <strong>$name</strong></label>
<label>E-mail: <strong>$email</strong></label>
<label>N&uacute;mero Secreto: <strong>$idnumb</strong></label>
<label>Pergunta Secreta: <strong>$sques</strong></label>
<label>Resposta Secreta: <strong>$sansw</strong></label>
</div>";
}
?>