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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:30:54+00:00 2026-06-18T03:30:54+00:00

I am trying to create a login page but I have a problem where

  • 0

I am trying to create a login page but I have a problem where the data is not being sent. Can any one help me out.

  $myusername = stripslashes($username);
    $mypassword = stripslashes($password);
    $myusername = mysqli_real_escape_string($myusername);
    $mypassword = mysqli_real_escape_string($mypassword);

    $sql="SELECT * FROM login_admin WHERE user_name='$myusername' and user_pass=SHA1('$mypassword')";
    $result=mysql_query($dbC, $sql);
    // Mysql_num_row is counting table row
    $count=mysql_num_rows($result);
    // If result matched $myusername and $mypassword, table row must be 1 row
    if($count==1){
        // Register $myusername, $mypassword and redirect to file "admin.php"
        session_register("admin");
        session_register("password");
        $_SESSION['name']= $myusername;
        header("location:admin.php");
    }
    else {

        $msg = "$username $password $myusername $mypassword $sql $result Wrong Username or Password. Please retry";
        header("location:login.php?msg=$msg");
    }

And the output I get is:
test test123 SELECT * FROM login_admin WHERE user_name=\’\’ and user_pass=SHA1(\’\’) Wrong Username or Password. Please retry

  • 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-18T03:30:55+00:00Added an answer on June 18, 2026 at 3:30 am

    You have to supply a $link identifier as the first argument in mysqli_real_escape_string so those lines should look more like

    $myusername = mysqli_real_escape_string($dbconn,$myusername);
    $mypassword = mysqli_real_escape_string($dbconn,$mypassword);
    

    where $dbconn is the link you get back from mysqli_connect. You’re also using mysql_query and mysql_num_rows when you should be using their mysqli_ equivalents if you’re going to be switching to the mysqli_* set of functions.

    I’d strongly recommend switching to mysqli (or PDO) over using the (now legacy) mysql functions. PHP.net provides information about why.

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

Sidebar

Related Questions

I'm trying to create a login and logout page with django. The problem I
I'm trying to create a Login page, not worrying about actually logging in yet,
I am trying to create a login page that will send the user to
Im trying to create a iPhone Objective C login page using PHP/MySQL to authenticate.
I'm trying to create a login system using PHP, and I'm not quite sure
I'm trying to create a user management system using steam openid, but I'm not
Im having a problem when trying to create a member login system where each
I'm trying to create a simple login page that accesses a DB so that
I have a strange problem with my code. i'm trying to create a form
I am trying to create a simple HTML Facebook tab for my page, but

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.