This question already has an answer here:
I'm working on a login system and I keep getting this error
"The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error. If you think this is a server error, please contact the webmaster."
when I execute the code below:
<?php
if(isset($POST['submit'])){
include_once 'dbh.php';
$first = mysqli_real_escape_string($conn, $POST)['first'];
$last = mysqli_real_escape_string($conn, $POST)['last'];
$email = mysqli_real_escape_string($conn, $POST)['email'];
$uid = mysqli_real_escape_string($conn, $POST)['uid'];
$pwd = mysqli_real_escape_string($conn, $POST)['pwd'];
//Error handlers
//Check for empty fields
if(empty($first)||(empty($last)||(empty($email)||(empty($uid)||(empty($pwd)){
header("signup.php?signup=empty");
exit();
}else {
//Check if input characters are valid
if(!preg_match("/^[a-zA-Z]*$/", $first)||(!preg_match("/^[a-zA-Z]*$/", $last)){
header("Location: ../signup.php?signup=invalid");
}exit();
}else{
//Check if email is valid
if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
header("Location: ../signup.php?signup=email");
exit();
else{
$sql = "SELECT * FROM users where user_uid='$uid'";
$result = mysqli_query($conn, $sql);
$resultCheck = mysqli_num_rows($result);
if ($resultCheck > 0) {
header("Location: ../signup.php?signup=usertaken");
exit();
else {
//hashing the password
$hashedPwd = password_hash($pwd, PASSWORD_DEFAULT);
//Insert the user into the database
$sql = "INSERT INTO users (user_first, user_last, user_email, user_uid, user_pwd)
VALUES('$first', '$last','$email','$uid','$hashedPwd');";
mysqli_query($conn, $sql);
header("Location: ../signup.php?signup=success");
exit();
}
}
}
}
} else {
header("Location: ../signup.php");
exit();
}
}
the below error message comes up also when I execute just the php script
Parse error: syntax error, unexpected ';' in C:\xampp\htdocs\signup.php on line 17
</div>