473,626 Members | 3,304 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

where can ini_set('includ e_path','.:..') ; see?

I am taking over an existing app and having trouble understanding their
references.

They have encapsulated Pear packages in the directory structure like:
/site
/site/html/Pear.php
/site/html/Sigma.php
/site/html/Common.php
/site/html/Quickform.php
/site/html/Quickform/
/site/Mail/mail.php
/pages/page1.php

At the top of /site/html/Quickform.php they put:
ini_set('includ e_path','.:..') ;
...
require_once('H TML/Common.php');

And it throws an error trying to find 'HTML/Common.php' which is in the same
directory but referenced from the directory above it.

I have tried every configuration in the apache conf file and changing the
code itself.

So, can ini_set('includ e_path','.:..') ; see the directory above it? If not,
how can I change it to see the directory above it?

Any ideas are MUCH appreciated!
Mar 30 '07 #1
24 5339

"Paul" <lo*@invalid.co mwrote in message
news:8h******** **********@bign ews3.bellsouth. net...
|I am taking over an existing app and having trouble understanding their
| references.
|
| They have encapsulated Pear packages in the directory structure like:
| /site
| /site/html/Pear.php
| /site/html/Sigma.php
| /site/html/Common.php
| /site/html/Quickform.php
| /site/html/Quickform/
| /site/Mail/mail.php
| /pages/page1.php
|
| At the top of /site/html/Quickform.php they put:
| ini_set('includ e_path','.:..') ;
| ...
| require_once('H TML/Common.php');

dude paul, i could have sworn i gave you a fix for this! just edit the php
ini file. you need to create a file called 'relative.path. php'. and put it
in your php include path (that you are soon to quick fucking around with
using ini_set). that file has this code in it:

<?
$parsedUri = dirname($_SERVE R['PHP_SELF']);
$parsedUri .= substr($parsedU ri, -1) != '/' ? '/' : '';
$relativeUri = str_replace('/', '', $parsedUri);
$relativePath = strlen($parsedU ri) - strlen($relativ eUri) - 1;
if ($relativePath < 0){ $relativePath = 0; }
$relativePath = str_repeat('../', $relativePath);
if (!$relativePath ){ $relativePath = './'; }
?>

then i'd put this at the beginning of *EVERY* php file your site has:

<?
require_once 'relative.path. php';
?>

i'd remove every instance of ini_set('includ e_path', '.:..') that i saw.
that is a horrible way to get the desired effect and the programmer should
summarily be drawn and quartered. this method requires that the file
*always* be a relative distance for what you're including. it could also
severly fuck up a script that includes another and then tries to include
another...becau se each is setting the include_path! further, it doesn't
allow you to reuse the known relativity to call other folders for inclusion
like classes, common functions, whatever. this scenario requires *all*
includes to be in one folder. not very flexible, is it!

you'll notice that 'relative.path. php' creates a variable called
$relativePath. you'll also notice that it is compatible with all versions of
php...such that you can use it on a server that runs both php 4 or php 5.
the variable points to the root of your web application. once you know that,
you can merrily jump about. anyway, your code would become:

<?
require_once 'relative.path. php';
require_once $relativePath . 'HTML/Common.php';
?>

now it doesn't matter where your script is put in your directory structure.
as it is, your code doesn't work because ini_set('includ e_path','.:..')
isn't setting a valid path. the best solution would be to further abstract
your directory structure. here's what i put at the top of *EVERY* script of
my own:

<?
$pageTitle = "Welcome";
$fullHeader = true;
$securityEnable d = true;
require_once 'relative.path. php';
require_once $relativePath . 'site.cfg.php';
require_once site::$includeD irectory . 'head.inc.php';
?>

notice the use of the static site::$includeD irectory interface?
'site.cfg.php' configures the path. if i had a common header that should be
shown on a page (as i have in the above ficticious page), i could now
include it no matter where either the header nor the including page existed.
get the idea?

i have a configuration script called 'site.cfg.php'. it sets paths into
variables. so, when you implement the site, you can put your files all over
the gawd damned place and manage it all in one spot. the rest of your
scripts couldn't care less how crazy you go. they reference variables.
here's my site.cfg.php script:

