Initial Checkin.
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
$captchaText = sha1(microtime());
|
||||
$captchaText = base64_encode($captchaText);
|
||||
$captchaText = substr($captchaText, 1, 5);
|
||||
|
||||
$_SESSION['key'] = strtolower($captchaText);
|
||||
|
||||
$fonts = ["cheapink.ttf"];
|
||||
$fontsizes = array(25);
|
||||
$yCorr = array(25);
|
||||
|
||||
$img = ImageCreateFromPNG('img/captcha.png');
|
||||
$color = ImageColorAllocate($img, 40, 40, 40);
|
||||
|
||||
$index = rand(0, count($fonts)-1);
|
||||
$ttf = 'fonts/' . $fonts[$index];
|
||||
$ttfsize = $fontsizes[$index];
|
||||
|
||||
$angle = rand(2, 6);
|
||||
$t_x = rand(10, 50);
|
||||
$t_y = 24 + $yCorr[$index];
|
||||
|
||||
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Accept-Ranges: bytes");
|
||||
header("Content-type: image/png");
|
||||
ImageTtfText($img, $ttfsize, $angle, $t_x, $t_y, $color, $ttf, $captchaText);
|
||||
ImagePNG($img);
|
||||
ImageDestroy($img);
|
||||
Reference in New Issue
Block a user