includes/plain.button.php: PHP 8.x fixes just for fun
--- a/includes/plain.button.php
+++ b/includes/plain.button.php
@@ -5,7 +5,7 @@
include("../config.php");
unset($_SESSION[$sitekey.'_digit']);
-$image = imagecreate(120, 30);
+$image = imagecreate(240, 60);
$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
$gray = imagecolorallocate($image, 0xC0, 0xC0, 0xC0);
@@ -13,11 +13,11 @@
srand((double)microtime()*1000000);
unset($digit, $cnum);
-for ($i = 0; $i < 30; $i++) {
- $x1 = rand(0,120);
- $y1 = rand(0,30);
- $x2 = rand(0,120);
- $y2 = rand(0,30);
+for ($i = 0; $i < 60; $i++) {
+ $x1 = rand(0,240);
+ $y1 = rand(0,60);
+ $x2 = rand(0,240);
+ $y2 = rand(0,60);
imageline($image, $x1, $y1, $x2, $y2 , $gray);
}
@@ -25,11 +25,11 @@
$cnum[$i] = rand(0,9);
}
-
+$x = null;
for ($i = 0; $i < 5; $i++) {
- $fnt = rand(3,5);
- $x = $x + rand(12 , 20);
- $y = rand(7 , 12);
+ $fnt = rand(6,10);
+ $x = $x + rand(24 , 40);
+ $y = rand(14 , 24);
imagestring($image, $fnt, $x, $y, $cnum[$i] , $darkgray);
}
@@ -38,7 +38,7 @@
$_SESSION[$sitekey.'_digit'] = md5($sitekey.$digit);
header('Content-type: image/png');
imagepng($image);
-imagedestroy($image);
+unset($image);
exit( );
?>