PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
if (!ereg('/$', $HTTP_SERVER_VARSї'DOCUMENT_ROOT']))
$_root = $HTTP_SERVER_VARSї'DOCUMENT_ROOT'].'/';
else
$_root = $HTTP_SERVER_VARSї'DOCUMENT_ROOT'];
It seems to work fine when i upload it to a server (running UNIX, Apache)... but when i try it on my local server, the DOCUMENT_ROOT fails to produce anything... I'm running WindowsXP with IIS5...
ok, looking back at previous posts, it look like IIS doesn't set the DOCUMENT_ROOT variable, so you're going to have to set it yourself. So the code works on both servers you could do something like,
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$_SERVER['DOCUMENT_ROOT'] = 'whatever/the/docroot/is';
}
Sure, putting it straight into $_root works too. Using an ereg to check the last char of a string is over the to as it has to invoke the regular expression engine which is too expensive for something a simple as that. A substr($_SERVER['DOCUMENT_ROOT'], -1) will get you the last character. I've not used any rtf editors myself, but there's a few threads on this site that discuss the merits of them, try a search for 'htmlarea' as that's one that's discussed...i think