<?
ini_set('displa y_errors' , true );
ini_set('error_ reporting' , E_ALL & E_ERROR & E_WARNING );
ini_set('max_ex ecution_time' , 0 );
ini_set('memory _limit' , '100M' );

session_start() ;

// site basic information

$rootDirectory = '/var/www/html/dev/';

require_once $rootDirectory . 'classes/site.class.php' ;

site::initializ e();

site::$rootDire ctory = $rootDirectory;
site::$uri = 'http' . ($securityEnabl ed ? 's' : '') .
'://' . $_SERVER['HTTP_HOST'];
site::$uri = 'http://' . $_SERVER['HTTP_HOST'] . '/';
site::$uploadBa seDirectory = site::$rootDire ctory . 'data/';
site::$mailDrop Directory = site::$rootDire ctory . 'data/mail/';
site::$adminEma il = Web Site Administrator <no****@example .com>';

site::$title = 'SAMPLE WEB SITE;
site::$descript ion = 'A SIMPLE PROVING GROUND';

site::$currentP age = basename($_SERV ER['PHP_SELF']);

site::$classDir ectory = site::$rootDire ctory . 'classes/';
site::$cssDirec tory = site::$uri . 'css/';
site::$host = 'tccc';
site::$errorLog File = site::$rootDire ctory . site::$host .
'.errors.log';
site::$fontDire ctory = '/var/www/fonts/';
site::$homePage = site::$uri . 'index.php';
site::$htdocsDi rectory = site::$rootDire ctory;
site::$imagesDi rectory = site::$uri . 'images/';
site::$includeD irectory = site::$rootDire ctory . 'inc/';
site::$jscriptD irectory = site::$uri . 'jscript/';
site::$logo = site::$imagesDi rectory . 'logo.jpg';
site::$popUpAtt ributes = 'addressbar=0, channelmode=0, dependent=1,
directories=0, fullscreen=0, location=0, menubar=0, resizable=1, status=0,
titlebar=0, toolbar=0';

// common php functionality

require_once site::$includeD irectory . 'functions.inc. php';

// source code security (disables 'view source' from right-click)

$enableContextM enu = true;

// site database information

require_once site::$classDir ectory . 'db.class.php';
try
{
db::connect('lo calhost', 'user', 'password', 'db');
} catch (exception $ex) {
print "<pre>\r\n" . $ex->getMessage() . "\r\n" .
' in file ' . $ex->getFile() . "\r\n" .
' on line ' . $ex->getLine() . "\r\n" .
'</pre>';
}

// site notifcations

$emailNotify['TO'] = site::$adminEma il;
$emailNotify['CC'] = site::$adminEma il;
$emailNotify['BCC'] = '';

// get relative font sizes for the browser

require_once site::$classDir ectory . 'browser.class. php';

$browser = browser::getIns tance();
$sessionFonts = $browser->getFonts();

// user interaction

require_once site::$classDir ectory . 'user.class.php ';

$logOut = isset($_REQUEST['logOut']);

if ($logOut)
{
user::reset();
session_unset() ;
session_destroy ();
header('locatio n:' . site::$uri);
exit;
}
?>

i'm using php 5, so if you are using a prior version, just adjust the static
interfaces on the site class appropriately. don't know what i mean? post
that as another question here. here is my site object:

<?
class site
{
public static $adminEmail = '';
public static $classDirectory = '';
public static $cssDirectory = '';
public static $currentPage = '';
public static $description = '';
public static $errorLogFile = '';
public static $fontDirectory = '';
public static $homePage = '';
public static $host = '';
public static $htdocsDirector y = '';
public static $imagesDirector y = '';
public static $includeDirecto ry = '';
public static $jscriptDirecto ry = '';
public static $lastSecurityCo de = '';
public static $logo = '';
public static $mailDropDirect ory = '';
public static $popUpAttribute s = '';
public static $rootDirectory = '';
public static $securityCode = '';
public static $title = '';
public static $uploadBaseDire ctory = '';
public static $uri = '';

private function __clone(){}

private function __construct(){}

private static function getSecurityCode ()
{
$alphabet = '2347ACEFHJKLMN PRTWXYZ'; // removed those that
look too similar
$alphabetLength = strlen($alphabe t) - 1;
self::$security Code = '';
for ($i = 0; $i < 6; $i++)
{
self::$security Code .= $alphabet[mt_rand(0, $alphabetLength )];
}
$_SESSION['securityCode'] = self::$security Code;
if (!self::$lastSe curityCode){ self::$lastSecu rityCode =
self::$security Code; }
}

public static function initialize()
{
self::$lastSecu rityCode = $_SESSION['securityCode'];
self::getSecuri tyCode();
}
}
?>

