Get path
Hej i min menu har jeg problemer når jeg kommer ind i en mappe med Dir. så kan den ikke selv finde ud af at sætte meppens navn ind ekswww.something.dk/test/index.php
www.something.dk/test/error/jo.php <den kan ikke selv sætte mappe navn ind og derfor error.
her er min kode jeg har sat upload/ ind for at den kan finde indholdet af den.
Siden ligger http://www.webhosteu.com/test
<?
session_start();
include("../setup/server.php");
DB::Conn("open");
?>
<html>
<head>
<title>Untitled Document</title>
<script>
function pokazi(dir){
x=document.getElementById(dir);
if(x.style.display == "none"){
x.style.display = "";
}else{
x.style.display = "none";
}
}
</script>
</head>
<body>
<center>
<table width="800" height="600" border="1" cellspacing="0" cellpadding="0" bgcolor="#CCCCCC">
<tr>
<td height="25" colspan="4">
1
</td>
</tr>
<tr>
<td colspan="2" rowspan="3" height="575">
<table width="200" height="575" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="200" height="575" valign="top">
<?php
$path= "../test/";
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if(is_dir("$path".$file)){
echo "<div style=\"padding-left: 2px; margin: 0px;\" >";
echo "|-<b><a href=\"#\" onClick=pokazi(\"$file\")>$file</a></b><br />\n";
$id="$file";
dirT("$path$file/",$id);
}else{
?><a href="?open=<? echo "$file\n"; ?>"><? echo "$file<br />\n";?></a><?
}
}
}
echo "</div>";
closedir($handle);
}
function dirT($path,$id){
echo "<div style=\"padding-left: 2px; margin: 2px; display:none \" id=\"$id\">";
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if(is_dir("$path".$file)){
echo "<div style=\"padding-left: 10px; margin: 2px; \" >";
echo "|-<a href=\"#\" onClick=pokazi(\"$file\")>$file</a><br />\n";
$id="$file";
dirT("$path$file/",$id);
}else{
?><a href="upload/<? echo "$file"; ?>"><? echo " --$file<br />\n";?></a><?
}
}
}
echo "</div>";
closedir($handle);
}
echo "</div>";
}
?>
</td>
</tr>
</table>
