I need to get the full path of whatever folder my php file is in.
right now it's in http://www.schoolofdan.com/storage/
This is what I have so far, and it outputs the right info, but there has to be a better way
Code: Select all
$test = explode("/", $_SERVER['PHP_SELF']);
$test1 = $test[1];
$tester = "http://".$_SERVER['SERVER_NAME']."/".$test1."/";
foreach (glob("*.jpg") as $filename) {
echo "<a href='$filename'><img src='$filename' border='0'><a><br>";
echo "BBCODE - <input type=\"text\" name=\"sig\" value=\"[url=http://www.schoolofdan.com][img]".$tester.$filename."[/img][/url]\" size=\"50\"><br><br>";
}
Again, I'm getting the correct output, but there has to be something better. If I don't use explode I still get the index.php at the end. I don't want that.