Файл: public_html/a17.php
Строк: 47
<?
include './system/common.php';
include './system/functions.php';
include './system/user.php';
$title = 'Замок';
include './system/h.php';
if($user) {
$baza=mysql_fetch_array(mysql_query("SELECT * FROM `a17` WHERE `id`='1'"));
$min = $user[str] / 6;
$max = $user[str] / 4;
$damage = rand($min,$max);
$hp_progress = round(100/($baza[max_hp]/$baza[hp]));
if($hp_progress > 100) {
$hp_progress = 100;
}
?>
<div class="header-title"><span style="color: rgb(255, 255, 255);">Замок</span></div>
<img style="width: 100%;" src="/images/dotan.png">
<div class="header-title"><span style="color: rgb(255, 255, 255);">Замок принадлежит: <?if($baza[r] == 1){?>Тёмной стороне<?}?><?if($baza[r] == 0){?>Светлой стороне<?}?></span></div>
<div class="delta"></div>
<div class=" backfon-3 backten-y">
<div class="foot-info-exp">
<div class="foot-info-exp-fill" style="width: <?=$hp_progress?>%"></div>
</div>
<div class=" backfon-3 backten-y"><span style="color: rgb(228, 208, 105);"><center>
Тьма: <?=$baza[r1]?> (<?=ceil(100 / ($baza[max_hp] / $baza[r1]))?>%) | Cвет: <?=$baza[r0]?> (<?=ceil(100 / ($baza[max_hp] / $baza[r0]))?>%)
</span></div>
<div class="delta"></div>
<center>
<?//темные
if($baza[r] == 1) {?>
<a href='?attack' class='button-green backgreen ib'>Атаковать замок</a>
<?//светлые
}else{?>
<a href='?attack' class='button-green backgreen ib'>Атаковать замок</a>
<?}?>
<? // темные
if (isset($_GET['attack']) && $user['r']==1){
mysql_query("UPDATE `a17` SET `hp`=`hp`-'".$damage."' WHERE `id`='1'");
mysql_query("UPDATE `a17` SET `r1`=`r1`+'".$damage."' WHERE `id`='1'");
mysql_query("UPDATE `users` SET `v1` = `v1` +' 1' WHERE `id`='".$user['id']."'");
mysql_query("INSERT INTO `a17_log` SET `user_id`='".$user['id']."', `text`='ударил замок на <b>".$damage."</b> едениц', `time`='".time()."', `damage`='".$damage."'");
header('Location: /a17.php');
}?>
<? // светлые
if (isset($_GET['attack']) && $user['r']==0){
mysql_query("UPDATE `a17` SET `hp`=`hp`-'".$damage."' WHERE `id`='1'");
mysql_query("UPDATE `a17` SET `r0`=`r0`+'".$damage."' WHERE `id`='1'");
mysql_query("UPDATE `users` SET `v0` = `v0` +' 1' WHERE `id`='".$user['id']."'");
mysql_query("INSERT INTO `a17_log` SET `user_id`='".$user['id']."', `text`='ударил замок на <b>".$damage."</b> едениц', `time`='".time()."', `damage`='".$damage."'");
header('Location: /a17.php');
}?>
<?
$aluko_log_q = mysql_query("SELECT * FROM `a17_log` ORDER BY `time` DESC LIMIT 5");
while($aluko_log = mysql_fetch_array($aluko_log_q)){
$row = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$aluko_log['user_id']."'"));?>
<a href='/user/<?=$row['id']?>/'>
<img src='/images/rang/<?=$row['rang']?>.jpg' alt='*'/>
<?if($row['r'] == 1) {?>
<span style="color: rgb(255, 0, 0);">
<?=$row['login']?> [ <?=$row['level']?> ]
</span>
<?}else{?>
<span style="color: rgb(102, 255, 255);">
<?=$row['login']?> [ <?=$row['level']?> ]
</span>
<?}?>
</a>
<?=$aluko_log['text'];?>
<br>
<?}?>
<div class="delta"></div><center>
<span style="color: rgb(228, 208, 105);">
При победе одной из сторон, все её сторонники получат по: 5000
<?}include './system/f.php';?>