cooldude832 Posted June 8, 2007 Share Posted June 8, 2007 I have a login that uses a session activation to make users login. This is the code <?php $start = session_start(); $ob = ob_start(); // Recreation of variables for later encryption uses the $_POST will be replaced with the decrypted source $username = trim($_POST['username']); $password = trim($_POST['password']); $cryptpassword = md5($password); $url = trim($_POST['url']); //Connects to DB require("includes/mysql_include.php"); $table = "users"; $sql="SELECT * FROM $table WHERE Username='$username' and Password='$cryptpassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); $storage= mysql_fetch_array($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1) { // Register $myusername, $mypassword and redirect to file "login_success.php" $_SESSION['loggedon'] = "yes"; $_SESSION['user'] = $username; $_SESSION['firstname'] = $storage['Firstname']; header("location: $url"); } else { echo "Wrong Username or Password"; } the page it returns to has this at the top to check if logged in: session_start(); if (ISSET($_SESSION['loggedon'])) {$view = "login";} I think my issue is that the page is sending headers and therefor session aren't starting any tips? Link to comment https://forums.phpfreaks.com/topic/54681-session-passed-login-script-requiring-me-to-login-twice/ Share on other sites More sharing options...
seopaul Posted June 8, 2007 Share Posted June 8, 2007 i think i know whats going on but i need abit more info i have sent you my email address via pm Link to comment https://forums.phpfreaks.com/topic/54681-session-passed-login-script-requiring-me-to-login-twice/#findComment-270443 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.