the other classes mentioned in the site.cfg.php are one's that i won't get
in to. i included this one so you could see how i set my important paths and
how easy this all is to maintain. it is light-weight, manageable, scaleable,
and highly flexible.

hth,

me

Mar 30 '07 #2
Paul wrote:
/site/html/Common.php
Lowercase
require_once('H TML/Common.php');
Uppercase

OS?

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Mar 30 '07 #3
btw, don't top post.

your post shows 3.30.2007 12.38 PM.
my response (which is the correct time) was 3.30.2007 10.57 AM.

man, i've got to start checking that before i feed the idiots!
Mar 30 '07 #4
"Steve" <no****@example .comwrote in message
news:ut******** *********@newsf e04.lga...
btw, don't top post.

your post shows 3.30.2007 12.38 PM.
my response (which is the correct time) was 3.30.2007 10.57 AM.

man, i've got to start checking that before i feed the idiots!
I can't remember if it was you I was explaining this to or not, but I do not
purposely manipulate the time on my machine, When I post it is the correct
time for my time zone.

I do appreciate your help!
Mar 30 '07 #5

"Paul" <lo*@invalid.co mwrote in message
news:FO******** ***********@big news4.bellsouth .net...
| "Steve" <no****@example .comwrote in message
| news:ut******** *********@newsf e04.lga...
| btw, don't top post.
| >
| your post shows 3.30.2007 12.38 PM.
| my response (which is the correct time) was 3.30.2007 10.57 AM.
| >
| man, i've got to start checking that before i feed the idiots!
|
| I can't remember if it was you I was explaining this to or not, but I do
not
| purposely manipulate the time on my machine, When I post it is the
correct
| time for my time zone.

as i've said, the clock on YOUR computer IS OFF ... no matter the
timezone!!! fix it, or i'll plonk you.

| I do appreciate your help!

not a problem. why did you completely ignore the help the FIRST time i
explained this all to you? it was the exact same problem and the exact same
solution. if you have nothing better to do, i sure have.

fix your clock.
Mar 30 '07 #6
"Steve" <no****@example .comwrote in message
news:iV******** ******@newsfe12 .lga...
>
"Paul" <lo*@invalid.co mwrote in message
news:FO******** ***********@big news4.bellsouth .net...
| "Steve" <no****@example .comwrote in message
| news:ut******** *********@newsf e04.lga...
| btw, don't top post.
| >
| your post shows 3.30.2007 12.38 PM.
| my response (which is the correct time) was 3.30.2007 10.57 AM.
| >
| man, i've got to start checking that before i feed the idiots!
|
| I can't remember if it was you I was explaining this to or not, but I do
not
| purposely manipulate the time on my machine, When I post it is the
correct
| time for my time zone.

as i've said, the clock on YOUR computer IS OFF ... no matter the
timezone!!! fix it, or i'll plonk you.

| I do appreciate your help!

not a problem. why did you completely ignore the help the FIRST time i
explained this all to you? it was the exact same problem and the exact
same
solution. if you have nothing better to do, i sure have.

fix your clock.
You were right - I was in the wrong time zone - my huge apologies. I just
set this laptop up and thought I had done that.
Mar 30 '07 #7
| fix your clock.
|
| You were right - I was in the wrong time zone - my huge apologies. I just
| set this laptop up and thought I had done that.

no big since i believe you that it wasn't intentional.

let me know if the scripts i posted are hard to work out...otherwise , the
simple suggestion of using $relativePath (first two scripts posted) should
solve your immediate problem.

