![]() |
Re: [PHP] Verzeichnisse verdoppeln sich in Links nach Umleit
Zitat:
bzw. wie sieht denn die URL der Seite aus? |
Re: [PHP] Verzeichnisse verdoppeln sich in Links nach Umleit
Zitat:
Zitat:
![]() Ich habe es etwas umgebaut:
Code:
$path = $_GET['path']; // Ist jetzt path=Artikel
if ((@strpos(strtolower($path), strtolower("privat")) > 0)) { header('Location: /Privat'); } if ($path == '') { $path = '.'; } else { $path = "./".$path; } $dirs = listDirs($path.'/'); $files = listFiles($path.'/'); if (!file_exists($path)) { header('Location: '.$path); } if ($path != ".") { foreach($defaultPages as $file) { if (file_exists($path."/".$file)) { header('Location: '.$path."/".$file); exit; } } } if ($path != '.') { echo ' [b]Inhalt von: '.str_replace("./", "", $path).'[/b]</p>'; }
Code:
Allerdings hat sich am Effekt nichts geändert. Es geht immer noch nicht nach dem Redirect. :(
$path = str_replace("./", "", $path);
echo '<table class="noborder">'; if ($path != '.') { echo "<tr><td class=\"noborder\"><a href=\"/index.php?path=".$parentDir."\">..</a></td><td class=\"noborder\"></td><td class=\"noborder\"></td></tr>\n"; } foreach ($dirs as $dir) { if (!in_array($dir, $forbiddenDirs)) { $tmpPath = str_replace(".", "", $path); $link = $tmpPath.'/'.$dir; echo "<tr><td class=\"noborder\"><a href=\"index.php?path=.".$link."\">".$dir."</a></td><td class=\"noborder\" align=\"center\">[DIR]</td><td class=\"noborder\" align=\"center\" width=150px>".date("Y-m-d H:i",filemtime("./".$link))."</td><td class=\"noborder\"</td></tr>\n"; } } foreach ($files as $file) { if (!in_array($file, $hiddenFiles)) { $size = number_format(ceil(filesize("./".$path.'/'.$file) / 1024), 0); echo "<tr><td class=\"noborder\"><a href=\"".$path."/".$file."\">".$file."</a></td><td class=\"noborder\" align=\"right\">".$size."k</td><td class=\"noborder\" align=\"center\" width=150px>".date("Y-m-d H:i",filemtime("./".$path."/".$file))."</td><td class=\"noborder\">".getTitleFromHTML("./".$path."/".$file)."</td></tr>\n"; } } echo '</table>'; |
Re: [PHP] Verzeichnisse verdoppeln sich in Links nach Umleit
Code:
Da geht irgendwas nicht :coder2:
Warning: opendir(./.Developer/~MyLicenses/) [function.opendir]: failed to open dir: No such file or directory in /var/www/l3s11195/html/data/dirlisting.php on line 16
Warning: readdir(): supplied argument is not a valid Directory resource in /var/www/l3s11195/html/data/dirlisting.php on line 19 Warning: closedir(): supplied argument is not a valid Directory resource in /var/www/l3s11195/html/data/dirlisting.php on line 27 Warning: opendir(./.Developer/~MyLicenses/) [function.opendir]: failed to open dir: No such file or directory in /var/www/l3s11195/html/data/dirlisting.php on line 36 Warning: readdir(): supplied argument is not a valid Directory resource in /var/www/l3s11195/html/data/dirlisting.php on line 39 Warning: closedir(): supplied argument is not a valid Directory resource in /var/www/l3s11195/html/data/dirlisting.php on line 47 Warning: Cannot modify header information - headers already sent by (output started at /var/www/l3s11195/html/data/dirlisting.php:16) in /var/www/l3s11195/html/index.php on line 38 Inhalt von: .Developer/~MyLicenses.. Copyright © Michael Puff Home | Kontakt | Website durchsuchen | Sitemap |
Re: [PHP] Verzeichnisse verdoppeln sich in Links nach Umleit
Liste der Anhänge anzeigen (Anzahl: 2)
Verfluchter Mist. Ich werde noch mal irre. Bin jetzt wieder beim alten Code. Ich hänge einfach mal die relevanten Dateien an.
|
Re: [PHP] Verzeichnisse verdoppeln sich in Links nach Umleit
Ich tippe einfach mal auf folgendes:
:arrow: Ich gebe ![]() :arrow: Der Webserver entdeckt daraufhin einwn DirectoryIndex der nicht im Verzeichnis liegt (sondern auf der obersten Ebene) :arrow: Die PHP Seite guckt nun nach und gibt reltive Links zu sich selbst aus. da sie ja im Stammverzeichnis liegt, ist das also "./Artikel/xyz.shtml" :arrow: Das kommt nun aber zurück als Antwort auf meine Anfrage nach "http://www.michael-puff.de/Artikel/" :arrow: Der Browser findet also unter "http://www.michael-puff.de/Artikel/" einen reltiven Link zu "./Artikel/xyz.shtml" :arrow: Der Browser bildet also die aboslute URL "http://www.michael-puff.de/Artikel/./Artikel/xyz.shtml" So einfach :mrgreen: Lösung: Entweder nicht noch das aktuelle Verzeichnis in den Links mitgeben oder absolute URL verwenden. Btw.: Du kannst im PHP-Script auch herausbekommen, welche URL ursprünglich aufgerufen wurde ;) |
Re: [PHP] Verzeichnisse verdoppeln sich in Links nach Umleit
Ja, genau so wird es wohl passieren. Das mit den absoluten URLs habe ich schon probiert, ist aber irgendwie in die Hose gegangen -- zumindest habe ich es nicht hinbekommen.
Zitat:
|
Re: [PHP] Verzeichnisse verdoppeln sich in Links nach Umleit
Versuchs mal so:
Code:
In den beiden a href hab ich mal das $path entfernt - könnte klappen ;)
foreach ($dirs as $dir)
{ echo '<tr>'; if (!in_array($dir, $forbiddenDirs)) { $link = 'index.php?path=/'.$dir; echo '<td class="noborder">[url="'.$link.'"]'.$dir.'[/url]</td> <td class="noborder" align="center">[DIR]</td> <td class="noborder" align="center" width=150px>'.date("Y-m-d H:i",filemtime($path.'/'.$dir)).'</td> <td class="noborder"</td>'; } echo '</tr>'; } foreach ($files as $file) { echo '<tr>'; if (!in_array($file, $hiddenFiles)) { $size = number_format(ceil(filesize($path.'/'.$file) / 1024), 0); echo '<td class="noborder">[url="/'.$file.'"]'.$file.'[/url]</td> <td class="noborder" align="right">'.$size.'k</td> <td class="noborder" align="center" width=150px>'.date("Y-m-d H:i",filemtime($path.'/'.$file)).'</td> <td class="noborder">'.getTitleFromHTML($path.'/'.$file).'</td>'; } echo '</tr>'; } |
Re: [PHP] Verzeichnisse verdoppeln sich in Links nach Umleit
Das hatte ich auch schon mal. Jetzt will er das Verzeichnis /Artikel/ öffnen und das macht opendir nicht mit. Das braucht wohl relative Pfade:
Zitat:
![]() Ich weiß jetzt zwar nicht, was ich genau gemacht habe, aber jetzt geht es. Mist zu voreilig. Habe mich verguckt. Geht doch nicht. Hat noch jemand eine Idee? Andere schaffen es doch auch. :roll: |
Re: [PHP] Verzeichnisse verdoppeln sich in Links nach Umleit
Wie müsste ich denn vorgehen, wenn ich meinen bisherigen Quellcode auf absolute Pfade umstellen wollte? Wenn ich den Code sehe, dann dreht sich bei mir nämlich schon alles.
|
Re: [PHP] Verzeichnisse verdoppeln sich in Links nach Umleit
Geht doch gerade wunderbar, oder nicht?
Ansonsten wäre mir noch eingefallen, dass du beim verlinken von Verzeichnissen den vollen Pfad angibt (da dort ja wieder das Skript zum Einsatz kommt) beim verlinken von Dateien aber den relativen Pfad (weil da ja direkt drauf verwiesen wird) |
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:57 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz