Jump to content

Newbie Help - authenticating users/page visitors


vikingatc

Recommended Posts

I'm trying to code a means for authenticating access to my web pages. I've got the mySQL DB set up and the main code works for verifying access and dumping the person to the page I want them at.

 

What I cannot figure out is how to authenticate based on something like a pageid.  Here's the code I have that is called in a phpinclude() at the start of the file.

 

I don't get an error message, what happens is that all access attempts dump to the login page.

 

Code on the page


<?php
$page = 'pagename';
include_once( './accessfunctions.php' );
?>

 

The part of accessfunctions.php that I think is messing up is this

 

<?php
function verify_if_valid_user()
{
  if( $_SESSION['pageaccess'] == $page)
 //see if pageaccess matches actual page value
 //allow to page if it does
{
	exit;
}
        //see if pageaccess matches admin
        //allow access if it does
elseif( $_SESSION['pageaccess'] == 'admin')
{
	exit;
}
else
        //dump out to login screen
{
	die( header('location:'.URL_LOGIN_PAGE) );
}

}
?>

 

It doesn't work right. This is a modification of the code located at: http://www.gidforums.com/t-887.html

 

Separately all the rest of the code I've got works... I'll post it all if that would help. This I just can't get figured out. I know that the 'pageaccess' variable is correct, 'cause I've tested it elsewhere... but I can't get this part. Any help would be great.

 

Thanks,

VikingATC

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.