这是怎么了? 致命错误语法错误,第23行出现意外的'is'(T_STRING)
这是第23行,但我在这里没看到错吗?也许我一直盯着屏幕看很久,但对我来说看起来不错吗?
else{
(line 23) $sql = $con->Something is wrong("SELECT id FROM users WHERE email='$email'");
if ($sql->num_rows >0){
$msg = "Email currently exists";
}
感谢大家的帮助。
<-php新手:@
其余代码::::::
<?php
$msg = "TIME TO REGISTER";
use PHPmailer\directory;
if (isset($_POST['submit'])){
$con = new mysqli
(
'filled', //host server
'filled', //username
'filled', //pass
'filled' //database name
);
$name = $con->real_escape_string($_POST['name']);
$email = $con->real_escape_string($_POST['email']);
$password = $con->real_escape_string($_POST['password']);
$cPassword = $con->real_escape_string($_POST['cPassword']);
if ($name == "" || $email =="" || $password != $cPassword)
$msg = " Please check your inputs!";
else{
$sql = $con->query("SELECT id FROM users WHERE email='$email'");
if ($sql->num_rows >0){
$msg = "Email currently exists";
}
else {
$token = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM!%^&*()\/?";
$token = str_shuffle($token);
// token - start - length
$token = substr($token, 0, 15);
//BCRYPT = 60CHAR // SERVER NEEDS TO BE PHP 5.6 ++++ ALGORYTHEM (algo)
$hashedPassword = password_hash($password, PASSWORD_BCRYPT);
$con ->query( "INSERT INTO users (name, email, password, isEmailConfirmed, token)
VALUES ('$name', '$email', '$hashedPassword', '0', '$token');
");
include_once "PHPmailer/PHPMailer.php";
$mail = new PHPmailer();
// set email address to send from
$mail ->setFrom ('GDT2@hotmail.co.uk');
$mail ->addAddress($email, $name);
$mail ->Subject = "Please Verify Email";
$mail ->isHTML (true);
$mail ->body = "
Please click on the link below to complete your registration <br>
<a href='http://baa.rhdigital.org/PHPEmailConfirmation/confirm.php?email=$email&token=$token'> Click Here</a>
";
if ($mail -> send())
$msg = "You have been registered. Please verify your email";
else
$msg = "Opps! Something went wrong. Please try again";
}
}
}
?>