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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:54:20+00:00 2026-05-29T05:54:20+00:00

i have a registration form to register users and the password is crypted as

  • 0

i have a registration form to register users and the password is crypted as

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

I then store this straight into the database without doing anything else;

However, in the login form when I try to compare the submitted password the encrypted password stored in the database as follows,

$error = array();
$password="";
$name="";
if (empty($_POST['name'])) 
{
    //if the email supplied is empty
    $error[] = 'You forgot to enter your username';
}
else
{
    $name=$_POST['name'];
}

if (empty($_POST['password'])) 
{
    $error[] = 'Please Enter Your Password ';
}
else 
{
    $password =crypt($_POST['password']);
}

if (empty($error))
{

   $query="SELECT * FROM mytable WHERE (name='$name' AND pass='$password') AND Activation IS NULL";
   $result=mysql_query($query);
   if(!$result){}
   else
   {
      $numRow=mysql_num_rows($result);
      if ($numRow != 0)
      {

      }
      else
      {
          echo "Incorrect password or unactivated account";
      }
   }
}

I have got the error message.

  • 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-29T05:54:22+00:00Added an answer on May 29, 2026 at 5:54 am

    Show the example of the encrypted password. The problem might arise from If no salt is provided, PHP will auto-generate either a standard two character (DES) salt, or a twelve character (MD5), depending on the availability of MD5 crypt().

    You have to provide the ‘salt’ in order to encrypt plain password and to get the same string as you had once before, which you stored in the DB.

    If your password is encrypted by DES the ‘salt’ is the first two letters of your encrypted password. If it is encrypted by MD5 (first 3 symbols of the encrypted password will be $1$) than the ‘salt’ is everything by the last $ symbol.

    Use http://www.php.net/md5 for direct hashing of the password by MD5 algorithm. Result will not have $1$ at the beginning of the string and will not depend on any ‘salt’. But typical suggestion is to add something to the plain password (append/prepend some fixed string) or invert it (change the order of the letters in the plain password). MD5 hashes for the standard non-modified words used as passwords can be found in so called rainbow tables

    Examples generated by function crypt..

    Standard DES: rl.3StKT.4T8M <- ‘salt’ is rl

    MD5: $1$rasmusle$rISCgZzpwk3UhDidwXvin0 <- ‘salt’ is $1$rasmusle$

    Example of the code:

    echo crypt('password');
    // outputs for every run are
    // $1$7M..C...$jQqGlQDmVfEJxd4iCJV.E/
    // $1$jc5.wU..$8WgdKMca.kq82JrdXGoSF.
    // and so on
    // but !
    echo crypt('password', '$1$7M..C...$');
    // outputs
    // $1$7M..C...$jQqGlQDmVfEJxd4iCJV.E/
    // and 
    echo crypt('password', '$1$jc5.wU..$');
    // outputs
    // $1$jc5.wU..$8WgdKMca.kq82JrdXGoSF.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have registration form where users can register their accounts with subdomain i.e. .mysite.com
In my web application i have registration form, when user register i want to
in my project i have one registration form which is developed in C#.net.to this
We have a simple registration form for our website users where we only require
Let's say I have an user registration form. In this form, I have the
The website has a normal registration form which allows users to register and the
I have users registration procedure on my app. But my users have to register
I have a registration form which displays a users Name (textbox), Email (textbox) and
I have a registration form with common registration fields and two multiple selection Lists
I have a registration form leveraging xVal to handle all validation on the form.

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.