maik15
18-10-2005, 18:22
Hi,
habe leider schon wieder eine frage...
Ich will über php eine datei auf dem ftp löschen.
habe bei www.php.net diesen tag gefunden: "ftp_delete(int ftp_stream, string path)".
"string path" ist die datei, aber was ist "int ftp_stream"?
Ich lasse mir über dieses script einen ordnerinhalt ausgeben:
$verz=opendir ('.');
while ($file = readdir ($verz)) {
if($file != "." && $file != "..") {
$typshow = filetype($file);
$ft = str_replace(".", "", strstr($file,"."));
if ($typshow == "dir" and $file != "icons"){
if($typshow == "dir") {
echo "<td class=\"icon\"><img src=\"icons/dir.gif\" border=\"0\" align=\"center\"></td>";
}
else {
echo "<td class=\"icon\"><img src=\"icons/$ft.gif\" border=\"0\" align=\"center\"></td>";
}
echo "<td class=\"link\" colspan=\"2\"><a class=\"file\" href=\"?test=$file\">$file</a><br></td></tr><tr>";
$file2 = @$_REQUEST['test'];
if (!empty($file2) and $file2 == $file){
echo "\t<ul>\r\n";
if ($handle2 = @opendir($file2)) {
while (false != ($file1 = readdir($handle2))) {
if ($file1 != "." && $file1 != "..") {
$typshow1 = filetype($file2.'/'.$file1);
$ft1 = str_replace(".", "", strstr($file1,"."));
if ($ft != "PHP"){
if($typshow1 == "dir") {
echo "<td class=\"icon\"><td class=\"icon\"><img src=\"icons/dir.gif\" border=\"0\" align=\"center\"></td>";
}
else {
echo "<td class=\"icon\"><td class=\"icon\"><img src=\"icons/$ft1.gif\" border=\"0\" align=\"center\"></td>";
}
echo "<td class=\"link\"><a class=\"file\" href=\"$file2/$file1\">$file1</a><br></td></tr><tr>\r\n";
}
}
}
closedir($handle2);
}
echo "\t\r\n";
}
}
}
}
closedir($verz);
das sieht dann in etwa so aus wie bei apache, bvloß mit dem jeweiligen bild davor, also für ne *.txt ein zettel...
nun wil ich hinter jede datei (und ordner) einen link setzen, der diese dann döscht. geht das?
Gruß
Maik
habe leider schon wieder eine frage...
Ich will über php eine datei auf dem ftp löschen.
habe bei www.php.net diesen tag gefunden: "ftp_delete(int ftp_stream, string path)".
"string path" ist die datei, aber was ist "int ftp_stream"?
Ich lasse mir über dieses script einen ordnerinhalt ausgeben:
$verz=opendir ('.');
while ($file = readdir ($verz)) {
if($file != "." && $file != "..") {
$typshow = filetype($file);
$ft = str_replace(".", "", strstr($file,"."));
if ($typshow == "dir" and $file != "icons"){
if($typshow == "dir") {
echo "<td class=\"icon\"><img src=\"icons/dir.gif\" border=\"0\" align=\"center\"></td>";
}
else {
echo "<td class=\"icon\"><img src=\"icons/$ft.gif\" border=\"0\" align=\"center\"></td>";
}
echo "<td class=\"link\" colspan=\"2\"><a class=\"file\" href=\"?test=$file\">$file</a><br></td></tr><tr>";
$file2 = @$_REQUEST['test'];
if (!empty($file2) and $file2 == $file){
echo "\t<ul>\r\n";
if ($handle2 = @opendir($file2)) {
while (false != ($file1 = readdir($handle2))) {
if ($file1 != "." && $file1 != "..") {
$typshow1 = filetype($file2.'/'.$file1);
$ft1 = str_replace(".", "", strstr($file1,"."));
if ($ft != "PHP"){
if($typshow1 == "dir") {
echo "<td class=\"icon\"><td class=\"icon\"><img src=\"icons/dir.gif\" border=\"0\" align=\"center\"></td>";
}
else {
echo "<td class=\"icon\"><td class=\"icon\"><img src=\"icons/$ft1.gif\" border=\"0\" align=\"center\"></td>";
}
echo "<td class=\"link\"><a class=\"file\" href=\"$file2/$file1\">$file1</a><br></td></tr><tr>\r\n";
}
}
}
closedir($handle2);
}
echo "\t\r\n";
}
}
}
}
closedir($verz);
das sieht dann in etwa so aus wie bei apache, bvloß mit dem jeweiligen bild davor, also für ne *.txt ein zettel...
nun wil ich hinter jede datei (und ordner) einen link setzen, der diese dann döscht. geht das?
Gruß
Maik