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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:56:11+00:00 2026-05-25T10:56:11+00:00

so I have a simple login page like this: <fieldset> <legend>Verification</legend> <form method=post action=authentication.php>

  • 0

so I have a simple login page like this:

   <fieldset>
    <legend>Verification</legend>
   <form method="post" action="authentication.php">


<?php if($_GET['error']==1){
      echo "<p style=\"float: left; \" class=\"criticMsg\">Username or password are wrong</p>";  
    }
    ?>


 <br /><br /> <br /><br />
 <label style="float: left; margin-top: 15px;" for="username">User</label><input    type="text" name="username"></input><br />
 <label for="password">Password</label><input type="password" name="password"></input>  <br />
  <input type="submit" class="globalBtn" value="Enter"></input>
  </form>

    </fieldset>

then the authenticate.php file is like this:

 include ('functions.php');

if(valid_details($_POST['username'], $_POST['password'])){
header("Location: ../../storage_update.php?message=1");
}else{
header("Location: login.php?error=1");
}

finally the functions.php looks like this

include("../connection.php");


$sql = "SELECT user, pass FROM users";
$back = "There is an error. <a href=\"login.php\">Back</a>";
$result = $conn->query($sql) or die($back);

while($row = $result->fetch_object()){

//validates user input

function valid_details($username, $password){
if(isset($username) && $username == $row->user){
   if(isset($password) && $password == $row->pass){
   return true;}
   }


  };
 }

When I type the correct username and password provided in the database I get the error=1 variable in the url, which is not what I expect on correct credentials. However if I fastly double click the submit button it gets me on the expected page returning message=1 in the url, so that it means the function valid_credentials is works ok, but why does the button react like that? EDIT In the page storage_update.php (the landing page) I have implemented fancybox jquery plugin.

  • 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-25T10:56:12+00:00Added an answer on May 25, 2026 at 10:56 am

    The structure of your code is really odd, if i had my way i would rewrite most of it, anyways, putting that aside. Currently you have your function within a while loop, why you’re looping in the first place is bizarre, you can just do a direct check in the database for the user that you are looking for. See below.

    include("../connection.php");
    
    function valid_details($username, $password){
        $sql = "SELECT user, pass FROM users";
        $sql .= "WHERE user='".$username."' AND pass='".$password."'"; 
        $back = "There is an error. <a href=\"login.php\">Back</a>";
        $result = $conn->query($sql) or die($back);
    
        return count( $result ) > 0             
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple web page that till now didn't need any login. It
There are some HTML based games (ie bootleggers.us) that have a simple login form
I would like to see a simple Login Application, not as simple as this
Ok, i have simple scenario: have two pages: login and welcome pages. im using
Imagine that you have a simple site with only 2 pages: login.aspx and secret.aspx.
I'm working on a simple javascript login for a site, and have come up
Ok, so I have a very simple form with next to no logic in
I have a simple ASP.NET 4 site. I am using Forms Authentication. I have
i have a web.config file that looks like this: <?xml version=1.0?> <configuration> <system.web> <compilation
i am trying to recreate the login form shown on tinypic's main page. in

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.