Each page should begin with
session_start();
and you should not use session_register( "variablename" ) since PHP version 4.2, use
$_SESSION["variable"] = value;
so an example of a page with logged verification would be:
<?php session_start(); if($_SESSION["loggedIn"] != true) { echo("Access denied!"); exit(); } echo("Enter my lord!"); ?>
and script login:
<?php if( isset($user_info['url']) ) { $_SESSION["loggedIn"] = true; $_SESSION["username"] = $myusername; header('Location: ' . $user_info['url']);
source share