Changeset 10464


Ignore:
Timestamp:
2006/12/08 12:39:48 (20 years ago)
Author:
uehara
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • temp/trunk/html/test/uehara/captcha/ajax_captcha/create_image.php

    r10448 r10464  
    11<? 
    2 // ¥»¥Ã¥·¥ç¥ó¥¹¥¿¡¼¥È 
     2// セッションスタート 
    33session_start(); 
    4 // ²èÁü¥¤¥á¡¼¥¸À¸À®  
     4// 画像イメージ生成  
    55create_image(); 
    66exit();  
     
    88function create_image()  
    99{  
    10     // ¥é¥ó¥À¥à¤Êʸ»úÎó¤òÀ¸À® 
     10    // ランダムな文字列を生成 
    1111    $md5_hash = md5(rand(0,999));  
    12     // ʸ»úÎó¤ò£µ·å¤Ë¤¹¤ë  
     12    // 文字列を5桁にする  
    1313    $security_code = substr($md5_hash, 15, 5);  
    14     // ¥»¥Ã¥·¥ç¥ó¤ËÀ¸À®¤µ¤ì¤¿¥³¡¼¥É¤òÊݸ 
     14    // セッションに生成されたコードを保存 
    1515    $_SESSION["security_code"] = $security_code; 
    1616 
    17     //¡¡¥¤¥á¡¼¥¸¥µ¥¤¥ºÄêµÁ 
     17    // イメージサイズ定義 
    1818    $width = 120;  
    1919    $height = 30;   
     
    2121    $image = ImageCreate($width, $height);   
    2222 
    23     // ¿§¤ÎÄêµÁ  
     23    // 色の定義  
    2424    $white = ImageColorAllocate($image, 255, 255, 255);  
    2525    $black = ImageColorAllocate($image, 0, 0, 0);  
    2626    $grey = ImageColorAllocate($image, 204, 204, 204);  
    2727 
    28     // ÇØ·Ê¿§ 
     28    // 背景色 
    2929    ImageFill($image, 0, 0, $white);  
    3030 
    31     // À¸À®¤·¤¿¥³¡¼¥É¤òɽ¼¨ 
     31    // 生成したコードを表示 
    3232    ImageString($image, 3, 30, 3, $security_code, $black);  
    3333/* 
     
    3939    //Tell the browser what kind of file is come in  
    4040    header("Content-Type: image/jpeg");  
    41     // jpag¤Ç½ÐÎÏ  
     41    // jpagで出力  
    4242    ImageJpeg($image);  
    4343    ImageDestroy($image);  
Note: See TracChangeset for help on using the changeset viewer.