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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:55:06+00:00 2026-06-12T12:55:06+00:00

I have an existing database with users, each users password is stored as an

  • 0

I have an existing database with users, each users password is stored as an MD5 hash.

Im trying to create a login form using PHP (Which im very new too) only I cant seem to get it to work, I know my username and password is correct yet I still receive the error that its wrong, Have I got to convert my password input to MD5 before checking the username in the table?

I currently have…

$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";

If I echo my password its outputted as text not a hash

$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
  • 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-12T12:55:07+00:00Added an answer on June 12, 2026 at 12:55 pm

    In addition to hashing your password before comparing to what you have on your DB, you really should add a “salt” into that password hashing. This “salt” is nothing more than a random arbitrary string that you concatenate to the passwords, and it will make your hashed password “unique”. I mean, if someone knows what a md5(‘12345’) is a string ‘A’, this salt will make your users’ password ‘12345’ as the string ‘B’ in your DB. Thus outsiders won’t be able to identify them very easily. So I’d suggest that you hash your passwords with a custom function myHashMD5() that calls md5() adding the proper “salt”.
    Besides that, in mysql you should compare strings with the operator LIKE, and not =.
    Also, I use the function http://php.net/manual/en/function.mysql-real-escape-string.php for avoiding SQL injection, and your code is vulnerable to it.

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

Sidebar

Related Questions

I have an existing database with users and administrators in different tables. I am
I have an existing database with tables which each have 4 partitions (there are
I have a database with existing data, where previously I've been using AUTO_INCREMENT on
I have an existing complex website built using ASP.NET MVC, including a database backend,
I have an existing database with an accountnumber . I want to create a
My idea: I have a database of users, each user has an autoincremented id
I have an existing database with about 1.6 million users in it. Currently the
In my database I have over 600 users. The passwords were previously stored as
So I have an existing database with a Users table and an Airports table
I have an existing database(myDatabse) that I created with Microsoft Sql Managenent studio and

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.