feck Posted November 26, 2006 Share Posted November 26, 2006 Hello Again,I'm using a small login page, which validates in javascript.Once validation has occured or not with Javascript, a php page is called, which validates again using PHP.This then checks to see if the user input resides in the database, and if so redirects the user to another page.At the start of the PHP page (the one with database verification) I start a session:<?php session_start();.......Once the data has been verified I would like to redirect to another page and pass a session:if($successful){ $_SESSION['staff'] = 1; header("Location: checkSession.php"); exit; }else{//more code........At the top of the checker page I have some more code which should in my limited understanding redirect the user to the login page if the Session is set:<?phpif (isset($_SESSION['staff'])) { header("Location: loging.html"); exit(); } ?>But it does'nt, It actually stays on the checker page.What am I doing wrong? Link to comment Share on other sites More sharing options...
feck Posted November 26, 2006 Author Share Posted November 26, 2006 Hi People,Please someone respond.I think I've fixed the problem after a few hours, and surfing this amazing forum.To use a session accross pages have you got to keep applying session_start();at the start of every page that accesses the session variable?Please respond as this is slowly melting my brain.Thanks Link to comment Share on other sites More sharing options...
reportingsjr Posted November 26, 2006 Share Posted November 26, 2006 Yes, anywhere you want to use sessions at the top of the page you MUST have session_start(); Link to comment Share on other sites More sharing options...
feck Posted November 26, 2006 Author Share Posted November 26, 2006 Thanks reportingsJr.You's guys are a god send! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now