Commit 621554a9 authored by Alyx's avatar Alyx
Browse files

Update file sponge.php

parent f08ba798
Loading
Loading
Loading
Loading
+64 −0
Original line number Diff line number Diff line
<?php
require_once 'vendor/autoload.php';

use GeoIp2\Database\Reader;

$reader = new Reader('GeoLite2-City.mmdb');
$record = $reader->city($_SERVER['REMOTE_ADDR']);

$images = ["base1.png", "base2.png", "base3.png", "base4.png"];
putenv('GDFONTPATH=' . realpath('.'));
$image = $images[array_rand($images)];
$im = imagecreatefrompng($image);

$color = imagecolorallocate($im, 255, 255, 255);
$color2 = imagecolorallocate($im, 0, 0, 0);

if (filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
    $x = 50;
    $y = 150;
    $size = 108;
    $size_city=56;
    $y_city = 240;
    if($image=='base3.png')
{
$x=50;
$y=700;
$size=108;
$size_city=56;
$y_city=790;
}
} else {
    if ($image != "base2.png" && $image != "base4.png") {
        $x = 20;
        $y = 700;
        $size = 50;
    $size_city=56;
        $y_city = 800;
    }
    else
    {
        $x = 20;
        $y = 100;
        $size = 50;
    $size_city=56;
        $y_city = 175;
        
    }
}
imagettftext($im, $size, 0, $x - 2, $y - 2, $color2, "sponge.ttf", $_SERVER['REMOTE_ADDR']);
imagettftext($im, $size, 0, $x, $y, $color, "sponge.ttf", $_SERVER['REMOTE_ADDR']);

imagettftext($im, $size_city, 0, $x - 2, $y_city - 2, $color2, "sponge.ttf", $record->city->name . ", " . $record->mostSpecificSubdivision->name . ", " . $record->country->name);
imagettftext($im, $size_city, 0, $x, $y_city, $color, "sponge.ttf", $record->city->name . ", " . $record->mostSpecificSubdivision->name . ", " . $record->country->name);

imagestring($im, 15, 0, 884, 'This information was not logged. Goodbye, Eggbug. We all loved you.', $color2);
imagestring($im, 15, 1, 885, 'This information was not logged. Goodbye, Eggbug. We all loved you.',$color);

header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
 No newline at end of file