PHP Account Activation Logic
<p>I am writing PHP in order to activate an account of a user......
Code is filtered, sanitized, passwords encrypted, and I've used PDO to store the data....
I have a header redirect once the data is stored, to lead the user to click on an activation link on their registered email address.</p>

<p>Everything was working fine, I was using a PDO RowCount() to tell the redirect to go ahead and run, but I added a hash column in the MySql Database to aid the activation link to then be queried to actually activate the account, so the RowCount was already populated and the redirect would just run bypassing the form itself. So I've written some code to enable the redirect to work, which it does, however it is still bypassing the form itself.....
I need this code to run the header redirect, to say that the database has been populated by the form, but I need it to stop bypassing the form itself and just going ahead and redirecting.</p>

<p>Code below....More code available on request.....</p>

<pre><code>   try{
   $checkEmail = $db-&gt;prepare('SELECT email FROM users WHERE email = :email');
   $checkEmail-&gt;bindParam(':email', $clean['email']);
   $checkEmail-&gt;execute();
   $result = $checkEmail-&gt;fetch();
   print_r($result);
    } catch(PDOException $e) {
   $e-&gt;getMessage();
    }
   if ($result[0] === $clean['email']){

           header('Location:verifyemail.php');



     }
</code></pre>

<p>The $clean['email'] is the current email address, in the programming logic. But it seems the PHP already has some value for this, hence the form is being bypassed.</p>
