Browse code

3.5.6 efiction version

Jimako authored on 2024/03/09 16:09:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,44 @@
1
+<?php
2
+
3
+session_start();
4
+define("_BASEDIR", "../");
5
+include("../config.php");
6
+unset($_SESSION[$sitekey.'_digit']);
7
+
8
+$image = imagecreate(120, 30);
9
+
10
+$white    = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
11
+$gray    = imagecolorallocate($image, 0xC0, 0xC0, 0xC0);
12
+$darkgray = imagecolorallocate($image, 0x50, 0x50, 0x50);
13
+
14
+srand((double)microtime()*1000000);
15
+unset($digit, $cnum);
16
+for ($i = 0; $i < 30; $i++) {
17
+  $x1 = rand(0,120);
18
+  $y1 = rand(0,30);
19
+  $x2 = rand(0,120);
20
+  $y2 = rand(0,30);
21
+  imageline($image, $x1, $y1, $x2, $y2 , $gray);  
22
+}
23
+
24
+for ($i = 0; $i < 5; $i++) {
25
+$cnum[$i] = rand(0,9);
26
+}
27
+
28
+
29
+for ($i = 0; $i < 5; $i++) {
30
+ $fnt = rand(3,5);
31
+ $x = $x + rand(12 , 20);
32
+ $y = rand(7 , 12); 
33
+ imagestring($image, $fnt, $x, $y, $cnum[$i] , $darkgray); 
34
+}
35
+
36
+$digit = "$cnum[0]$cnum[1]$cnum[2]$cnum[3]$cnum[4]";
37
+
38
+$_SESSION[$sitekey.'_digit'] = md5($sitekey.$digit);
39
+header('Content-type: image/png');
40
+imagepng($image);
41
+imagedestroy($image);
42
+exit( );
43
+?> 
44
+