skip to main
|
skip to sidebar
ICE NoteBook
顯示具有
PHP Class
標籤的文章。
顯示所有文章
顯示具有
PHP Class
標籤的文章。
顯示所有文章
2008年8月1日 星期五
輕量的Pass_img程式
-- Chi_Passimg.php 程式碼如下 --- // 圖形驗証碼 By 二林網管 村仔 // 本程式獨立使用,呼叫時為
// 程式則產生圖形驗証碼,並將值寫在Session中 // 要檢驗時,只須將Session中存放的 $_session[Pass_img] 拿出來和您表單上的值核對即可
session_start(); $aa=new pass_img();//建立物件 $aa->show_str();//秀出驗証數字碼 class pass_img { var $pass; var $weight=70; var $height=24; function pass_img() { $t1=range('A', 'Z'); $t2=range(a,z); mt_srand((double)microtime()*1000000); $this->pass=$t1[mt_rand(0,25)].$t2[mt_rand(0,25)].sprintf("%04d",mt_rand(1,9999)); unset($_SESSION["Pass_img"]); session_register("Pass_img"); $_SESSION["Pass_img"]=$this->pass; } function show_str() { $size = "6"; // 字體大小0-6 $x = "5"; //字開頭 x 座標 $y = "3"; //字開頭 y 座標 $R = 255; //字的紅色值 $G = 15; //字的綠色值 $B = 15; //字的藍色值 $origImg = @imagecreate($this->weight,$this->height); $backgroundcolor = ImageColorAllocate($origImg,255,255,255); $textcolor = ImageColorAllocate ($origImg ,$R ,$G ,$B); Imagestring($origImg,$size,$x,$y,$this->pass,$textcolor); //加入干擾線(可不加) //Imageline($origImg,0,9,70,9,$textcolor); //x1,y1,x2,y2,color //加入干擾點(可不加) for($i=0;$i<100;$i++) { $randcolor = ImageColorallocate($origImg,rand(0,255),rand(0,255),rand(0,255)); imagesetpixel($origImg,rand()%$this->weight,rand()%$this->height,$randcolor); } //產生圖形 ImagePNG($origImg); ImageDestroy($origImg); } }
2008年7月22日 星期二
PHPMailer
如果公司沒有用PEAR的套件 那麼這個是不錯用的Mail工具 首先請先到官網下載
PHPMailer
解開壓縮後裡面會有一堆檔案 真正用到的只有 class.phpmailer.php class.smtp.php 放到想放的位置後就可以開始寫程式了,以下是我的範例
include_once("class.phpmailer.php"); $mail = new PHPMailer(); $mail->CharSet = "utf-8"; $mail->ContentType = "text/html"; $mail->From = "test@smtp.com.tw"; $mail->FromName = "List manager"; $mail->Host = "localhost"; $mail->Mailer = "smtp"; $mail->Subject = "HTML測試標題"; $body = 'Html code'; $mail->Body = $body; $mail->AddAddress('test@smtp.com.tw', 'ICE'); if (!$mail->Send()){ echo "False!!"; }else{ echo "True!!"; }
實做筆記: $mail->ErrorInfo;
可以利用上面的function取得錯誤資訊
較舊的文章
首頁
訂閱:
文章 (Atom)
關於我自己
Ic€
Taiwan
此網誌是為了年紀愈來愈大的我所創立的,感覺記憶力愈來愈差,所以乾脆把網路上搜尋到或者自己寫的東西做個記錄,以免以後需要時找不到,如果原文作者看到自己的文章感到不悅時,請盡速通知我,我會盡快刪除文章,感恩啦
檢視我的完整簡介
文章分類
AS3
ASP
ASP Class
Blog
CSS
Flash
int
Integer
Java
JavaScript
jQuery
Linux
MS SQL
PEAR
Perl
PHP
PHP Class
split
String
T-SQL
URL
Wamp
網誌存檔
▼
2010
(7)
▼
12月
(2)
ActionScript 3 - 使用loaderInfo.parameters取得傳入的參數
JavaScript - 使用SWFObject在HTML插入Flash
►
9月
(2)
►
6月
(1)
►
5月
(1)
►
2月
(1)
►
2009
(20)
►
10月
(2)
►
9月
(4)
►
8月
(1)
►
7月
(2)
►
5月
(1)
►
4月
(3)
►
3月
(1)
►
2月
(3)
►
1月
(3)
►
2008
(15)
►
11月
(2)
►
10月
(1)
►
9月
(2)
►
8月
(6)
►
7月
(4)
計數器
My Friends
ApurA's Yuujintyou
Jim Labs
shan711017的地盤
you are my amusement park
──═╪★完美的愛情使人意志薄弱 不完美的愛情讓人傷心難過
夏季含羞草
新‧夢想
日光節約時間
騎馬桶撞飛碟的部落