<?php
define('PROTECTOR', 1);
include('files/path.php');
include($path.'files/db.php');
include($path.'files/auth.php');
include($path.'files/func.php');
include($path.'files/core.php');

$me = mysql_fetch_assoc(mysql_query("SELECT * FROM `mesto` WHERE `usr` = '$log' LIMIT 1"));
$to = mysql_fetch_array(mysql_query("SELECT * FROM `towers` WHERE `id`='$me[towers]'"));
$max = $to['hpall'];
$now = $to['hp'];
$health = 130 / ($max / $now);
$img="image/exp/hp.gif";
$pic = ImageCreateFromgif($img);
header('Content-Type: image/gif');
$black = imagecolorallocate($pic, 999, 999, 999);
$white = imagecolorallocate($pic, 557, 667, 998);
imagefilledpolygon($pic, array(255,0, 0,22, $health,22, $health,0), 4, $black);
imagestring($pic, 1, 3, 2, 'HP:  '.number_format($now).'/'.number_format($max).'', $white);
imagepolygon($pic, array(0,0, 0,11, 129,11, 129,0), 4, $white);
ob_end_clean();
imagegif($pic);
?>