cheers
Mar 31 '07 #8
"Steve" <no****@example .comwrote in message
news:tt******** ****@newsfe12.l ga...
>
"Paul" <lo*@invalid.co mwrote in message
news:8h******** **********@bign ews3.bellsouth. net...
|I am taking over an existing app and having trouble understanding their
| references.
|
| They have encapsulated Pear packages in the directory structure like:
| /site
| /site/html/Pear.php
| /site/html/Sigma.php
| /site/html/Common.php
| /site/html/Quickform.php
| /site/html/Quickform/
| /site/Mail/mail.php
| /pages/page1.php
|
| At the top of /site/html/Quickform.php they put:
| ini_set('includ e_path','.:..') ;
| ...
| require_once('H TML/Common.php');

dude paul, i could have sworn i gave you a fix for this! just edit the php
ini file. you need to create a file called 'relative.path. php'. and put it
in your php include path (that you are soon to quick fucking around with
using ini_set). that file has this code in it:

<?
$parsedUri = dirname($_SERVE R['PHP_SELF']);
$parsedUri .= substr($parsedU ri, -1) != '/' ? '/' : '';
$relativeUri = str_replace('/', '', $parsedUri);
$relativePath = strlen($parsedU ri) - strlen($relativ eUri) - 1;
if ($relativePath < 0){ $relativePath = 0; }
$relativePath = str_repeat('../', $relativePath);
if (!$relativePath ){ $relativePath = './'; }
?>

then i'd put this at the beginning of *EVERY* php file your site has:

<?
require_once 'relative.path. php';
?>

i'd remove every instance of ini_set('includ e_path', '.:..') that i saw.
that is a horrible way to get the desired effect and the programmer should
summarily be drawn and quartered. this method requires that the file
*always* be a relative distance for what you're including. it could also
severly fuck up a script that includes another and then tries to include
another...becau se each is setting the include_path! further, it doesn't
allow you to reuse the known relativity to call other folders for
inclusion
like classes, common functions, whatever. this scenario requires *all*
includes to be in one folder. not very flexible, is it!

you'll notice that 'relative.path. php' creates a variable called
$relativePath. you'll also notice that it is compatible with all versions
of
php...such that you can use it on a server that runs both php 4 or php 5.
the variable points to the root of your web application. once you know
that,
you can merrily jump about. anyway, your code would become:

<?
require_once 'relative.path. php';
require_once $relativePath . 'HTML/Common.php';
?>

now it doesn't matter where your script is put in your directory
structure.
as it is, your code doesn't work because ini_set('includ e_path','.:..')
isn't setting a valid path. the best solution would be to further abstract
your directory structure. here's what i put at the top of *EVERY* script
of
my own:

<?
$pageTitle = "Welcome";
$fullHeader = true;
$securityEnable d = true;
require_once 'relative.path. php';
require_once $relativePath . 'site.cfg.php';
require_once site::$includeD irectory . 'head.inc.php';
?>

notice the use of the static site::$includeD irectory interface?
'site.cfg.php' configures the path. if i had a common header that should
be
shown on a page (as i have in the above ficticious page), i could now
include it no matter where either the header nor the including page
existed.
get the idea?

i have a configuration script called 'site.cfg.php'. it sets paths into
variables. so, when you implement the site, you can put your files all
over
the gawd damned place and manage it all in one spot. the rest of your
scripts couldn't care less how crazy you go. they reference variables.
here's my site.cfg.php script:

<?
ini_set('displa y_errors' , true );
ini_set('error_ reporting' , E_ALL & E_ERROR & E_WARNING );
ini_set('max_ex ecution_time' , 0 );
ini_set('memory _limit' , '100M' );

session_start() ;

// site basic information

$rootDirectory = '/var/www/html/dev/';

require_once $rootDirectory . 'classes/site.class.php' ;

site::initializ e();

site::$rootDire ctory = $rootDirectory;
site::$uri = 'http' . ($securityEnabl ed ? 's' : '') .
'://' . $_SERVER['HTTP_HOST'];
site::$uri = 'http://' . $_SERVER['HTTP_HOST'] . '/';
site::$uploadBa seDirectory = site::$rootDire ctory . 'data/';
site::$mailDrop Directory = site::$rootDire ctory . 'data/mail/';
site::$adminEma il = Web Site Administrator
<no****@example .com>';

