我创建了一个注册表单,我想防止同一用户一次又一次地注册系统。这是我的代码,请帮我解决这个问题。在初始注册时,只考虑用户名密码和电子邮件,在登录系统后,用户可以更新他们的信息,如姓名、性别、教育等:....
<?php
session_start();
include_once 'newFunctions.php';
include_once 'dbConnect.php';
// database connection
dbConnect();
$username = $_POST['username'];
$pw=md5($_POST['password']);
$email=$_POST['email'];
//check the term
if(isset($_POST['term'])){
$is_checked = 1;
}else{
$is_checked = 0;
}
$insert_data="INSERT INTO tutor(userName, password, email, avatar, term)
VALUES
( '{$username}','{$pw}','{$email}','default_image.jpg','{$is_checked}')";
$check=mysql_query($insert_data);
if($check=='true')
{
// session variables
$_SESSION['login'] = "1";
$_SESSION['username']=$username;
$_SESSION['password']=$pw;
showAlert("You Have Successfully Registered ", "../tutor_panel_ui.php");
}
else{
echo "Invalid Login";
$_SESSION['login'] = '';
}
?>