Crew algemeen |
|
Hallo iedereen,
Ik wou een soort van WebFTP maken (aangezien deze er niet veel zijn, en om in te bouwen in een eigen CP ;)).
Er is echter een bug -volgens php.net klopt het-:
Output:
Citaat: 220- Welcome @ GDX^'s FTP server!
220 Enjoy your stayÂ
331 Password required for anonymous
230 User successfully logged in.
426 Connection timed out, aborting transfer
De laattijd is ZEER hoog (tot timeout). Code:
<?php
echo <<<STARTPAGE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
STARTPAGE;
$sock = fsockopen ("127.0.0.1", 21, $errno, $errstr, 1);
fwrite ($sock, "user anonymous\r\n");
fwrite ($sock, "pass \r\n");
//fwrite ($sock, "help\r\n");
fwrite ($sock, "bye");
while(!feof($sock)) // <== bug zit hier (zonder die regel gaat alles goed!)
$output .= fgets($sock, 64);
fclose ($sock);
echo <<<ENDPAGE
$output
</body>
</html>
ENDPAGE;
?>
<?php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> STARTPAGE; $sock = fsockopen ("127.0.0.1", 21, $errno, $errstr, 1); fwrite ($sock, "user anonymous\r\n"); //fwrite ($sock, "help\r\n"); while(!feof($sock)) // <== bug zit hier (zonder die regel gaat alles goed!) $output .= fgets($sock, 64); $output </body> </html> ENDPAGE; ?>
Log van FTP server:
Citaat: 17:04:52.535 [2916] Client connected from 127.0.0.1.
17:04:52.535 [2916] 220- Welcome @ GDX^'s FTP server! 220 Enjoy your stayÂ
17:04:52.545 [2916] user anonymous
17:04:52.545 [2916] 331 Password required for anonymous
17:04:52.545 [2916] PASS
17:04:52.545 [2916] 230 User successfully logged in.
17:04:55.239 [2988] Client disconnected from 127.0.0.1.
17:04:55.239 [2988] 426 Connection timed out, aborting transfer
17:05:24.411 [3916] Client disconnected from 127.0.0.1.
17:05:24.421 [3916] 426 Connection timed out, aborting transfer
17:09:53.999 [2916] 426 Connection timed out, aborting transfer
17:09:53.999 [2916] Client disconnected from 127.0.0.1.
Greetz,
GDX^
|