Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7057391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:58:49+00:00 2026-05-28T03:58:49+00:00

For my email confirmation script, I generate a token by running the user’s email

  • 0

For my email confirmation script, I generate a token by running the user’s email address through my existing one-way encryption function and then grabbing 20 characters from the middle of it. I get the token back from the user as a $_GET variable or a $_POST variable. I ran into a “bug” where When an email address is entered that has a plus sign (+) in it, and then that token is retrieved back from the user as a $_GET variable, the plus sign gets converted to a space and the hash changes, therefor the token doesn’t match anymore.

So, I’m wondering what the best way to work around this would be? Escape the plus sign? Convert the plus sign? URL encode it? What other characters will this happen to when I use $_GET?

Here is the pertinent code, in case it’s helpful:

<?php
if (isset ($_GET['email'], $_GET['token'])) {
    $email = strtolower (mysql_real_escape_string($_GET['email']));
    $token = mysql_real_escape_string($_GET['token']);
    $correctToken = substr (doEncrypt ($email), -26, -6);
}elseif (isset ($_POST['submit'])) {
    $email = strtolower (mysql_real_escape_string($_POST['email']));
    $token = mysql_real_escape_string($_POST['token']);
    $correctToken = substr (doEncrypt ($email), -26, -6);
}

if (isset ($email, $token, $correctToken)){    
    if ($token == $correctToken) {
        // Confirm user's email!
    }
}
?>

Thank you very much!
Billy

EDIT: OK, so the biggest question at this point is, is the plus sign the only character that’s converted to a space when retrieved through $_GET? If it is, then it seems I could just add this within the $_GET section: $email = str_replace(' ', '+', $email); There is no other reason for a space to be within an email address, right?

Thanks again,
Billy

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:58:50+00:00Added an answer on May 28, 2026 at 3:58 am

    If it were me, I would do a str_replace() to convert plus signs to spaces before hashing. Put the str_replace() within the hashing function; that way the user’s email address is only modified within the function’s scope, and remains unaltered for the rest of the script.

    function hash_email($email)
    {
      $email = str_replace('+', ' ', $email);
    
      ...hashing stuff happens here...
    
      return $token;
    }
    
    $token = hash_email($_GET['email']);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After user subscribe email to my website. My website will generate an email confirmation
I'm developing an ASP.NET MVC application that will send the user a confirmation email.
I've got a problem with a PHP script which sends an email confirmation. When
We have an email confirmation page for registration which can be hit with a
I've got a web site sending someone a confirmation email. Now in the email
Is there any framework/library for using ASP.NET Membership Provider with confirmation email, something ready
I use an email registration and confirmation in my project (yes, I know about
<?php $sendto = account@gmail.com; $subject = email confirmation; // Subject $message = the body
I have a fish shell script whose default behavior is to send an email
I need to send email confirmation, so now I have to localize sent message.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.