Jump to content

double login problem


Recommended Posts

I have a from page which requires login with a username and password. It appears to work but when you go to the form page and submit the form, it takes you back to login again. The second time you supply the correct username and password it works fine.

 

Here's code from the form page:

<?php
//check for authorization
session_start();
if ($_SESSION['logged'] != 1)
{
$redirect = $_SERVER['PHP_SELF'];
header ("Location: filemaint_login.php");
die();
}

 

And this is the code from the login page:

session_start();
define ('SQL_HOST','blah');
define ('SQL_USER','blah');
define ('SQL_PASS','blah');
define ('SQL_DATB','blah');
define ('SQL_LUSR','blah');
define ('SQL_LPAS','blah');
$_SESSION['logged'] = 0;

if(isset($_POST['submit']))
{
if ($_POST['username'] == SQL_LUSR && $_POST['password'] == SQL_LPAS)
{
 $_SESSION['logged'] = 1;
 header ("Location: file_maint.php");
}
else

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.