我如何使另一个验证,为禁用用户注册相同的帐户?(PHP本地)



这是我的寄存器控制器的代码。我正在添加另一个WHERE验证,但这只是我得到的错误。如果有人能帮助我,我将不胜荣幸。

function doInsert(){
global $mydb;
if(isset($_POST['submit'])){

$customer = New Customer(); 
$customer->FNAME            = $_POST['FNAME'];
$customer->LNAME            = $_POST['LNAME'];      
$customer->CITYADD          = $_POST['CITYADD']; 
$customer->GENDER           = $_POST['GENDER'];
$customer->PHONE            = $_POST['PHONE']; 
$customer->CUSUNAME         = $_POST['CUSUNAME'];
$customer->CUSPASS          = sha1($_POST['CUSPASS']);  
$customer->DATEJOIN         = date('Y-m-d H-i-s');
$customer->TERMS            = 1;
$customer->create();

$email = trim($_POST['CUSUNAME']);
$h_upass = sha1(trim($_POST['CUSPASS']));

//it creates a new objects of member
$user = new Customer();
//make use of the static function, and we passed to parameters
$res = $user->cusAuthentication($email, $h_upass);

if(!isset($_POST['proid']) || (isset($_POST['proid']) && empty($_POST['proid']))){
echo "<script> alert('You are now successfully registered. It will redirect to Homepage. Enjoy our Coffee!'); </script>";
redirect(web_root."index.php?q=home");
}else{
$proid = $_GET['proid'];
$id = mysqli_insert_id(); 
$query ="INSERT INTO `tblwishlist` (`PROID`, `CUSID`, `WISHDATE`, `WISHSTATS`)  VALUES ('{$proid}','{$id}','".DATE('Y-m-d')."',0)";
$mydb->setQuery($query);
$mydb->executeQuery();
echo "<script> alert('You are now successfully registered. It will redirect to your profile. Enjoy our Coffee!'); </script>";
redirect(web_root."index.php?q=profile");
}


}
}

我需要在哪里添加另一个条件?

首先,您的数据应该在注册过程中进行检查。必须将新记录中输入的数据与现有数据进行比较。例如,应该从数据库中检查电子邮件地址或电话号码或用户名。如果有人拥有这些信息,他/她应该使用for循环发出错误消息,而不应该执行该操作。你可以这样做一个应用程序。

最新更新