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

The Archive Base Latest Questions

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

I have a login form that when submitted; redirects back to the login page.

  • 0

I have a login form that when submitted; redirects back to the login page. I can’t seem to find any syntax errors so I think I must be truly missing out on something vital to a login form. Here is the code.

login.php:

<?
require ('../includes/config.inc.php');
if ($_POST['act'] == "Insert") {
    #// Additional security check
    $RR = mysql_query("SELECT id from BPLA_adminusers");
    if (mysql_num_rows($RR) > 0) {
        print "Fatal error: user cannot be inserted - one or more administrators are already present in the database.<a href=login.php>login page</a>";
        exit ;
    }
    $md5_pass = md5($MD5_PREFIX . $_POST['password']);
    echo $query = "insert into BPLA_adminusers values (10,'$_POST[username]', '$md5_pass', '20011224', '20020110093458', 1)";
    $result = @mysql_query($query);
    #// Redirect
    Header("Location: login.php");
    exit ;
}
$query = "select MAX(id) from BPLA_adminusers";
$result = @mysql_query($query);
while ($row = mysql_fetch_row($result)) {
    $id = $row[0] + 1;
}
?>
<?
if($id==1) {
$id=0;
?>
<form name="login" data-ajax="false" action="login.php" method="post">
    <span><? print $ERR;?></span>
    <label for="<? print "Username";?>"><? print "Username";?></label>
    <input type="text" name="username" />
    <label for="<? print "Password";?>"><? print "Password";?></label>
    <input type="password" name="password" />
    <input type="submit" name="action" value="<? echo $MSG_5204;?>">
</form>
<?
} else {
$id=1;
#//
if($_POST[action] == "login") {
if(strlen($_POST[username]) == 0 || strlen($_POST[password]) == 0) {
$ERR = $ERR_047;
} else {
$query = "select * from BPLA_adminusers where username='$_POST[username]' and password='".md5($MD5_PREFIX.$_POST[password])."'";
$res = @mysql_query($query);
if(!$res) {
print "Error: $query<BR>".mysql_error();
exit;
}
if(mysql_num_rows($res) == 0) {
$ERR = $ERR_048;
} else {
$admin = mysql_fetch_array($res);
#// Set sessions vars
$BPLowbidAuction_ADMIN_LOGIN = $admin[id];
$BPLowbidAuction_ADMIN_USER = $admin[username];
$_SESSION["BPLowbidAuction_ADMIN_LOGIN"]=$BPLowbidAuction_ADMIN_LOGIN;
$_SESSION["BPLowbidAuction_ADMIN_USER"]=$BPLowbidAuction_ADMIN_USER;
#// Update last login information for this user
$query = "update BPLA_adminusers set lastlogin='".date("YmdHis")."' where username='$admin[username]'";
$rr = mysql_query($query);
if(!$rr) {
print "Error: $query<BR>".mysql_error();
exit;
}
#// Redirect
print "<SCRIPT Language=Javascript>
parent.location.href='index.php';
</SCRIPT>";
//Header("Location: home.php");
exit;
}
}
}
?>
<? if(!$act || ($act && $ERR)) {
?>
<form name="login" data-ajax="false" action="login.php" method="post">
    <span><? print $ERR;?></span>
    <label for="<? print "Username";?>"><? print "Username";?></label>
    <input type="text" name=username />
    <label for="<? print "Password";?>"><? print "Password";?></label>
    <INPUT TYPE=password name=password />
    <input type="submit" NAME="action" VALUE="login">
</form>
<?  }?>
<?  }
    require("./footer.php");
?>

This code is being placed within index.php and is being used in an if/else statement to redirect to index.php again when it’s submitted.

index.php:

<?
require ('../includes/config.inc.php');
include ('bar.php');
if (!empty($_SESSION['BPLowbidAuction_ADMIN_LOGIN'])) {
    include ('home.installation.php');
} else {
    include ('login.php');
}
?>

The problem is that the login form first redirects to “login.php” and then back to “index.php” where the login form code is shown as if I never logged in. “bar.php” is just the header and the menu of the page and “home.installation.php” is just the home page that actually supposed to be shown.

  • 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-30T10:25:29+00:00Added an answer on May 30, 2026 at 10:25 am
    Header("Location: login.php");
    

    The Location header must point to an absolute and valid URI. I.e. should begin with a schema (http://), or forward slash /login.php

    HTTP 1.1 RFC on Location

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

Sidebar

Related Questions

I have a page which displays a form that a logged-in user can use
I have a login form that has Username and password as inputs from user
There are some HTML based games (ie bootleggers.us) that have a simple login form
The problem I am encountering is that for my login form I have to
I have a form on my website that does the login. To make the
I have a login form, which needs to be re-directed to the main page
I have a login form in every page of a website so the user
I have a simple login form that has 2 text fields and a button.
I have a web page containing a login form which loads via HTTP, but
I have a basic PHP form here that sends an email when submitted: <div

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.