site::$title = 'SAMPLE WEB SITE;
site::$descript ion = 'A SIMPLE PROVING GROUND';

site::$currentP age = basename($_SERV ER['PHP_SELF']);

site::$classDir ectory = site::$rootDire ctory . 'classes/';
site::$cssDirec tory = site::$uri . 'css/';
site::$host = 'tccc';
site::$errorLog File = site::$rootDire ctory . site::$host .
'.errors.log';
site::$fontDire ctory = '/var/www/fonts/';
site::$homePage = site::$uri . 'index.php';
site::$htdocsDi rectory = site::$rootDire ctory;
site::$imagesDi rectory = site::$uri . 'images/';
site::$includeD irectory = site::$rootDire ctory . 'inc/';
site::$jscriptD irectory = site::$uri . 'jscript/';
site::$logo = site::$imagesDi rectory . 'logo.jpg';
site::$popUpAtt ributes = 'addressbar=0, channelmode=0, dependent=1,
directories=0, fullscreen=0, location=0, menubar=0, resizable=1, status=0,
titlebar=0, toolbar=0';

// common php functionality

require_once site::$includeD irectory . 'functions.inc. php';

// source code security (disables 'view source' from right-click)

$enableContextM enu = true;

// site database information

require_once site::$classDir ectory . 'db.class.php';
try
{
db::connect('lo calhost', 'user', 'password', 'db');
} catch (exception $ex) {
print "<pre>\r\n" . $ex->getMessage() . "\r\n" .
' in file ' . $ex->getFile() . "\r\n" .
' on line ' . $ex->getLine() . "\r\n" .
'</pre>';
}

// site notifcations

$emailNotify['TO'] = site::$adminEma il;
$emailNotify['CC'] = site::$adminEma il;
$emailNotify['BCC'] = '';

// get relative font sizes for the browser

require_once site::$classDir ectory . 'browser.class. php';

$browser = browser::getIns tance();
$sessionFonts = $browser->getFonts();

// user interaction

require_once site::$classDir ectory . 'user.class.php ';

$logOut = isset($_REQUEST['logOut']);

if ($logOut)
{
user::reset();
session_unset() ;
session_destroy ();
header('locatio n:' . site::$uri);
exit;
}
?>

i'm using php 5, so if you are using a prior version, just adjust the
static
interfaces on the site class appropriately. don't know what i mean? post
that as another question here. here is my site object:

<?
class site
{
public static $adminEmail = '';
public static $classDirectory = '';
public static $cssDirectory = '';
public static $currentPage = '';
public static $description = '';
public static $errorLogFile = '';
public static $fontDirectory = '';
public static $homePage = '';
public static $host = '';
public static $htdocsDirector y = '';
public static $imagesDirector y = '';
public static $includeDirecto ry = '';
public static $jscriptDirecto ry = '';
public static $lastSecurityCo de = '';
public static $logo = '';
public static $mailDropDirect ory = '';
public static $popUpAttribute s = '';
public static $rootDirectory = '';
public static $securityCode = '';
public static $title = '';
public static $uploadBaseDire ctory = '';
public static $uri = '';

private function __clone(){}

private function __construct(){}

private static function getSecurityCode ()
{
$alphabet = '2347ACEFHJKLMN PRTWXYZ'; // removed those that
look too similar
$alphabetLength = strlen($alphabe t) - 1;
self::$security Code = '';
for ($i = 0; $i < 6; $i++)
{
self::$security Code .= $alphabet[mt_rand(0, $alphabetLength )];
}
$_SESSION['securityCode'] = self::$security Code;
if (!self::$lastSe curityCode){ self::$lastSecu rityCode =
self::$security Code; }
}

public static function initialize()
{
self::$lastSecu rityCode = $_SESSION['securityCode'];
self::getSecuri tyCode();
}
}
?>

the other classes mentioned in the site.cfg.php are one's that i won't get
in to. i included this one so you could see how i set my important paths
and
how easy this all is to maintain. it is light-weight, manageable,
scaleable,
and highly flexible.

