I am having trouble with trying to create a function that sets up my security for all web pages. The problem is that every page calling this function exits in sub directories and I keep getting the error can’t find file. Ultimately, this script is going to reside on a UNIX box and I thought that by putting a ‘/’ at the begging it would treat htdocs as my root… However, this is not working. Is there any way to have include files in a function with both UNIX and Windows platforms? Example…
function security_web_app($webapp, $database) {
include("/lib/database/db_lib.php");
include("/lib/standard/std_lib.php");
#session_start() creates a session (or resumes the current one based on the
#session id being passed via a GET variable or a cookie).
session_start();
#session_register -- Register one or more variables with the current session
session_register("SESSION");
#Checks to see if the user is logged in. if not, it will show
#the login screen before allowing the user to continue
if (!empty($webapp)) require_login();
#Checks to see if the user has the privilege $priv. if not,
#it will display an Insufficient Privileges page and stop
if (!empty($webapp)) require_priv($webapp);
#db_connect(db, userid, password]) --open Informix server connection
#And creates a GLOBAL connection ID for all queries on that page
db_connect($database, trim($SESSION["user"]), trim($SESSION["password"]));
}
ps.. I played with ‘include_path =’ but it doesn’t seem like it has an effect…
Thanks for any suggestions...