Jump to content
Larry Ullman's Book Forums

Chapter 18 Account Activation Email


Recommended Posts

I want to start off by saying I've learned more from your series of books than any other source on the market to date. That being said I am stumped with the user activation email using script 18.7. The user is registered just fine and the email it sends to the proper email, but when I click the link all I get is Object not found: error. I have no clue what to do from here I've gone over the code countless times and I have absolutely no answer.  this is my activate.php:

 

<?php 
require('includes/config.inc.php');
$page_title = 'Activate Account';
include('includes/header.php');
?>
 
 
<?php 
if(isset($_GET['x'], $_GET['y']) && filter_var($_GET['x'], FILTER_VALIDATE_EMAIL) && (strlen($_GET['y']) == 32)){
 
 
require(MYSQL);
 
$q = "update users set active=null where (email='".mysqli_real_escape_string($dbc, $_GET['x']). "' and active='" . mysqli_real_escape_string($dbc, $_GET['y']) . "') limit 1";
 
$r = mysqli_query($dbc, $q) or trigger_error("Query $q\n<br>MySQL Error: " . mysqli_error($dbc));
 
 
if(mysqli_affected_rows($dbc) == 1){
 
echo "<h3>Your account is now active. You may now log in.</h3>";
 
}else{
 
echo '<p class="text-danger">You acount could not be activated. Please re-check the link or contact the system administrator.</p>';
}
 
mysqli_close($dbc);
 
}else{
 
$url = BASE_URL .'index.php';
ob_end_clean();
header("Location: $url");
exit();
 
}
 
 
?>
 
 
<?php include('includes/footer.php')?>
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...

I am also having a similar type of problem but not in all instances. I am testing on a live site. MOST of the time the email will get the activation link but when I click the link I get the message saying that the account could not be activated. BUT the information is in the database and the column says, "NULL".

Link to comment
Share on other sites

 Share

×
×
  • Create New...