推薦:PHP上傳文件的代碼動態網站開發中,常用的PHP上傳文件的代碼實例。
以下為引用的內容:
<html>
<head>
<me
以下為引用的內容:
<?php // ------------------------------------------------- //| * 文件 validate_image.php //| * 功能 實現網站登陸驗證碼 //| * 版本 1.0.0 //| * 日期 2005-4-1 //| * 作者 西北狼 QQ 500784 cokeyang at hotmail.com //| * 版權 http://www.adibaby.com[暫時關閉] //| * 使用方法: //| 預先在支持GD庫的做好一些圖片,推薦使用GIF格式,文件名與圖片里 //| 面的里面的數字一致,將圖片放入一個文件夾。設置CONFIG里面的數據. //| 引用 <IMG SRC="{ filepath }/validate_image.php"> //| 驗證頁面對比 //| $_COOKIE['validate'] == md5($_POST['input']) //|==================CONFIG START=================== $image_path="numimage";// 圖片文件路徑 后面沒有'/' $image_ext ="gif";// 圖片文件擴展名 //===================CONFIG END===================== $imagelist = array(); if ($handle =opendir($image_path)) { while (false !== ($file =readdir($handle))) { $filename =explode(".",$file); $imagelist[] = $filename[0]; unset($filename); } closedir($handle); unset($imagelist[0]); unset($imagelist[1]); } srand((float)microtime()*103E//| 引用 <IMG SRC="{ filepath }/validate_image.php"> //| 驗證頁面對比 //| $_COOKIE['validate'] == md5($_POST['input']) //|==================CONFIG START=================== $image_path="numimage";// 圖片文件路徑 后面沒有'/' $image_ext ="gif";// 圖片文件擴展名 //===================CONFIG END===================== $imagelist = array(); if ($handle =opendir($image_path)) { while (false !== ($file =readdir($handle))) { $filename =explode(".",$file); $imagelist[] = $filename[0]; unset($filename); } closedir($handle); unset($imagelist[0]); unset($imagelist[1]); } srand((float)microtime()*10000000); $filename=$imagelist[array_rand($imagelist)]; setcookie("validate",md5($filename)); header('Content-type: application/'.$image_ext); echo implode('',file($image_path."/".$filename.".".$image_ext)); ?>
|
分享:實例學習PHP如何實現在線發郵件當使用者在參觀網頁時,有時想 Email 給 Webmaster 但是再執行 Email 程式總是不方使,使用者在按下 mailto:abc@mb5u.com 還要花段時間打開自己這兒的 Outlook 豈不麻煩。這時,若是 Homepage