Page 2 of 2

Posted: Thu Feb 05, 2004 1:26 pm
by Think-Digitally
Great thanks malcolmboston.

I suppose you couldnt know about the initial questions would you?

Posted: Thu Feb 05, 2004 1:27 pm
by malcolmboston
lol sorry im tired, what were the Q's?

Posted: Thu Feb 05, 2004 1:30 pm
by Think-Digitally
I have a script already done, it all works... but I cant get the login to make sure that the viewer is logged in, otherwise they can just type in the URL and no need to join.

Maybe I was writting it wrong. this is how I did it, and you can tell me what the hell I am doing wrong!!

I have made a new file called context.php and put this in it;

<?

function session_checker(){
if(!session_is_registered('first_name')){
include 'loginform.htm';
exit();
}
}

?>

exactly like that on its own in that file.

In the html document that I want to protect from viewers that are not logged in I have put this at the top before the <html> tag.

<?php

include 'context.php';

session_start();
session_checker();

?>

Is that completely wrong??

Posted: Thu Feb 05, 2004 1:35 pm
by malcolmboston
just cleaning it up; 2 mins

Code: Select all

<? 

function session_checker(){ 
if(!session_is_registered('first_name')){ 
include 'loginform.htm'; 
exit(); 
} 
} 

?> 

exactly like that on its own in that file. 

In the html document that I want to protect from viewers that are not logged in I have put this at the top before the <html> tag. 

<?php 

include 'context.php'; 

session_start(); 
session_checker(); 

?>

Posted: Thu Feb 05, 2004 1:36 pm
by Think-Digitally
Okay, thanks :)