hth,

me
Steve:

Can I just put 'relative.path. php' in php.ini for the auto_prepend_fi le?
That would save a lot of time.
Apr 2 '07 #9
"Steve" <no****@example .comwrote in message
news:tt******** ****@newsfe12.l ga...
>
"Paul" <lo*@invalid.co mwrote in message
news:8h******** **********@bign ews3.bellsouth. net...
|I am taking over an existing app and having trouble understanding their
| references.
|
| They have encapsulated Pear packages in the directory structure like:
| /site
| /site/html/Pear.php
| /site/html/Sigma.php
| /site/html/Common.php
| /site/html/Quickform.php
| /site/html/Quickform/
| /site/Mail/mail.php
| /pages/page1.php
|
| At the top of /site/html/Quickform.php they put:
| ini_set('includ e_path','.:..') ;
| ...
| require_once('H TML/Common.php');

dude paul, i could have sworn i gave you a fix for this! just edit the php
ini file. you need to create a file called 'relative.path. php'. and put it
in your php include path (that you are soon to quick fucking around with
using ini_set). that file has this code in it:

<?
$parsedUri = dirname($_SERVE R['PHP_SELF']);
$parsedUri .= substr($parsedU ri, -1) != '/' ? '/' : '';
$relativeUri = str_replace('/', '', $parsedUri);
$relativePath = strlen($parsedU ri) - strlen($relativ eUri) - 1;
if ($relativePath < 0){ $relativePath = 0; }
$relativePath = str_repeat('../', $relativePath);
if (!$relativePath ){ $relativePath = './'; }
?>

then i'd put this at the beginning of *EVERY* php file your site has:

<?
require_once 'relative.path. php';
?>

i'd remove every instance of ini_set('includ e_path', '.:..') that i saw.
that is a horrible way to get the desired effect and the programmer should
summarily be drawn and quartered. this method requires that the file
*always* be a relative distance for what you're including. it could also
severly fuck up a script that includes another and then tries to include
another...becau se each is setting the include_path! further, it doesn't
allow you to reuse the known relativity to call other folders for
inclusion
like classes, common functions, whatever. this scenario requires *all*
includes to be in one folder. not very flexible, is it!

you'll notice that 'relative.path. php' creates a variable called
$relativePath. you'll also notice that it is compatible with all versions
of
php...such that you can use it on a server that runs both php 4 or php 5.
the variable points to the root of your web application. once you know
that,
you can merrily jump about. anyway, your code would become:

<?
require_once 'relative.path. php';
require_once $relativePath . 'HTML/Common.php';
?>

now it doesn't matter where your script is put in your directory
structure.
as it is, your code doesn't work because ini_set('includ e_path','.:..')
isn't setting a valid path. the best solution would be to further abstract
your directory structure. here's what i put at the top of *EVERY* script
of
my own:

<?
$pageTitle = "Welcome";
$fullHeader = true;
$securityEnable d = true;
require_once 'relative.path. php';
require_once $relativePath . 'site.cfg.php';
require_once site::$includeD irectory . 'head.inc.php';
?>

notice the use of the static site::$includeD irectory interface?
'site.cfg.php' configures the path. if i had a common header that should
be
shown on a page (as i have in the above ficticious page), i could now
include it no matter where either the header nor the including page
existed.
get the idea?

i have a configuration script called 'site.cfg.php'. it sets paths into
variables. so, when you implement the site, you can put your files all
over
the gawd damned place and manage it all in one spot. the rest of your
scripts couldn't care less how crazy you go. they reference variables.
here's my site.cfg.php script:

<?
ini_set('displa y_errors' , true );
ini_set('error_ reporting' , E_ALL & E_ERROR & E_WARNING );
ini_set('max_ex ecution_time' , 0 );
ini_set('memory _limit' , '100M' );

session_start() ;

// site basic information

$rootDirectory = '/var/www/html/dev/';

require_once $rootDirectory . 'classes/site.class.php' ;

site::initializ e();

