php switch _GET bitch case image header Content-Type image png _locati

 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
<?php
switch($_GET['bitch']){
case 'image':
header('Content-Type: image/png');
$_location = $db -> prepare('SELECT * FROM `locations` WHERE `id` = ?');
$_location -> execute([1]);
$location = $_location -> fetch();
$_actions = $db -> query('SELECT * FROM `locations_actions`');
$actions = $_actions -> fetchAll();
$basis = imagecreatefrompng('images/221.png');
imagesavealpha($basis, true);
if($_SESSION['message']) imagecopyresampled($basis, imagecreatefrompng('images/locations/win.png'), 0, 50, 0, 0, 300, 111, 300, 111);
elseif($_GET['d'] == 'area') {
imagecopyresampled($basis, imagecreatefrompng('images/monster2.png'), 0, 40, 0, 0, 300, 192, 300, 192);
}
else {
$w = imagecolorallocate($basis, 255, 250, 255);
imagesetstyle ($basis, [$w, $w, $w, IMG_COLOR_TRANSPARENT, $w, $w, $w]);
foreach($actions as $action){
$image = $user['action'] == $action['id'] ? imagecreatefrompng('images/locations/user.png') : imagecreatefrompng('images/locations/'.$action['type'].'.png');
imagecopyresampled($basis, $image, $action['top'], $action['left'], 0, 0, 16, 16, 16, 16);
imagedestroy($image);
$_lines = $db -> prepare('SELECT * FROM `location_lines` WHERE `action` = ? AND `location` = ?');
$_lines -> execute([$action['id'],1]);
$lines = $_lines -> fetchAll();
foreach($lines as $line){
imageline($basis, $line['line_x'], $line['line_y'], $line['line_x_'], $line['line_y_'], IMG_COLOR_STYLED);
imageline($basis, $line['line_x'], $line['line_y'] + 1, $line['line_x_'], $line['line_y_'] + 1, IMG_COLOR_STYLED);
//imageline($basis, $line['line_x'], $line['line_y']+2, $line['line_x_'], $line['line_y_']+2, IMG_COLOR_STYLED);
//imageline($basis, $line['line_x'], $line['line_y']+3, $line['line_x_'], $line['line_y_']+3, IMG_COLOR_STYLED);
}
$_lines = $db -> prepare('SELECT * FROM `location_lines` WHERE `action` = ? AND `action_` = ?');
$_lines -> execute([$user['action'], $action['id']]);
$line = $_lines -> fetch();
if($line) imagecopyresampled($basis, imagecreatefrompng('images/locations/cursor.png'), $action['top'] + 2, $action['left'] - 20, 0, 0, 12, 17, 12, 17);
}
}
imagepng($basis);
imagedestroy($basis);
exit;
}
?>
<img src="?bitch=image" alt="" />