《php和mysql web development開發(fā)第20章源代碼》由會員分享,可在線閱讀,更多相關(guān)《php和mysql web development開發(fā)第20章源代碼(4頁珍藏版)》請在裝配圖網(wǎng)上搜索。
1、Lockup.php代碼如下:
;
//原始信息的地址,下載后用EXCEL打開就明白 了
$url=
if(!($contents=file_get_contents($url))){
die(failure to open.$url);
}
list($symbol,$quote,$date,$time)=explode(,,$contents);
echo $symbol.
2、":".$quote.
;
echo $date.
;
echo $url.
;
echo .$url.;
?>
directory_submit.html代碼如下:
3、>
無標(biāo)題文檔
Submit your site
Submit site
directory_submit.php代碼如下:
5、ostname=$url[host];
if(!($ip=gethostbyname($hostname))){
echo host for url dose not have valid ip;
exit;
}
echo "Host is at IP $ip
";
//做簡單的EMAIL測試
$email=explode(@,$email);
$emailhost=$email[1];
//在windows下沒有dns_get_xm()函數(shù),故下面在windows下須注釋掉
/* if(!dns_get_mx($emailhost,$mxhosts
6、arr)){
echo Email address is not at valid host;
exit;
} */
echo Email address is delivered via : ;
echo " ".$email[0].@.$email[1].
;
echo all submitted details are ok.
;
?>
ftp_mirror.php代碼如下:
7、$localfile=F:\ftpfile\http.rar;
$conn=ftp_connect($host);
if(!$conn){
echo Error:could not connect to ftp server
;
exit;
}
echo "Connected to $host.
";
@ $result=ftp_login($conn,$user,$password);
if(!$result){
echo "Error:could not log on as $user
";
exit;
}
echo "l
8、ogged in as $user
";
if(file_exists($localfile)){
$localtime=filemtime($localfile);
echo local file last updated : ;
echo date(G:i j-M-Y,$localtime);
echo
;
}
else{
$localtime=0;
}
if(file_exists($remotefile)){
echo "the remotefile is exists!".
;
}else{
echo the remo
9、tefile isn\t exists.
;}
$remotetime=ftp_mdtm($conn,$remotefile);
echo $remotetime.
;
if(!($remotetime>=0)){
echo can\t access remote file time.
;
$remotetime=$localtime+1;
}
else
{
echo remote file last updated : ;
echo date(G:i j-M-Y,$remotetime);
echo
;
}
if(!
10、($remotetime>$localtime)){
echo Local copy is up to date.
;
exit;
}
echo Getting file from server...
;
$fp=fopen($localfile,w);
if(!$success=ftp_fget($conn,$fp,$remotefile,FTP_BINARY)){
echo Error:Could not download file;
ftp_quit($conn);
exit;
}
fclose($fp);
echo File downloaded successfully;
ftp_close($conn);
?>