note 94199 deleted from function.chdir by danbrown
| From: | danbrown@php.net | Date: | Wed, 21 Oct 2009 23:53:04 +0000 |
| Subject: | note 94199 deleted from function.chdir by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-161964@lists.php.net to get a copy of this message | ||
Note Submitter: Elias Rodrigues
----
<?php
// Changing to site's root directory
$dir = preg_replace("/^http:\/\/[a-z0-9_.-]+\//i", "",
$_SERVER["HTTP_REFERER"]);
$dir = explode("/", $dir);
$rootdir = "";
for($i = 0; $i < sizeof($dir) - 1; $i++)
$rootdir .= "../";
chdir($rootdir);
?>