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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:58:34+00:00 2026-06-14T23:58:34+00:00

I wasn’t sure how to search for the issue I’m experiencing. The code works

  • 0

I wasn’t sure how to search for the issue I’m experiencing.

The code works properly to produce a randomly generated, encrypted password, but the password does not work when submitting the HTML form. I verified the password through the SQL query to make sure it was valid and it was.

In response to the user below, here’s the query I used:

SELECT * FROM users WHERE email='test@test.com' AND password=MD5('03884d917f');

03884d917f is the password that was generated. I queried the test@test.com account correctly with it.

To be more concise: the generated password changes properly in MySQL, but when submitted on the front-end I can’t log in using it.

I don’t think any additional code is required, the only bit that would be of use is config.php which only deals in connecting the database and establishing variables for the mail functions.

2 down-votes without actual input on how I could change the post to accomodate people. I tried to narrow down my problem, I’m not sure how else to explain it. Anyone want to respond with something of substance?

PHP:

    <?php
    require_once('config.php');
    mysql_select_db($database,$dbhandle);
    include_once('includes/header.inc.php');
    include_once('includes/navigation.inc.php');

    if (isset($_POST['submit'])) 
    {

    $email = $_POST['remail'];
    $pattern = '/^[^@]+@[^\s\r\n\'";,@%]+$/';
    if (!preg_match($pattern, trim($email))) {
      $error[] = 'Please enter a valid email address';
    } 

    $check = mysql_query("SELECT email FROM users WHERE email = '$email'")or
    die(mysql_error());
    $check2 = mysql_num_rows($check);

    if ($check2 == 0) {
    $error[] = 'Sorry, we cannot find your account details please try another email address.';
    }

    if (!$error) {

    $query = mysql_query("SELECT email FROM users WHERE email = '$email' ")or die         (mysql_error());
    $r = mysql_fetch_object($query);

    $password = substr(uniqid(rand(),1),3,10);
    $pass = md5($password); //encrypted version for database entry

    $to = "$email";
    $subject = "Account Details Recovery";
    $body = "Hi $r->email, \n\n you or someone else have requested your account details. \n\n Here is your account information please keep this as you may need this at a later stage. \n\nYour email is $r->email \n\n your password is $password \n\n Your password has been reset please login and change your password to something more rememberable.\n\n Regards Site Admin";
    $additionalheaders = "From: admin@cenz.cz";
    $additionalheaders .= "Reply-To: admin@cenz.cz";
    mail($to, $subject, $body, $additionalheaders);

    //update database
    $sql = mysql_query("UPDATE users SET password='$pass' WHERE email = '$email'")or die (mysql_error());
    $rsent = true;


    }
    }

    if (!empty($error))
    {
    $i = 0;
    while ($i < count($error)){
    echo "<div class=\"msg-error\">".$error[$i]."</div>";
    $i ++;}
    }


    if ($rsent == true){
echo "<p align='center'>You have been sent an email with your account details to $email</p>\n";
} else {
echo "<h2>Reset Password</h2><p align='center'>Please enter your e-mail address. You will receive a new password via e-mail.</p>\n";
}

    ?>

    <form class="box login" action="" method="post">
    <fieldset class="boxBody">
    <label for="remail">Email Address: </label>
    <input type="text" name="remail" size="50" maxlength="255" tabindex="1" />
    </fieldset>
    <footer>
    <input type="submit" name="submit" value="Reset Password" class="btnLogin" tabindex="2">
    </footer>
    </form>
    <?php include_once('includes/footer.inc.php'); ?>
  • 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-14T23:58:35+00:00Added an answer on June 14, 2026 at 11:58 pm

    md5() generates the hash according to the character encoding.

    If table encoding is utf-8, for example, encode it like this:

    $pass = md5(utf8_encode($password));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Wasn't too sure exactly how to title this question, but here's the issue that
I wasn't quite sure what to search under - but I was looking for
I wasn't sure how to search this up but I am looking for a
Wasn't quite sure how to word this but let's say I've used ssh to
Okay I wasn't really sure how to word this question, but basically what I
I wasn't sure how to word this exactly. But I have a model that
I wasn't sure if when a class is instantiated with code in PHP, if
I wasn't sure what the title should be but its s simple concept but
I wasn't sure how to ask it, but I am trying to teach myself
I wasn't sure if there was any good way of doing this. But I

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.