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

  • Home
  • SEARCH
  • 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 3873794
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:04:40+00:00 2026-05-19T22:04:40+00:00

I have used a tutorial here: http://www.phpeasystep.com/phptu/26.html to create a login form for my

  • 0

I have used a tutorial here: http://www.phpeasystep.com/phptu/26.html to create a login form for my website. I have set the uPassword field in my database to be md5 and all of the passwords in the database are encrypted with md5.

The login works perfectly, however I am slightly confused about creating a registration form.

The form requests for a user to input their desired password. I am slightly confused as to how I will then take the password that the user inputs, converting it to md5 and then inputting the md5 password into the uPassword field in the user table.

Below is the code that I have for the processresgistration.php file:

/* Database connection info*/
mysql_select_db("dbname", $con);

$encryptedpassword = md5($_POST['uPassword']);

md5($uPassword);

$sql="INSERT INTO users (uName, uPassword, uSurname, uFirstName)
VALUES
('$_POST[uName]','$encryptedpassword','$_POST[uSurname]','$_POST[uFirstName]'";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "Account created.  You can now login";

mysql_close($con)
?>

The code above is supposed to:

  • Create a variable named encryptedpassword
  • Use uPassword as encryptedpassword
  • Convert encrypted password to MD5
  • Input the MD5 password into the users table as uPassword

I’m sure that I’ve not used a correct variable somewhere, or I have done a simple error with my syntax; any comments/help is greatly appreciated!

Thanks,
Chris M

  • 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-19T22:04:41+00:00Added an answer on May 19, 2026 at 10:04 pm

    You code require some validation & escaping, more like this :

    <?php
    
    /* Database connection info */
    mysql_select_db("dbname", $con);
    
    if ($_REQUEST['METHOD'] == 'POST') {
        $uName = filter_input(INPUT_POST, 'uName');
        $uPassword = filter_input(INPUT_POST, 'uPassword');
        $uSurname = filter_input(INPUT_POST, 'uSurname');
        $uFirstName = filter_input(INPUT_POST, 'uFirstName');
    
        // do some validation here ...
    
        // if everything OK, then crypte the password
        $hashedPassword = md5($uPassword);
    
        // and store it
    
        $sql = sprintf(
            'INSERT INTO users (uName, hashedPassword, uSurname, uFirstName)
             VALUES (%s, %s, %s, %s);',
                mysql_real_escape_string($uName, $con),
                mysql_real_escape_string($hashedPassword, $con),
                mysql_real_escape_string($uSurname, $con),
                mysql_real_escape_string($uFirstName, $con)
        );
    
        if (!mysql_query($sql,$con)) {
            die('Error: ' . mysql_error());
        }
    
        mysql_close($con);
        echo "Account created.  You can now login";
    }
    
    ?>
    

    Now for login

    <?php
    
    if ($_REQUEST['METHOD'] == 'POST') {
        $uName = filter_input(INPUT_POST, 'uName');
        $uPassword = filter_input(INPUT_POST, 'uPassword');
        $hashedPassword = md5($uPassword);
    
        $sql = sprintf(
            'SELECT * FROM users WHERE uName = "%s" AND hashedPassword = "%s" LIMIT 1',
                mysql_real_escape_string($uName, $con),
                mysql_real_escape_string($hashedPassword, $con),
            );
    
        // etc etc ...
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used this tutorial http://delphi.about.com/od/kbthread/a/thread-gui.htm to create a class that asynchronously downloads a file
I've searched on this, but nothing has what I'm looking for. http://www.mail-archive.com/pygtk@daa.com.au/msg10529.html -- Nobody
I have used Photoshop CS2's Save for Web feature to create a table of
I have used this in my HTML: <q> Hai How r u </q> Which
I have used extension methods to extend html helpers to make an RSS repeater:
I have a login.jsp page which contains a login form. Once logged in the
I am new to JavaScript and jQuery, but have used HTML and CSS before.
I have used traditional version control systems to maintain source code repositories on past
I have used IPC in Win32 code a while ago - critical sections, events,
I have used the XML Parser before, and even though it worked OK, 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.