Skip to content

Commit

Permalink
Update captcha.gif.php
Browse files Browse the repository at this point in the history
  • Loading branch information
rickbot-dot authored Jul 2, 2023
1 parent caefaaf commit ea131d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions captcha.gif.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
// Requires the GD library. //
//////////////////////////////////////////////////////////////////

$IP = __dir__;
session_start();
class Captcha {
public function generateCaptcha($width = 620, $height = 120, $characters = 14) {
$IP = __dir__;
// Define characters the CAPTCHA is allowed to use.
// Other characters will not be in the list.
// Characters other than non-accent Latin characters and Arabic numerals, such as the letter æ,
Expand All @@ -33,7 +33,7 @@ public function generateCaptcha($width = 620, $height = 120, $characters = 14) {
// Write the letters to the image
for ($i = 0; $i < strlen($_SESSION['captcha']); $i++) {
$textColor = imagecolorallocate($image, 100,100,100);
imagettftext($image, 40, rand(-20, 20), ($i * ($width / strlen($_SESSION['captcha']))) + rand(5, 10), rand(($height / 2) - 10, ($height / 2) + 10), $textColor, "$IP/captcha.ttf", $_SESSION['captcha'][$i]);
imagettftext($image, 40, rand(-20, 20), ($i * ($width / strlen($_SESSION['captcha']))) + rand(5, 10), rand(($height / 2) - 10, ($height / 2) + 10), $textColor, $IP . "/captcha.ttf", $_SESSION['captcha'][$i]);
}
// Make the image harder to read by bots.
for ($i = 0; $i < 10000; $i++) {
Expand Down

0 comments on commit ea131d4

Please sign in to comment.