"; $PHPSESSID = eregi_replace("PHPSESSID=","",$HTTP_COOKIE); //echo $PHPSESSID."
"; global $debugmode; //$debugmode="y"; /** * if you're going to time things, * start the timer as the first step */ $start = microtime(); srand ((double) microtime() * 1000000); /* * 10314424798490535546171949056 combinations */ $randomstring = substr(md5(uniqid(rand())),0,6); /** * Define base constants * DOCUMENT_ROOT = server's DOCUMENT_ROOT variable * BASE_URL = standard URL for web browser * APP_URL = base app URL - the main engine - this file! * SERVICE_PATH = path where services are stored * MODULE_PATH = path to common data objects * DEFAULT_URL = if 'no service' in URL, redirect to this URL * PICS_URL = main directory for graphics - use in templates if needed */ define(DEFAULT_SERVICE,"login"); define(UNAUTHORIZED_SERVICE,"login"); define(DOCUMENT_ROOT,"/usr/home/playwork/usr/local/etc/httpd/htdocs/"); define(BASE_URL,"http://$HTTP_HOST/clients/"); define(BASE_URL_SECURE,"https://".$HTTP_HOST."/clients/"); define(SERVICE_PATH,DOCUMENT_ROOT."../lcservices/"); define(MODULE_PATH,DOCUMENT_ROOT."../lcmodules/"); define(APP_URL,BASE_URL."index.php/$randomstring/"); define(APP_URL_SECURE,BASE_URL_SECURE."index.php/$randomstring/"); define(TEMPLATE_PATH,DOCUMENT_ROOT."../lctemplates/"); define(MENU_PATH,DOCUMENT_ROOT."../lchtml/"); define(DEFAULT_MENU,"default_menu.html"); define(DATA_PATH,DOCUMENT_ROOT."../lcdata/"); define(HTML_PATH,DOCUMENT_ROOT."../lchtml/"); define(DEFAULT_URL,APP_URL.DEFAULT_SERVICE); define(UNAUTHORIZED,APP_URL.UNAUTHORIZED_SERVICE); define(CLOSED,APP_URL."html/closed.html"); define(UNAVAILABLE,APP_URL."html/blah.html"); define(MAIN_HEADER,HTML_PATH."header.html"); define(MAIN_FOOTER,HTML_PATH."footer.html"); define(SELF_URL,APP_URL."?".$QUERY_STRING); define(PHP_SELF,$PHP_SELF); define(TODATETIME,date("m/d/Y h:i:s A")); define(TODATE,date("m/d/Y")); $cookiehost = ".workplayce.com"; /** * Include main files */ include(MODULE_PATH."LC_include.php"); include(MODULE_PATH."LC_service.php"); include(MODULE_PATH."LC_db.php"); /** * Create framework object for * storing 'stuff' */ $lcObj = new appobject(); $lcObj->referer = $HTTP_REFERER; /** * Authenticate the URL * and make PATH_INFO into variables * for others to use via the lcObj */ if ($QUERY_STRING!="") { $QUERY_STRING = ereg_replace("&","/",$QUERY_STRING); $PATH_INFO .= "/$QUERY_STRING"; } $url = "$PATH_INFO"; $name = explode("/",$url); $serviceName = $name[2]; $x=4; while ($x<=sizeof($name)) { $key=""; $tempval = trim($name[$x-1]); if (ereg("=",$tempval)) { list($key,$val) = explode("=",$tempval); } else { $val = $tempval; } $val = urldecode($val); $lcObj->getvars[] = $val; if ($key!="") { $lcObj->getvars[$key] = $val; } if (substr($name[$x-2],0,3)=="rd=") { $lcObj->redir = substr($name[$x-1],3); } $x++; } $x=4; reset($name); while ($x<=sizeof($name)) { if ($redir!="") { $redir.="^"; } $redir .= $name[$x-1]; $x++; } if ($redir) { $redir="$serviceName^$redir"; } else {$redir = $serviceName; } $redir = "rd=$redir"; $lcObj->postvars = $HTTP_POST_VARS; $lcObj->uploads = $HTTP_POST_FILES; /** * Make the URL pretty */ if (substr($PHP_SELF,strlen($PHP_SELF)-1)=="/") { $PHP_SELF=substr($PHP_SELF,0,strlen($PHP_SELF)-1); } /** * Redirect if off */ if (($url=="") || ($name[2]=="") || ($url=="/") || ($serviceName=="")) { header("Location: ".DEFAULT_URL); } /** * Connect to database */ $db = new DB; $db->connect(); /** * Set error handling stuff */ //error_reporting (E_ERROR | E_NOTICE); $lcAdminMail = "michael@tapinternet.com"; $lcErrorPage = BASE_URL."/error.html"; //set_error_handler('lcErrorHandler'); /** * Create the user object */ $lcUser = new user("","",$db); /** * Start session handling */ //global $PHPSESSID,$SERVER_ADDR,$REMOTE_ADDR; if ((!isset($PHPSESSID)) || ($PHPSESSID=="") || ($PHPSESSID=="deleted")) { $PHPSESSID=md5 (uniqid (rand())); if (stristr($HTTP_HOST, "$cookiehost")) { setcookie("PHPSESSID",$PHPSESSID,time()+36000,"/","$cookiehost"); } else { setcookie("PHPSESSID",$PHPSESSID,time()+36000,"/",""); } } sess_open($db,$PHPSESSID); $lcUser->user($db); $lcUser->createFromDB($db,$uid); //$lcUser->getPerms(); /** * Set more service/template stuff */ $lcObj->servicepath = SERVICE_PATH; $lcObj->templatepath = TEMPLATE_PATH; $lcObj->templatename = $serviceName.".html"; $lcObj->service = $serviceName; /** * keep a few blank lines for extra * stuff later... */ /** * OK, that's enough! :) */ /** * Start main processing below */ /** * Include the actual service * /index.php/disp * 'service' is 'disp' * so we pull in disp.php from the services directory */ include (SERVICE_PATH."/$serviceName.php"); /** * Create a new 'service' object * from service.php in 'main' services */ $service = new $serviceName; /** * Authenticate the user * */ $service->authenticate($lcUser,$serviceName); /** * If we have an 'event' posted * assume the event is a function in the * service we included * and execute it (eval) * event = blah * $service->blahRun($params) */ /* * alteration for ty * to pull event from getvars as well */ $event = $lcObj->postvars["event"]; if ($event =="") { $event = $lcObj->getvars["event"]; } $a = "\$service->".$event."Run(\$db,\$lcUser,\$lcObj,\$lcTemplate);"; if ($event=="") { eval($a); } else { if (method_exists($service,$event."Run")) { eval($a); } else { HeadFootTempl::throwError("The function $event does not exist."); } } /** * Call the template function of the main * service class. Can be overridden for * custom templates per service, or replaced * in 'service.php' with a different template * system. */ $service->template($lcObj,$lcUser,$lcTemplate); /** * Call closepage() * wrap up database connections and sessions * and any last-minute detail stuff. */ closepage(); $x = explode(" ",$start); $y = explode(" ",microtime()); $a = $x[1] + $x[0]; $b = $y[1] + $y[0]; $c = ($b-$a)*1000; //print_r($lcUser); //echo "
".sprintf("%.2f",$c)." ms"; ?>