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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:04:48+00:00 2026-06-08T08:04:48+00:00

This is for a login system. When I want the user to login I

  • 0

This is for a login system. When I want the user to login I want it to take the given password and compare it to the column “Password” of the row that is given…In this case $usernameinput but the method I am using is not working. Any suggestions?

<?php

$usernameinput = $_POST["uname"];
$passwordinput = $_POST["pass"];

if (empty($usernameinput))
{
echo "";
}

else
{

$con = mysql_connect("localhost","STUFFFFF","STUFFFFFF");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

HERE IS WHERE IT SELECTS

mysql_select_db("STUFFFFF", $con);

$login = mysql_query("SELECT * FROM Users
WHERE Username='$usernameinput'");


while($row = mysql_fetch_array($result))
  {
    $matchpassword = $row['Password'];
  }
}

if (empty($passwordinput))
{
echo "";
}
else
{

if ("$passwordinput"=="$matchpassword")
{
$sqlusername = $usernameinput;
echo "You were logged in successfully, now you can visit the site as $sqlusername. <br />"; 
}
else
{
echo "You have entered an incorrect password.";
}

}
?>

<form action="login.php" method="post">
Username: <input type="text" name="uname" /> <br />
Password: <input type="password" name="pass" /> <br />
<input value="Login" type="submit" />
</form>
  • 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-08T08:04:49+00:00Added an answer on June 8, 2026 at 8:04 am
    $sql = mysql_query('SELECT password FROM users WHERE username="'.mysql_real_escape_string($_POST['username']).'"';
    $user = mysql_fetch_assoc($sql);
    if ($user['password'] == sha1($_POST['password'])) {
        //Logged in
    } else {
        //Wrong password
    }
    

    That way you prevent MySQL injections and the passwords of your users are safe.

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

Sidebar

Related Questions

I've build a simple SpringMVC login system that works fine, but I want to
I have a facebook login system that seems to work fine, but I want
I want to make a login system, with the 'forgot password?' , this is
I'm given a task to write a user authentication and login system in java.
I am making login system , I succeeded all the way but ,i want
I have a login system requiring a username and a password. I want to
i have a user login system which works off of sessions such that when
This aspect of my login system works just fine if I have the return
For a login system in php would this be a suitable outline of how
I'm thinking about building a login system for Ruby on Rails, much like this

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.