Browse code

includes/plain.button.php: PHP 8.x fixes just for fun

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