navigation  interaction  search

 other resources

root/tags/phpbms-0.50/test.php

Revision 1 (checked in by mipalmer, 2 years ago)

--

Line 
1 <?php
2 function loadSettings() {
3     $_SESSION["isloaded"]=true;
4     
5     $path="";
6     $count=1;
7     //need to look for settings file... only go up a total of 5 directorieds
8     while(!file_exists("settings.php") and ($count<5)){
9         $path.="../";
10         @ chdir("../");
11         $count++;
12     }
13     
14     $settingsfile =  @ fopen("settings.php","r");
15     if($settingsfile){
16         //loop through the settings file and load variables into the session
17         while( !feof($settingsfile)) {
18             $line=fscanf($settingsfile,"%[^=]=%[^[]]",$key,$value);
19             if ($line){
20                 $key=trim($key);
21                 $value=trim($value);
22                 if($key!="" and !strpos($key,"]")){   
23                     $startpos=strpos($value,"\"");
24                     $endpos=strrpos($value,"\"");
25                     if($endpos!=false)
26                         $value=substr($value,$startpos+1,$endpos-$startpos-1);
27                     $_SESSION[$key]=$value;
28                 }
29             }
30             $line=NULL;
31             $key=NULL;
32             $value=NULL;
33         }
34         fclose($settingsfile);
35         return $path;
36     } else reportError(500,"Settings file could not be opened");
37 }
38
39 ?>
40 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
41 <html>
42 <head>
43 <title>phpBMS - TEST</title>
44 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
45 <link href="common/stylesheet/grays/base.css" rel="stylesheet" type="text/css">
46 </head>
47 <body><?php loadSettings();?>
48 </body>
49 </html>
Note: See TracBrowser for help on using the browser.
Copyright © 2006-2007 Kreotek, LLC. All Rights reserved.