Jump to content

Recommended Posts

Hey guys, this has been driving me crazy. I have this activation page users go to from a link which is sent to their email to activate their account. However I'm getting this error. I'm using PHP 5.

 

Notice: Query/n

MySQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''5b25e4e069b4a7efe22114c05f058d79') LIMIT 1' at line 1 in /home/.navigator/iisthesloth/rolldc.com/traderp/activate.php on line 23

Your account could not be activated, please check the link.

 

That activation number does match the one in the database too.

 

Can anyone find anything wrong in the activation code?

 

<?
if (isset($_GET['x'])) {
  $x = (int) $_GET['x'];
} else {
  $x = 0;
}
if (isset($_GET['y'])) {
  $y = $_GET['y'];
} else {
  $y = 0;
}


if ( ($x > 0) && (strlen($y) == 32)) {
   require_once ('../../mysql_rolldc_connect.php');
  $query = "UPDATE users SET active=NULL WHERE (user_id=$x AND active'" . escape_data($y) . "') LIMIT 1";
  $result = mysql_query ($query) or trigger_error("Query/n<br />MySQL Error: " . mysql_error());
  
  if (mysql_affected_rows() == 1) {
    echo "<h3>Your acount is now active. You may login.";
  } else {
  echo 'Your account could not be activated, please check the link.';
  }
  
  mysql_close();
  
} else {
$url = 'http://' . $_SERVER['HTTP_HOST']
. dirname($_SERVER['PHP_SELF']);
if ((substr($url, -1) == '/') OR (substr
($url, -1) == '\\') ) {
   $url = substr ($url, 0, -1);
}

$url .= '/index.php';

ob_end_clean();
header("Location: $url");
exit();

}

?>

 

 

Thanks alot!

Link to comment
https://forums.phpfreaks.com/topic/62615-help-with-activation-page/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.