surf142248
01-18-2006, 09:15 AM
I have been working on a membership system. After a member is logged in, they can go to another 'members only' page, which should only be accessable by members.
Problem: Anyone who types the page address can access the page.
Here is the function code, which I have included at the end of db.php (all the sql database information):
[php]
function session_checker(){
if(!session_is_registered('first')){
include 'login.html';
exit();
}
}
[php]
Now, I theoretically should be able to just put this on top of each page that I designate to be a 'members only' page......right????
[php]
<?
include 'db.php';
session_start();
session_checker();
?>
[php]
So, after I set this up, I should be able to avoid non-registered members just typing the address in to the address bar of the browser to pull that page up.
The problem right now is that it isn't functioning.:confused:
Any assistance with this problem would be greatly appreciated.:D
PS. I am aware of the security problem using first as a session name. I'll worry about it after I get this functional.
Thanks again :)
Problem: Anyone who types the page address can access the page.
Here is the function code, which I have included at the end of db.php (all the sql database information):
[php]
function session_checker(){
if(!session_is_registered('first')){
include 'login.html';
exit();
}
}
[php]
Now, I theoretically should be able to just put this on top of each page that I designate to be a 'members only' page......right????
[php]
<?
include 'db.php';
session_start();
session_checker();
?>
[php]
So, after I set this up, I should be able to avoid non-registered members just typing the address in to the address bar of the browser to pull that page up.
The problem right now is that it isn't functioning.:confused:
Any assistance with this problem would be greatly appreciated.:D
PS. I am aware of the security problem using first as a session name. I'll worry about it after I get this functional.
Thanks again :)