1

Okay so im creating a membership system, It allows to post the user to the database, Sends email over and when it comes to activation i get an error your account could not be activated? Just curious if its something in the code really...

    <?php
require('includes/config.php');

//collect values from the url
$memberID = trim($_GET['x']);
$active = trim($_GET['y']);

//if id is number and the active token is not empty carry on
if(is_numeric($memberID) && !empty($active)){

    //update users record set the active column to Yes where the memberID and active value match the ones provided in the array
    $stmt = $db->prepare("UPDATE members SET active='Yes' WHERE memberID = :memberID AND active = :active");
    $stmt->execute(array(
        ':memberID' => $memberID,
        ':active' => $active
    ));

    //if the row was updated redirect the user
    if($stmt->rowCount() == 1){

        //redirect to login page
        header('Location: login.php?action=active');
        exit;

    } else {
        echo "Your account could not be activated."; 
    }

}
?>
JasonReynolds
  • 17
  • 1
  • 7
  • `var_dump($stmt->rowCount())`? – u_mulder Nov 03 '16 at 15:34
  • Interesting, I've changed the code it seems to verify the user but pushes a 404 page upon clicking the activation email Edit - Apologies it gives HTTP ERROR 500 – JasonReynolds Nov 03 '16 at 15:39
  • HTTP Error 500 when doing PHP means you need to most likely enable errors. http://stackoverflow.com/questions/845021/how-to-get-useful-error-messages-in-php – Mark Phillips Nov 03 '16 at 15:42

0 Answers0