source: branches/dev/html/test/uehara/captcha/ajax_captcha/create_image.php @ 8

Revision 8, 728 bytes checked in by root, 17 years ago (diff)

new import

Line 
1<?php
2
3// セッションスタート
4session_start();
5
6// 画像イメージ生成
7// ランダムな文字列を生成
8$md5_hash = md5(rand(0,999));
9// 文字列を5桁にする
10$code = substr($md5_hash, 15, 5);
11// セッションに生成されたコードを保存
12$_SESSION["code"] = $code;
13
14$image = ImageCreate(120, 20); 
15
16// 色の定義
17$white = ImageColorAllocate($image, 255, 255, 255);
18$grey = ImageColorAllocate($image, 204, 204, 204);
19
20// 背景色
21ImageFill($image, 0, 0, $grey);
22
23// 生成したコードを表示
24ImageString($image, 5, 30, 3, $code, $white);
25
26// jpagで出力
27header("Content-Type: image/jpeg");
28ImageJpeg($image);
29ImageDestroy($image);
30
31exit;
32?>
Note: See TracBrowser for help on using the repository browser.