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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:38:59+00:00 2026-05-25T03:38:59+00:00

When a user registers I clean the password with mysql_real_escape_string as follow $password =

  • 0

When a user registers I clean the password with mysql_real_escape_string as follow

$password = clean($_POST['password']); 

Before adding it into database I use :

$hashedpassword = sha1('abcdef'.$password);

and save it into mySQL.

My question is should I clean it or am I protected that the password is hashed before adding it into the DB ?

  • 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-25T03:39:00+00:00Added an answer on May 25, 2026 at 3:39 am

    Well, there is one major misunderstanding.

    mysql_real_escape_string() does not clean anything. It has nothing to do with security at all.

    This function is used just to escape delimiters and nothing more. It can help you to put string data into SQL query – that’s all.

    So, every string you’re going to put into query (by putting it in quotes), you have to prepare it with this function. In all other cases it would be useless or even harmful.

    Thus,
    out of this misunderstanding, you’re doing 2 major mistakes here:

    • you’re using this function not with data that’s actually going to the query
    • you can spoil your password by adding some symbols to it, so, it become unusable

    Also, as a side note, please bear in mind that this function should be always used in conjunction with mysql_set_charset, or otherwise a "_real_" part of this function become useless

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

Sidebar

Related Questions

Say a user registers for your site, you hash the password they have chosen
Background: I have a winForm app that registers a user in the database based
When a user registers with my site I want to offer them a login
This is the standard scenario: User registers on the site User receives an account
I want to create sub-domains using PHP on the fly. Suppose a user registers
I have a .NET user control registered as COM. I use regasm to register
i've implemented this custom PHP Session Class for storing sessions into a MySQL database:
I'm doing a simple user with profile application. User registers and are automatically logged
The title should be pretty clear, but consider this scenario: User bobbyflay registers an
It's clear for me how to read a user/pass from database using encrypted passwords

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.