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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:04:54+00:00 2026-05-25T22:04:54+00:00

So basically what I have set up here is a very simple and generic

  • 0

So basically what I have set up here is a very simple and generic log in. I have the entire code copy and pasted because maybe its important somehow. However-

$user = mysql_real_escape_string($_POST['User']);
$pass = mysql_real_escape_string(md5($_POST['Pass']));
$conn = mysql_connect("localhost", "root") or die(mysql_error());
(mysql_select_db('fireworks', $conn));
$ask = "SELECT * FROM name WHERE (User = '" . $user . "') and (Pass = '" . $pass . "');";
$result = mysql_query($ask);

The segment of code below is completely ignored! When I press log in (From the index page) It is suppose to run a series of checks. If the user decides to not put anything inside the user and password text boxes then it is suppose to return the string show below:

if (strlen($user) < 1){
    if (strlen($pass) < 1){
        print "<p class = 'Back'>Epic Fail</p>";
        print "<p>You forgot to put in your Username or Password.</p>";
    }
}

(^Up until here) But it doesn’t. Instead its just a blank page. But everything else works fine. If I type in a fake user then it returns “YOU FAIL!” If I type a valid user it returns “WELCOME BACK.”

if (strlen($user) >= 1){
    if (mysql_num_rows($result) >= 1) {
        while ($row = mysql_fetch_array($result))
        {
            print "<p class='Back'>Welcome back</p><p>" . $row['User'] . "</p>";
        }
    }else{
        print "YOU FAIL!!!";
    }
}

Any suggestions? EXTRA NOTES: The database is called fireworks the table is called name there are three columns in the name table. nameID, User, and Pass. (Idk how this is useful but sometimes it is.)

  • 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-25T22:04:55+00:00Added an answer on May 25, 2026 at 10:04 pm

    Your code:

    if (strlen($user) < 1){
    if (strlen($pass) < 1){
    print "<p>You forgot to put in your Username or Password.</p>";
    }
    }
    

    In actual fact, this won’t check for $user or $pass being blank; it will only give the error message if both of them are blank.

    Each test is okay on its own, but the way it’s written, the test for $pass will only be run if the $user test has already given a true result.

    What you need to to is write them together with an or condition, like so:

    if (strlen($user) < 1 or strlen($pass) < 1){
    ....
    }
    

    Hope that helps.

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

Sidebar

Related Questions

Total noob here learning openGL and I don't have any code to post because
I basically have to do a update of a record. I have a set
I basically have a server set up and I'm accepting new clients(UNIX) and i'm
Basically I have my Emacs set up so it has a GUI specific elisp,
We have a set of applications that basically display a bunch of bitmaps and
I have an archiving process that basically deletes archived records after a set number
I have a .NET assembly(3.5 framework) and it basically has a set of custom
I'm using a very simple fade function with MooTools 1.2 (I 'have' to use
I have a page where you basically select a set of options (configuration), and
I'm trying to set up a very simple UDP socket server with python that

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.