Changeset 10464
- Timestamp:
- 2006/12/08 12:39:48 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
temp/trunk/html/test/uehara/captcha/ajax_captcha/create_image.php
r10448 r10464 1 1 <? 2 // ¥»¥Ã¥·¥ç¥ó¥¹¥¿¡¼¥È2 // セッションスタート 3 3 session_start(); 4 // ²èÁü¥¤¥á¡¼¥¸À¸À®4 // 画像イメージ生成 5 5 create_image(); 6 6 exit(); … … 8 8 function create_image() 9 9 { 10 // ¥é¥ó¥À¥à¤Êʸ»úÎó¤òÀ¸À®10 // ランダムな文字列を生成 11 11 $md5_hash = md5(rand(0,999)); 12 // ʸ»úÎó¤ò£µ·å¤Ë¤¹¤ë12 // 文字列を5桁にする 13 13 $security_code = substr($md5_hash, 15, 5); 14 // ¥»¥Ã¥·¥ç¥ó¤ËÀ¸À®¤µ¤ì¤¿¥³¡¼¥É¤òÊݸ14 // セッションに生成されたコードを保存 15 15 $_SESSION["security_code"] = $security_code; 16 16 17 // ¡¡¥¤¥á¡¼¥¸¥µ¥¤¥ºÄêµÁ17 // イメージサイズ定義 18 18 $width = 120; 19 19 $height = 30; … … 21 21 $image = ImageCreate($width, $height); 22 22 23 // ¿§¤ÎÄêµÁ23 // 色の定義 24 24 $white = ImageColorAllocate($image, 255, 255, 255); 25 25 $black = ImageColorAllocate($image, 0, 0, 0); 26 26 $grey = ImageColorAllocate($image, 204, 204, 204); 27 27 28 // ÇØ·Ê¿§28 // 背景色 29 29 ImageFill($image, 0, 0, $white); 30 30 31 // À¸À®¤·¤¿¥³¡¼¥É¤òɽ¼¨31 // 生成したコードを表示 32 32 ImageString($image, 3, 30, 3, $security_code, $black); 33 33 /* … … 39 39 //Tell the browser what kind of file is come in 40 40 header("Content-Type: image/jpeg"); 41 // jpag ¤Ç½ÐÎÏ41 // jpagで出力 42 42 ImageJpeg($image); 43 43 ImageDestroy($image);
Note: See TracChangeset
for help on using the changeset viewer.
