I'm programming my own CMS in PHP/MySQL and have run into a problem. I want to do something like the code that is used for all pages in the admin directory of vB. Here's what I wanna do. Any page that is in the admin directory, i want to either have in the code a
include("xxx.php" );
or have a function that first off checks if the session variable admincploggedin. If that variable= 1, then exit the function/page and proceed with the original page. If that variable has no value or doesn't exist, I want a login and password box to display. The administrator then enters his/her password, the function/script checks the DB to see if user/pass is correct and if the usergroupid= 6(which is the adminuser group for me). If that is true, then it should set the session variable admincploggedin to 1 and display the contents of that page. If the login/pass is incorrect or the user is not an admin, I want it to display an error message than display the login/password boxes again and not allow the original script to proceed.
I tried looking at the vB code for any ideas about this, but I couldn't deciper anything. Can anyone help me?