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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:07:02+00:00 2026-06-11T22:07:02+00:00

I built a code for Log In Page. The Code was working perfectly till

  • 0

I built a code for Log In Page. The Code was working perfectly till yesterday. But, today it is not working like i wanted it to work. Its on my localhost at the moment.

if (isset($_POST['userpassword']))
        {
            include('db.php'); //I am using passwordu instead of password.
            $query = "SELECT * FROM users WHERE username = '".$_REQUEST['username']."' AND passwordu = '".md5($_REQUEST['userpassword'])."'";
            $result = mysql_query($query);
            $num_rows = mysql_num_rows($result);
            if ($num_rows == 1)
            {
                echo "Congratulations. You are now Logged in. You will be logged out when the Browser is closed.";
                $_SESSION['logval'] = TRUE;
            }
            else
            { 
                            echo "You Have Entered Wrong Information. <b>Please Try AGAIN."; }
?>

Whenever I enter a wrong password, it shows the correct thing. But, when i enter the right password, then also it shows that the password was not accepted.

This code was working perfectly till yesterday. Today, this problem cropped up.

I Have Figured out the Solution to this problem.

I was using the varchar(20) for the passwordu field. So, it was not working. I set it now to a larger value i.e. 100(for safety). And it works like a charm.

  • 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-11T22:07:03+00:00Added an answer on June 11, 2026 at 10:07 pm

    One glaring issue that I see is that you are checking if $num_rows == 1. While this is fine in most cases, it’s possible that it is masking a potential issue with duplicate accounts. This is to say that if you have more than 1 of the same account, you give the illusion that the credentials are incorrect when in fact they are.

    As a test, try the example below to see if it begins to work:

    if ($num_rows >= 1)
    {
       //Correct info
    }
    else
    {
       //Incorrect info
    }
    

    Though this may fix your problem, you will need to figure out why you would have a duplicate account.

    Edit

    I would consider Mike Brant’s suggestion in the comments below. Truly, there should be a unique constraint to prevent the potential case for duplicates.

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

Sidebar

Related Questions

I am looking for alternatives to the Eclipse built-in Java code formatter. Not stand-alone,
I'm not sure it's even possible, but my command line usecase goes something like
Will Java code built and compiled against a 32-bit JDK into 32-bit byte code
Is there a built in Java code that will parse a given folder and
Much of our C# release code is built with the 'Optimize code' option turned
current code I've built function to do something over collection of jQuery elements: var
In the following code segment when built I keep breaking when adding the OnClickListener
I have some code which is built both on Windows and Linux. Linux at
I've built an iPhone application using the parsing code from the TopSongs sample iPhone
I have built an open-source application from the source code. Unfortunately, the original executable

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.