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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:59:52+00:00 2026-06-18T16:59:52+00:00

OK I have this code to send an email account verification link $verifyemail =

  • 0

OK I have this code to send an email account verification link

      $verifyemail = $clean['email'];
      $to = $verifyemail;
      $subject = 'Virtual Pierz Close | Verify Your Account';
      $message = "Thanks for registering with VPC, on clicking the verification link       below, your account will be confirmed, you can then go ahead buy Virtual Properties,   donating £5 each time to the worthwhile charity.

      http://www.cambrianvacation.co.uk/vpc/registered.php?
      email='$verifyemail'&hash='$hash1' ";

    $headers = 'From:noreply@cambrianvacation.co.uk'; // Set from headers  
    mail($to, $subject, $message, $headers);

And then I have this code, that is trying to activate the account by setting active = 1 in the database, which will then be part of the access control logic at login, without active = 1, there is no login, amongst other protection

  if(isset($_GET['email']) && !empty($_GET['email']) AND isset($_GET['hash']) &&    !empty($_GET['hash'])){  
  // Verify data  


  $accountemail = $_GET['email'];
  $accounthash = $_GET['hash'];
   }
    $accountActive = 1;
    $notactive = 0;
    $username = '';
    $password2 = '';
    $username = 'xxxxxxx';
    $password2 = 'xxxxxxx';

    $db1 = new PDO('mysql:host=localhost;dbname=xxxxxxxxxxxxx', $username,   $password2, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));

   $db1->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
   $db1->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
   try{
   $search = $db1->prepare("SELECT email, hash, active FROM users WHERE email = :email     AND hash= :hash AND active = :active");
   $search->bindParam(':email', $accountemail);
   $search->bindParam(':hash', $accounthash);
   $search->bindParam(':active', $notactive);
   $search->execute();
   $colcount = $search->columnCount();

   }catch(PDOException $e) {
  $e->getMessage();
  } 
       print_r($colcount);
       if($colcount === 3){


      //try{
          $update = $db1->prepare("UPDATE users SET active=:active WHERE email=:email AND hash=:hash AND active = :active");
          $update->bindParam(':active', $accountActive);
          $update->bindParam(':email', $accountemail);
          $update->bindParam(':hash', $accounthash);
          $update->bindParam(':active', $notactive);
          $update->execute();

      //}catch(PDOException $e) {
      // $e->getMessage();
      //} 

However I cannot get the active column to update.

I’ve also thought about using the GET[’email’] could be subject to semantic url attacks, however the logic won’t activate the account without the matching hash, which is randomly generated with crypt()………
If anyone can see any security holes in the code, please tell me………

  • 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-06-18T16:59:58+00:00Added an answer on June 18, 2026 at 4:59 pm

    There really is no reason to make two separate queries here. Why not just have one query to update the record based on hash and email and active = 0? If the count of modified rows = 1, then you had a success, else you had a failure. You probably don’t care why it failed, as it would be bad from a security perspective to indicate back to the user why update failed (i.e. bad email, bad hash, already active user, etc.).

    That being said, your problem actually lies in the fact that your update uses ? style bindings, while you are using bindParam() with :param style bindings. This won’t work since those values are not present in the prepared statement.

    So just use this one single query:

    UPDATE users SET active = 1 WHERE email = :email AND hash = :hash AND active = 0
    

    Obviously if you think you are going to change the value for active/non-active then feel free to use a parameter for those as well, but my guess is you would want to treat that as a boolean-style tinyint field with only allowable values of 0 and 1, so there is really no point in having the parametrization there.

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

Sidebar

Related Questions

I have to send email to any email account. I have written this code:
I have the following code to send users a verification email, which contains some
I have this code written in .NET 4.0 using VS2010 Ultimate Beta 2: smtpClient.Send(mailMsg);
I have this code: ie1.link(:text, /Exception:/) It is producing an error message which I
So, I have this code class InvoiceNotifier < ActionMailer::Base include Sidekiq::Worker default from: 'from@email.com',
I am trying to send email with gmail account in Zend framework. This is
I have created a form to send email to an email account and used
I have this code <div id=main style=background:#aaaaaa;float:left;height:160px;margin:5px;position:relative;display:block;width:630px;> <div id=1 class=item style=background:#ffaacc;float:left;width:200px;height:150px;margin:5px;position:absolute;left:0px;top:0px;> </div> <div id=2
I have this code : void Main() { System.Timers.Timer t = new System.Timers.Timer (1000);
I have this code for changing the image of a button: - (void)mouseEntered:(NSEvent *)event

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.