View file inc/count_pic.php

File size: 1.55Kb
<?php
include_once "../config.php"; //
include_once "../inc/inc.php";
include_once "../inc/func.php";
include_once "../inc/user.php";

$query = "SELECT * FROM " . $pref . "counter WHERE id=1";
$res00 = mysql_fetch_assoc(mysql_query($query));
$user_online = mysql_num_rows(mysql_query("SELECT * FROM " . $pref . "online_user"));
$guest_online = mysql_num_rows(mysql_query("SELECT * FROM " . $pref . "online_guest"));
$vsego_online = $user_online + $guest_online;
Header("Content-type: image/png");
$imga = imageCreateFromPng($pic_count);
$size = GetImageSize($pic_count);
$img = ImageCreateTrueColor(60, 30);
imageCopyResized($img, $imga, 0, 0, 0, 0, 60, 30, $size[0], $size[1]);
$black = imagecolorallocate($img, 0, 0, 0);
$red = imagecolorallocate($img, 255, 0, 0);
$color = imagecolorallocate($img, 140, 140, 140);

$w = imageSX($img);
$h = imageSY($img);
$szf = 15;
$ang = 0;
$sz = imageTTFBBox($szf, $ang, "../font/font2.ttf", $user_online . '/' . $vsego_online);
$sdx = $sz[4] / 2;
$sdy = ($sz[7] + $sz[3]) / 2;
imageTTFText($img, $szf, $ang, $w / 2 - $sdx, $h / 2 - $sdy, $color, "../font/font2.ttf", $user_online . '/' . $vsego_online);
imageTTFText($img, 6, 0, 3, 8, $black, "../font/font1.ttf", "HOSTS");
imageTTFText($img, 6, 0, 31, 8, $black, "../font/font1.ttf", $res00['host']);
imageTTFText($img, 6, 0, 3, 17, $black, "../font/font1.ttf", "HITS");
imageTTFText($img, 6, 0, 31, 17, $black, "../font/font1.ttf", $res00['hit']);
imageTTFText($img, 7, 0, 2, 28, $red, "../font/font1.ttf", 'Optima-CMS');
imagePng($img);
imageDestroy($img);

?>