PHP - Log in Script Not Creating Sessions -


i have log in script have been able make users, , log in. issue whenever try use method of protecting pages, being seeing if there session 'user' if not directs login page.

here me checking session,

require("common.php");    if(empty($_session['user']))  {       header("location: login");       die("redirecting login");  }  

here setting session, setting session_start(); on login.php

if($login_ok)      {           unset($row['salt']);          unset($row['password']);           $_session['user'] = $row;           header("location: home?worked=1");          die("redirecting to: home?worked=1");         session_start();      }      else      {          print("login failed.");          $submitted_username = htmlentities($_post['username'], ent_quotes, 'utf-8');      }  }  

what does, log in, , process , bring me home page, process header login page acting if not logged in. tested false login , telling correct login.

thanks help, i'm pulling hair out here!

necro

edit

i moved session_start(); top of common.php, , perfect.

you have session_start(); after $_session['user'] = $row; have after die(); command. nothing happens after that.

put session_start(); @ top of php in every page (pref common.php since have one) not 1 page.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -