Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.