vikingatc Posted August 14, 2008 Share Posted August 14, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/119593-newbie-help-authenticating-userspage-visitors/ Share on other sites More sharing options...
ignace Posted August 14, 2008 Share Posted August 14, 2008 use an access control list to control access to your pages Quote Link to comment https://forums.phpfreaks.com/topic/119593-newbie-help-authenticating-userspage-visitors/#findComment-616290 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.