NIWPI/Info/image0.php

31 lines
1.0 KiB
PHP

<?php
include "uinfo.class.php";
#array_key_exists('HTTP_USER_AGENT', $_SERVER) && $_SERVER['HTTP_USER_AGENT'] ? $_SERVER["HTTP_USER_AGENT"] : "undefined" ;
#$user = new uInfo($_SERVER["HTTP_USER_AGENT"], $_SERVER["REMOTE_ADDR"]) ;
$userAgent = array_key_exists('HTTP_USER_AGENT', $_SERVER) && $_SERVER['HTTP_USER_AGENT'] ? $_SERVER["HTTP_USER_AGENT"] : "undefined" ;
$user = new uInfo($userAgent, $_SERVER["REMOTE_ADDR"]) ;
header("Content-type: image/jpeg");
$img = imagecreatefromjpeg("img/type0.jpg");
imagewritestring($img, 1, $user->host->ip);
imagewritestring($img, 2, $user->host->city . " , " . $user->os->name . " " . $user->os->version);
imagewritestring($img, 3, $user->browser->name . " , " . $user->browser->version . " " . 'Pays: ' . $user->host->country);
imagejpeg($img, NULL, 100);
imagedestroy($img);
function imagewritestring($img, $font_size, $string)
{
$color = imagecolorallocate($img, 180, 180, 180);
static $y = 2;
$y += $font_size + 10;
$x = 10;
imagettftext($img, $font_size, 0, $x, $y, $color, "fonts/consola.ttf", $string);
}