0

Am actually building a login and register system but having these internal error in the email activation part, when am trying to change the active table to 1, if users email and email_code matches.

the activate.php code :

<?php

} else if (isset($_GET['email'], $_GET['activation']) === true) {

    $email      = trim($_GET['email']);
    $email_code = trim($_GET['activation']);

    if (email_exists($email) == false) {
        $errors[] = 'Ooops, We counldn\'t find that email address';

    } else if (activate($email, $email_code) == false) {
        $errors[] = 'Ooops, We had problem activating your account';

    }

    if (empty($errors) == false){
        echo output_errors($errors) . '<br><br>'; 
    } else {
        header('Location : activate.php?success');
        exit();
    }

} else {

    header('Location: index.php');
    exit();
}

?>

The activate($email, $email_code) function :

function activate($email, $email_code) {
    global $connection;

    $email      = $email;
    $email_code = $email_code;
    $active     = 0;
    $new_update_active = 1;

    $stmt       = $connection -> prepare('SELECT id FROM users WHERE email = ? AND email_code = ? AND active = ?');

    $stmt -> bind_param('ssi', $email, $email_code, $active);
    $stmt -> execute();
    $stmt -> store_result();
    $stmt -> fetch();

    if ($stmt -> num_rows() == 1) {

        $update_active = $connection -> prepare('UPDATE users SET active = ? WHERE email = ?');
        $update_active -> bind_param('is', $new_update_active, $email);
        return true;

    } else {
        return false;
    }

}

The error: The error image!!

The code is seems correct and am only having these intenal serval when it comes to the part that the email and email_code matches and to change the active table to 1 in the database.

David
  • 23
  • 5
  • 1
    Possible duplicate of [PHP's white screen of death](https://stackoverflow.com/questions/1475297/phps-white-screen-of-death) – Dharman May 12 '19 at 10:31

1 Answers1

1

I later spot the error and i just change the

header('Location : activate.php?success');

to

header('Location: activate.php?success');
David
  • 23
  • 5