site::$rootDire ctory = $rootDirectory;
site::$uri = 'http' . ($securityEnabl ed ? 's' : '') .
'://' . $_SERVER['HTTP_HOST'];
site::$uri = 'http://' . $_SERVER['HTTP_HOST'] . '/';
site::$uploadBa seDirectory = site::$rootDire ctory . 'data/';
site::$mailDrop Directory = site::$rootDire ctory . 'data/mail/';
site::$adminEma il = Web Site Administrator
<no****@example .com>';

site::$title = 'SAMPLE WEB SITE;
site::$descript ion = 'A SIMPLE PROVING GROUND';

site::$currentP age = basename($_SERV ER['PHP_SELF']);

site::$classDir ectory = site::$rootDire ctory . 'classes/';
site::$cssDirec tory = site::$uri . 'css/';
site::$host = 'tccc';
site::$errorLog File = site::$rootDire ctory . site::$host .
'.errors.log';
site::$fontDire ctory = '/var/www/fonts/';
site::$homePage = site::$uri . 'index.php';
site::$htdocsDi rectory = site::$rootDire ctory;
site::$imagesDi rectory = site::$uri . 'images/';
site::$includeD irectory = site::$rootDire ctory . 'inc/';
site::$jscriptD irectory = site::$uri . 'jscript/';
site::$logo = site::$imagesDi rectory . 'logo.jpg';
site::$popUpAtt ributes = 'addressbar=0, channelmode=0, dependent=1,
directories=0, fullscreen=0, location=0, menubar=0, resizable=1, status=0,
titlebar=0, toolbar=0';

// common php functionality

require_once site::$includeD irectory . 'functions.inc. php';

// source code security (disables 'view source' from right-click)

$enableContextM enu = true;

// site database information

require_once site::$classDir ectory . 'db.class.php';
try
{
db::connect('lo calhost', 'user', 'password', 'db');
} catch (exception $ex) {
print "<pre>\r\n" . $ex->getMessage() . "\r\n" .
' in file ' . $ex->getFile() . "\r\n" .
' on line ' . $ex->getLine() . "\r\n" .
'</pre>';
}

// site notifcations

$emailNotify['TO'] = site::$adminEma il;
$emailNotify['CC'] = site::$adminEma il;
$emailNotify['BCC'] = '';

// get relative font sizes for the browser

require_once site::$classDir ectory . 'browser.class. php';

$browser = browser::getIns tance();
$sessionFonts = $browser->getFonts();

// user interaction

require_once site::$classDir ectory . 'user.class.php ';

$logOut = isset($_REQUEST['logOut']);

if ($logOut)
{
user::reset();
session_unset() ;
session_destroy ();
header('locatio n:' . site::$uri);
exit;
}
?>

i'm using php 5, so if you are using a prior version, just adjust the
static
interfaces on the site class appropriately. don't know what i mean? post
that as another question here. here is my site object:

<?
class site
{
public static $adminEmail = '';
public static $classDirectory = '';
public static $cssDirectory = '';
public static $currentPage = '';
public static $description = '';
public static $errorLogFile = '';
public static $fontDirectory = '';
public static $homePage = '';
public static $host = '';
public static $htdocsDirector y = '';
public static $imagesDirector y = '';
public static $includeDirecto ry = '';
public static $jscriptDirecto ry = '';
public static $lastSecurityCo de = '';
public static $logo = '';
public static $mailDropDirect ory = '';
public static $popUpAttribute s = '';
public static $rootDirectory = '';
public static $securityCode = '';
public static $title = '';
public static $uploadBaseDire ctory = '';
public static $uri = '';

private function __clone(){}

private function __construct(){}

private static function getSecurityCode ()
{
$alphabet = '2347ACEFHJKLMN PRTWXYZ'; // removed those that
look too similar
$alphabetLength = strlen($alphabe t) - 1;
self::$security Code = '';
for ($i = 0; $i < 6; $i++)
{
self::$security Code .= $alphabet[mt_rand(0, $alphabetLength )];
}
$_SESSION['securityCode'] = self::$security Code;
if (!self::$lastSe curityCode){ self::$lastSecu rityCode =
self::$security Code; }
}

public static function initialize()
{
self::$lastSecu rityCode = $_SESSION['securityCode'];
self::getSecuri tyCode();
}
}
?>

