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 6170123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:58:32+00:00 2026-05-23T22:58:32+00:00

So I’m working on a website where we want users to sign up for

  • 0

So I’m working on a website where we want users to sign up for a private beta. When the user clicks submit on the sign up page, a php code puts their name, email, and a randomly generated 32-character hash into a table in my database. It then sends the user an email which contains a verification link which includes the user’s email address and the hash for ultimate security. It looks like this:

domain.com/b/verify.php?email=sample@sample.com&hash=1a2a3a4a5a6a7a8a9a8a7a6a5a4a3a2a

When they click this link,it sends them to the verify.php page, which takes the email and hash from the url and checks for a match in the previously mentioned database. If there’s a match, it generates another message. If there is no match, it says “invalid url or you haven’t signed up.” Also, the database table contains a column called “active,” which is set to 0 by default but changed to 1 when the link is clicked. The verify.php code checks to make sure active is set to 0 before displaying the match message so that the link can only be used once.

The message displayed when it matches gives them a link to my phpbb3 registration page, which has been modified. The link looks like this:

domain.com/phpbb/ucp.php?mode=register&email=sample@sample.com&hash=1a2a3a4a5a6a7a8a9a8a7a6a5a4a3a2a

I’ve modified my ucp.php file in my forum’s root directory to look like this:

case 'register':
        // Database info (which I stupidly forgot not to hide prior to this...

        if(isset($_GET['email']) && !empty($_GET['email']) AND isset($_GET['hash']) && !empty($_GET['hash'])){
            // Verify data
            $email = mysql_escape_string($_GET['email']); // Set email variable
            $hash = mysql_escape_string($_GET['hash']); // Set hash variable

            $search = mysql_query("SELECT email, hash FROM users WHERE email='".$email."' AND hash='".$hash."' AND active='1'") or die(mysql_error()); 
            $match  = mysql_num_rows($search);

            if($match > 0){
                // We have a match, activate the account
                mysql_select_db("db2") or die(mysql_error());
                if ($user->data['is_registered'] || isset($_REQUEST['not_agreed']))
                {
                redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
                }

                $module->load('ucp', 'register');
                $module->display($user->lang['REGISTER']);

            }else{
                // No match -> invalid url or account has already been activated.
                mysql_select_db("db2") or die(mysql_error());
                if ($user->data['is_registered'] || isset($_REQUEST['not_agreed']))
                {
                redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
                } else {
                redirectpage();
                }
            }

        }else{
            // No match -> invalid url or account has already been activated.
                redirectpage();
        }
break;

This same code used on the verify.php page, except I changed it so that active does not have to be set to 0 to work.

This whole thing works for the most part: the page redirects properly if no email or hash is given, or if it is incorrect. The only problem is, when a user clicks the “I Agree” button on the registration agreement page, the redirect comes into play for some reason. It doesn’t take them to the next page where the registration form exists.

This also happened when I tried to skip the registration agreement page. It successfully skipped it, but after I filled the registration form and clicked “Submit” it triggered my redirect function again.

Anyone know why the redirecting happens anytime a submit button is pressed?

  • 1 1 Answer
  • 2 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-23T22:58:33+00:00Added an answer on May 23, 2026 at 10:58 pm

    I wold imagine the page is being redirected because any time you click on a submit button, it is sending you to the same page, and mode is set to ‘register’, while it doesn’t tack on the email or hash from the form. So, just set up an exception for the redirect for whatever values are passed when you click submit to go to the final page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like to count the length of a string with PHP. The string
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I want use html5's new tag to play a wav file (currently only supported

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.