Jump to content

Trying to Prevent having to login in twice.


blesseld

Recommended Posts

Hey All,

 

I am trying to figure out how I can eliminate having to log in 2 times.

 

There is no database.  it just sets a session, but because the browser doesn't refresh you have to login 2 times.

 

Looking for some sort of "check" solution...  any suggestions?

 

if (isset($_POST['username'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    if ($username == "" || $password == "") {
        $error = "<div id=\"login-warning-box\"><center><p class=\"login-text\">Not all fields were entered.</p></center></div>";
    } else {
        if ($username != "$set_username" || $password != "$set_password") {
            $error = "<div id=\"login-warning-box\"><p class=\"login-text\">Username/Password invalid.</p></div>";
        } else {
            $_SESSION['username'] = $username;
            $_SESSION['password'] = $password;
            $admin_panel = "$admin_panel_url";
            header ("Location: $admin_panel");//CHANGE DOMAIN
        die("");
        }
    }
}

 

header.php

ob_start();
session_start();
if (isset($_SESSION['username'])) {
    $username = $_SESSION['username'];
    $loggedin = true;
} else
    $loggedin = false;

 

thanks,

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.