PHP Code:
// 1 of 2 attempts to get the WAP browser to flush the cache
// header("Content-type: text/vnd.wap.wml"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache");
echo "";
echo ". " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
echo "\n\n"; ?>
// 2 of 2 attempts to get the WAP browser to flush the cache
//
$Uid = 'ftp_user'; $Upw = 'ftp_password'; $ftp_server = 'some_ftp_server';// this should be your ftp server $conn_id = ftp_connect($ftp_server); $login_result = ftp_login($conn_id, $Uid, $Upw);
echo "" ; // .. in case we needed reminding echo "
"; // if ((!$conn_id) || (!$login_result)) // need a successful connect and login {
echo "FTP connection failed!";
echo "
";
echo $login_result;
exit;
}
else
{ $dir=ftp_pwd($conn_id); $list=Array();// define an array $list=ftp_rawlist($conn_id, "$dir");// run a raw directory listing and store in array
// $i= 0;// initialise (element) counter variable $files= 0;// initialise file counter variable $dirs** = 0;// initialise directory counter variable
// while ( $list[$i] )// .. loop round array.. {
if( substr($list[$i], 0, 1 ) == "-" ) { $files++; }// look for real files elseif( substr($list[$i], 0, 1 ) == "d" ) { $dirs++;} // look for directories $i++;// incr element counter }
print htmlspecialchars($Uname);// and display the results ! print "
";
print "User=$Uid
$filesfile(s)
$dirsdir(s)"; ftp_close($conn_id);
} ?>
No comments:
Post a Comment