Jump to content

Activiation Code Inexplicably Shortens


justlukeyou

Recommended Posts

Hi,

 

When I echo activationcode it displays: 50e1fa5ad38e7

When I echo accountnumber it displays: 50e1fa5ad38e7

In the database is: 50e1fa5ad38e7

 

This is the link that the created and sent via an email: activation.php?activationcode=50e1fa5ad38e7

 

This is the error message. Notice that the first 4 characters (50e1) are removed. This is the error message I receive:

 

"An error occurred 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 'fa5ad38e7' at line 4"

 

Does anyone have any suggestions on how the activation code is shortened.

 

<?php
echo $row['activationcode'];
?>


<?php     if(($activationcode) == ($row['activationcode'])) {
       $errors['activationcode'] = "Congratulations.  You have now successfully registered.";
   } 

?>





<?php
$accounty = ('Y'); 
echo $activationcode;
echo $accounty;

$accountnumber = $activationcode;

echo $accountnumber;

   if($error == "")
   {
       $sql = "
       UPDATE
           users
       SET accountconfirmed = '".$_GET['activationcode']."' 
	WHERE  activationcode=$accountnumber";

       $result = mysql_query($sql) or die("An error occurred ".mysql_error());

   }


			     $result = mysql_query($query); // remove the or die(mysql_error()) 
    if($result){
         $success['register'] = 'Congratulations. Your account has been activated!<br><br>';
	  }



?> 

Link to comment
Share on other sites

try quotes

 

WHERE  activationcode = '$accountnumber'

 

Cheers dude. Its another one of those codes that took 2 minutes to write but I just couldn't finish it off.

 

I am now matching the activation code and inserting Y into a second column. I take it I can now adapt the login page to check if the Y is this column.

 

If someone registers but forgets to click the activation link but tries to register again should I check if the email address already exists but if the Y doesn't exist to resend the activation link?

Edited by justlukeyou
Link to comment
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.