-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.php
executable file
·51 lines (43 loc) · 1.69 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
// Cria a imagem do capthe
$im = @imagecreatetruecolor(150, 70)
or die("Cannot Initialize new GD image stream");
// Preenche de cinza
$bg = imagecolorallocate($im, 255, 255, 255);
imagefill($im, 0, 0, $bg);
// Coloca os chanfros aleatorios na imagem
for($i=0;$i<1000;$i++) {
$lines = imagecolorallocate($im, rand(200, 220), rand(200, 220), rand(200, 220));
$start_x = rand(0,150);
$start_y = rand(0,70);
$end_x = $start_x + rand(0,5);
$end_y = $start_y + rand(0,5);
imageline($im, $start_x, $start_y, $end_x, $end_y, $lines);
}
$logo = imagecreatefrompng('logo.png');
$alt = rand(-130, -30);
$larg = rand(-130, -30);
imagecopy($im, $logo, $larg, $alt, 0, 0, 150 - $larg, 70 - $alt);
// Imputa as letrinhas
$letters = array_merge( range('A', 'Z') , range(2, 9) );
unset($letters[array_search('O', $letters)]);
unset($letters[array_search('Q', $letters)]);
unset($letters[array_search('I', $letters)]);
unset($letters[array_search('5', $letters)]);
unset($letters[array_search('S', $letters)]);
shuffle($letters);
$letters = array_slice($letters, 0, 4);
$secure_text = implode('', $letters);
$i = 0;
foreach ($letters as $letter) {
$text_color = imagecolorallocate($im, rand(0,100), rand(10,100), rand(0,100));
// imagestring($im, 10, 20+($i*25) + rand(-5, +5), 10 + rand(10, 30), $letter, $text_color);
imagefttext($im, 35, rand(-10, 10), 20+($i*30) + rand(-5, +5), 35 + rand(10, 30), $text_color, './font.ttf', $letter);
$i++;
}
header ("Content-type: image/png");
header('Pragma: no-cache');
header('Cache-Control: private, no-cache, no-cache="Set-Cookie", proxy-revalidate');
setcookie('ahctpac', md5($secure_text), time() + 1800, '/' );
imagepng($im);
imagedestroy($im);