blesseld Posted April 19, 2010 Share Posted April 19, 2010 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, Link to comment https://forums.phpfreaks.com/topic/199039-trying-to-prevent-having-to-login-in-twice/ Share on other sites More sharing options...
Jax2 Posted April 19, 2010 Share Posted April 19, 2010 try a meta refresh ... should work ... Link to comment https://forums.phpfreaks.com/topic/199039-trying-to-prevent-having-to-login-in-twice/#findComment-1044739 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.