the other classes mentioned in the site.cfg.php are one's that i won't get
in to. i included this one so you could see how i set my important paths
and
how easy this all is to maintain. it is light-weight, manageable,
scaleable,
and highly flexible.

hth,

me
Steve - this seems to be working on files EXCEPT those deeper in
directories, for example, files within:
/site/html/Quickform/

throw the error:
"Warning: main(HTML/Common.php) [function.main]: failed to open stream: No
such file or directory in C:\site\HTML\Qu ickForm\element .php on line 22"

Line 22 is:
require_once('H TML/Common.php');

There are also directoryies under /site/html/Quickform/, like
/site/html/Quickform/Renderer/
/site/html/Quickform/Rules/

So I need it work for those as well.

Any ideas? I think I/you/we am very close!
Apr 2 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1877
by: Ramprasad A Padmanabhan | last post by:
I know it is a dummies question, But I am not able to find it on the php manual. Can anyone tell me How to set the include_path in php thanks Ram
1
6366
by: webguynow | last post by:
I recently read a forum posting on codewalkers.com regarding PEAR on a shared host and the poster, mentioned 3 methods to assign an include_path using htaccess. ( Only the 2nd I'm familiar with - so the 1st and 3rd could use some explaining ) you can use .htaccess files to overwrite php's include_path for your site.
2
2220
by: Chuck Anderson | last post by:
My shared host used to have Php configured such that I could place a php.ini file into any directory on my site and that was the php.ini file that the Php cgi would use when it ran scripts. Since upgrading to Php5.1 that is no longer possible (not allowed in Php5.1 (?) ). Anyway, ... this was a very handy way for me to set the include path so that I could keep files with sensitive data (e.g., database usernames, passwords) out of the...
0
1877
by: Bastien Continsouzas | last post by:
I am trying to set the include path for SimpleTest under Eclipse I have the following config : Eclipse : 3.2.0 PHPEclipse 1.1.8 SimpleTest plugin : 0.2.1 I ran a test I found on the SimpleTest plugin page and it worked fine http://simpletest.org/en/extension_eclipse.html
9
2399
by: Charles Crume | last post by:
Hello Everyone; My site was hacked the other day -- someone was able to rename my index.shtml file and put their own index.html file on my server. Not sure how it was done, but looking through the log file, I found a lots and lots of entries where an "include_path" parameter was included in the URL of the PHP page, as shown below: 69.94.36.155 - - "GET...
2
1724
by: Rob Wilkerson | last post by:
Hey all - I'm trying to create a developer-friendly environment on my production server. By that, I mean an environment where developers don't need to worry about certain things. Among those is the include path. I have a "core" include_path set in php.ini, but most projects will require an include path of their own _in addition to_ the global include_path. Ideally, I'd like to script this directly into the virtual host configuration...
0
1166
by: JRough | last post by:
I have this at the top of the file include './includes/config.inc.php'; include $include_path.'dates.inc.php'; include $include_path.'auction_types.inc.php'; include $include_path.'countries.inc.php'; include $include_path.'datacheck.inc.php'; include $include_path.'wordfilter.inc.php'; include $include_path.'converter.inc.php';
4
3809
by: Gordon | last post by:
Is it possible in, say, a .htaccess file, to append additional paths to the php include_path without knowing what the value of include_path is beforehand? I want to add an absolute path to a directory and it's subdirectories from a .htaccess file, but I don't want to have to encode the entire current value of it and append my own path as that would mean having to change it every time it changes in php.ini or the code is deployed on a...
0
4285
by: mukeshrasm | last post by:
Hi! I want to use phpmailer class to send mail using smtp.I have downloaded the phpmailer and then i followed it's README file where it is mentioned that "Copy class.phpmailer.php into your php.ini include_path. If you are using the SMTP mailer then place class.smtp.php in your path as well", but I don't know where to paste the class.phpmailer.php into my php.ini include_path. In my php.ini file the include path is commented and it is like ...
0
8269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8203
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8711
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8642
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7203
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5576
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4206
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1515
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.