如何解决我不知道为什么,但它无缘无故地显示错误
<?PHP
include_once "config.PHP";
$fname = MysqLi_real_escape_string($conn,$_POST['fname']);
$lname = MysqLi_real_escape_string($conn,$_POST['lname']);
$email = MysqLi_real_escape_string($conn,$_POST['email']);
$password = MysqLi_real_escape_string($conn,$_POST['password']);
if(!empty($fname) && !empty($lname) && !empty($email) && !empty($password)){
// check user email valid or no
if(filter_var($email,FILTER_VALIDATE_EMAIL));{
//check email already exist or no
$sql = MysqLi_query($conn,"SELECT email FROM users WHERE email = '{$email}'");
if(MysqLi_num_rows($sql) > 0){
echo "$email - This email already exists!";
}else {
// check user upload file
if(isset($_FILES['image'])){
$img_name = $_FILES['image']['name'];
$tmp_name = $_FILES['image']['tmp_name'];
//explode img to get img extension
$img_explode = explode('.',$img_name);
$img_ext = end($img_explode);
$extensions = ['png','jpg','jpeg','gif'];
if(in_array($img_ext,$extensions) === true){
$time = time(); // this will put a time in front of the image
// so that every image will have
// a unique name
// move user uploaded img to folder
$new_img_name = $time.$img_name;
if(move_uploaded_file($tmp_name,"images/".$new_img_name)){
$status = "Active Now";
$random_id = rand(time(),10000000);
// insert user data to table
sql2 = MysqLi_query($conn,"INSERT INTO users (unique_id,fname,lname,email,password,img,status);
VALUES ({$random_id},'{$fname}','{$lname}','{$email}','{$password}','{$new_img_name}','{$status}')");
if($sql2){
$sql3 = MysqLi_query($conn,"SELECT * FROM users WHERE email = '{$email}'");
if(MysqLi_num_rows($sql3) > 0){
$row = MysqLi_fetch_assoc($sql3);
$_SESSION['unique_id'] = $row['unique_id'];
echo "Success!";
}
}else{
echo "Something went wrong!";
}
}
}else{
echo "Please select an image file - jpg,jpeg,png or gif!"
}
}else{
echo "Please select an image file!"
}
}
}else{
echo "$email - This is not a valid email!";
}
}else {
echo "All input fields are required!";
}
?>
我正在使用此视频作为参考制作实时聊天应用程序 - https://www.youtube.com/watch?v=VnvzxGWiK54 在 signup.PHP
部分我总是遇到错误怎么办?在我的第一次尝试中,我遇到了愚蠢的错误。这次我的错误较少,但我总是得到这个。请指导
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。