Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <?php
- //require_once ("");
- $ftp_host = "localhost";
- $ftp_user = "";
- $ftp_password = "";
- //Connect
- echo "<br />Connecting to $ftp_host via FTP...";
- $conn = ftp_connect($ftp_host);
- $login = ftp_login($conn, $ftp_user, $ftp_password);
- //
- //Enable PASV ( Note: must be done after ftp_login() )
- //
- $mode = ftp_pasv($conn, TRUE);
- //Login OK ?
- if ((!$conn) || (!$login) || (!$mode)) {
- die("FTP connection has failed !");
- }
- echo "<br />Login Ok.<br />";
- //
- //Now run ftp_nlist()
- //
- $file_list = ftp_rawlist($conn, "-a /Ebola/Pubblic");
- foreach( $file_list as $n => $line)
- {
- if (preg_match("/([-dl])([rwxsStT-]{9})[ ]+([0-9]+)[ ]+([^ ]+)[ ]+(.+)[ ]+([0-9]+)[ ]+([a-zA-Z]+[ ]+[0-9]+)[ ]+([0-9:]+)[ ]+(.*)/", $line, $regs) == true)
- {
- // permissions number owner group size month day year/hour filename
- $listline[$n]["scanrule"] = "rule-1";
- $listline[$n]["dirorfile"] = "$regs[1]"; // Directory ==> d, File ==> -
- $listline[$n]["dirfilename"] = "$regs[9]"; // Filename
- $listline[$n]["size"] = "$regs[6]"; // Size
- $listline[$n]["owner"] = "$regs[4]"; // Owner
- $listline[$n]["group"] = "$regs[5]"; // Group
- $listline[$n]["permissions"] = "$regs[2]"; // Permissions
- $listline[$n]["mtime"] = "$regs[7] $regs[8]"; // Mtime -- format depends on what FTP server returns (year, month, day, hour, minutes... see above)
- }
- }
- echo
- "<table border=1>
- <!-- ----------------------- -->
- <tr>
- <td>Customer</td>
- <td><b>Akab update package</b></td>
- <td><b>Upload date</b></td>
- <td><b>Download date</b></td>
- </tr>
- <!-- ----------------------- -->";
- for($l =0; $l < count($listline); $l++ )
- {
- echo "<tr>";
- echo "<td>".$listline[$l]["owner"]."</td>";
- echo "<td>".$listline[$l]["dirfilename"]."</td>";
- echo "<td>".$listline[$l]["size"]."</td>";
- echo "<td>".$listline[$l]["mtime"]."</td>";
- echo "<tr>";
- }
- echo "</table>";
- ftp_close($conn);
- ?>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment