Jump to content

using sessions?


feck

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...