My title will not be redirected. After executing the code, it is simply empty and does not redirect. There are no spaces in the file. The code works just fine, except for redirection.
This code is called by the submit form.
if(!empty($_POST['addSubscriber'])){
$name = $_POST['name'];
$email = $_POST['email'];
if(!empty($name) && !empty($email) && eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email) != FALSE){
$conn = connect();
$sql = "SELECT id FROM subscribers WHERE email=?";
if($stmt = $conn->prepare($sql)){
$stmt->bind_param("s", $email);
$stmt->execute();
if($stmt->fetch()){
header("Location: http://bcp350.org.uk/index.php?message=1");
} else {
$password = md5(uniqid());
$sql2 = "INSERT INTO subscribers(name, email, password) VALUES(?, ?, '$password')";
if($stmt2 = $conn->prepare($sql2)){
$stmt2->bind_param("ss", $name, $email);
$stmt2->execute();
if($stmt2->affected_rows == 1)
header("Location: http://bcp350.org.uk/index.php?message=1");
}
}
}
} else {
header("Location: urlnotallowedbecauseofstackoverflowlimit");
}
}
source
share