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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:06:14+00:00 2026-05-13T00:06:14+00:00

Ok so here is my issue, Some users cannot login to their accounts. They

  • 0

Ok so here is my issue, Some users cannot login to their accounts. They enter in their password and username properly but it just doesn’t seem to work.

and secondly I noticed that a few of the users can log into any account they want with their own password and not the password of the original account.

using MYSQL, and PHP5.

/*Login script*/

if (isset($_POST['Submit'])) {

    $loginUserName = ($_POST['loginUserName']);
    $loginUserName = stripslashes($loginUserName);
    $loginUserName = strip_tags($loginUserName);
    $loginPassWord = ($_POST['loginPassWord']);
    $loginPassWord = stripslashes($loginPassWord);
    $loginPassWord = strip_tags($loginPassWord);
    $loginPassWord = md5($loginPassWord);

    $loginSubmitQuery = "SELECT username,password FROM users WHERE username = '". mysql_real_escape_string($loginUserName ."' and password = '". mysql_real_escape_string($loginPassWord) ."'"; 
    $loginResultQuery = mysql_query($loginSubmitQuery) or die ("Could not find loginUserName and/or loginPassWord");
    $loginResultQuery2 = mysql_fetch_array($loginResultQuery);

     if ($loginResultQuery2) {
        $sql = "SELECT * FROM users WHERE username='".$loginUserName."'";   
        $result = mysql_query($sql)or die('_'.mysql_error());
        while ($row = mysql_fetch_assoc($result)) {
            $_SESSION['player']['id']               = $row['id'];
            $_SESSION['player']['username']         = $row['username'];
            $_SESSION['player']['gamestatus']       = $row['gamestatus'];
            $_SESSION['player']['healthpoints']     = $row['healthpoints'];
            $_SESSION['player']['maxhealthpoints']  = $row['maxhealthpoints'];
            $_SESSION['player']['manapoints']       = $row['manapoints'];
            $_SESSION['player']['maxmanapoints']    = $row['maxmanapoints'];
            $_SESSION['player']['level']            = $row['characterlevel'];
            $_SESSION['player']['strength']         = $row['strength'];
            $_SESSION['player']['defence']          = $row['defence'];
            $_SESSION['player']['monsterid']        = $row['monsterid'];
            $_SESSION['player']['decivers']         = $row['decivers'];
            $_SESSION['player']['experience']       = $row['experience'];
            $_SESSION['player']['nextlevel']        = $row['nextlevel'];
            $_SESSION['player']['inbattle']         = $row['inbattle'];
            $_SESSION['player']['monsterlevel']     = $row['monsterlevel'];
            $_SESSION['player']['monsterid']        = $row['monsterid'];

        }

        echo '<div id="loginaccess"><a href="home.php">[Success Click Here to Login]</a></div>';

    } else {

        echo '<div id="loginaccess">Invalid username or password.</div>';

    }
}
                ?>
            <form id="login" action="" method="POST">
                    <div id="uname" class="formfloat"><p><label for="loginUserName">Username:</label>
                    <input type="text" id="loginUserName" name="loginUserName" value="" class="formfield" tabindex="1" size="15" maxlength="20" /></div></p>
                    <div id="pword" class="formfloat"><p><label for="loginPassWord">Password: </label>
                    <input type="password" id="loginPassWord" name="loginPassWord" value="" class="formfield" tabindex="2" size="15" maxlength="20" /></div></p>
                    <div class="formbreak"></div><br />
                    <input id="loginsubmit" type="submit" value="Login" name="Submit" tabindex="3" >
            </form>
            </div>
        </div>
        <div id="sidebarRight"><!-- sidebarRight div start -->
        </div>
  • 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-13T00:06:14+00:00Added an answer on May 13, 2026 at 12:06 am

    Your SQL query seems to be missing a clause when you’re validating the password. WHERE username = '$loginUserName' AND '$loginPassWord' will evaluate to true if the given username exists in the database, and the value of $loginPassWord evaluates to true (because you’re not comparing it to anything).

    Furthermore, you should be escaping input you get from the user before using it in a database query, using something like mysql_real_escape_string, in order to prevent SQL Injection attacks.

    Putting that together, I’d replace your query with something like:

    $loginSubmitQuery = "SELECT username, password
      FROM users
      WHERE username = '" . mysql_real_escape_string($loginUserName) . "'
        AND password = '" . mysql_real_escape_string($loginPassWord) . "'"; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is a similar question here but it only covers some of the issues
Obviously I can use BCP but here is the issue. If one of the
Now I know this issue is over-talked about but I cannot seem to find
Here is the issue I am having: I have a large query that needs
Here's my issue: I need to close a process, already running, from a C#
Here's my issue, I'd like to mock a class that creates a thread at
Here's the issue: I have a hook in IE that reacts on WebBrowser.OnNavigateComplete2 event
Here is my issue. I have an array containing the name of cities that
Alright so here is my issue. I'm working a game engine that will eventually
I have a similar issue like here: http://social.msdn.microsoft.com/forums/en-US/biztalkgeneral/thread/87d5a6ec-04ee-4c6f-8267-f526ee105f0b I have an asp.net web page

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.