battles/clan.php

91 lines
3.7 KiB
PHP
Raw Normal View History

2018-02-16 00:52:13 +00:00
<?php
/**
* Copyright (c) 2018.
* Author: Igor Barkov <lopar.4ever@gmail.com>
* Project name: Battles-Game
*/
include_once "config.php";
#include_once "functions.php";
#$db = $mysql;
$claninf = urldecode(filter_input(INPUT_SERVER,'QUERY_STRING'));
if ($claninf) {
$query = db::c()->query('SELECT * FROM `clans` WHERE `name` = "?s"', $claninf)->fetch_assoc();
echo "<h1>{$query['name']}</h1><p>{$query['descr']}</p>";
} else {
echo "<h1>Список кланов</h1>";
$query = db::c()->query('SELECT `name`,`short` FROM `clans`');
while ($clanrow = $query->fetch_assoc()) {
echo "<img src=i/klan/",$query['short'],".gif>",$query['name'],"<br>";
}
}
/*
if(!$_GET[clan]) {
?>
<dl>
<ul type="disc">
<?php
$query=mysql_query("SELECT * FROM clans ORDER BY rating desc, short asc", $db);
while($row = mysql_fetch_array($query))
{
echo "<li><strong><img src='http://capitalcity.old-dark.ru/i/align_$row[align].gif' border='0'><img src='http://capitalcity.old-dark.ru/i/klan/$row[short].gif' border='0'><a href='index.php?section=99&page=clans1&clan=$row[short]'>$row[short]</a></strong> (<font color=gray size=-2>Очки рейтинга: <b>$row[rating])</b></font> </li>";
}
?>
</ul></dl>
<?php
mysql_close($db);
}
else {
$clan = $_GET[clan];
$query=mysql_query("SELECT * FROM clans WHERE short = '$_GET[clan]' LIMIT 1");
while($row = mysql_fetch_array($query))
{
echo "<h2>$row[name]</h2><br>";
echo "$row[descr]<br><br>";
echo "<a href='http://$row[homepage]'>$row[homepage]<br /><hr /></a>";
}
$clan = $_GET['clan'];
$glid=mysql_fetch_array(mysql_query("SELECT `glava` FROM `clans` WHERE `short` = '".$clan."' LIMIT 1"));
$glid=$glid['glava'];
$gl=mysql_fetch_array(mysql_query("SELECT `login` FROM `users` WHERE `id` = '".$glid."' LIMIT 1"));
$gl=$gl['login'];
$gl2=mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `id` = '".$glid."' LIMIT 1"));
$gl2=$gl2['id'];
$gl3=mysql_fetch_array(mysql_query("SELECT `level` FROM `users` WHERE `id` = '".$glid."' LIMIT 1"));
$gl3=$gl3['level'];
$gl4=mysql_fetch_array(mysql_query("SELECT `status` FROM `users` WHERE `id` = '".$glid."' LIMIT 1"));
$gl4=$gl4['status'];
echo "<br />{$gl4}: <b>{$gl}</b>[{$gl3}]<a href=http://capitalcity.old-dark.ru/inf.php?{$gl2} target=_blank><IMG SRC=../i/inf.gif WIDTH=12 HEIGHT=11 border=0 ALT=\"Инф. о {$gl2}\"></a><br />" ;
echo "<br /><em>Состав клана:</em><br />" ;
$clanss=mysql_fetch_array(mysql_query("SELECT `id` FROM `clans` WHERE `short` = '".$clan."' LIMIT 1"));
$clanss=$clanss['id'];
$clansss=mysql_query("SELECT `id`,`level`,`align`,`login` FROM `users` WHERE `klan` = '".$clanss."' ORDER BY level desc, login asc;");
while ($row3 = mysql_fetch_array($clansss)) {
echo("<IMG width=12 SRC=../i/align_".$row3['align'].".gif height=15 />");
echo("<b>");
echo ($row3['login']);
echo("</b>");
echo("[");
echo ($row3['level']);
echo("]");
echo("<a href=http://capitalcity.old-dark.ru/inf.php?".$row3['id']." target=_blank><IMG SRC=../i/inf.gif WIDTH=12 HEIGHT=11 border=0 ALT=\"Инф. о ".$row3['id']."\"></a>");
echo("<br/>");
}
$total = mysql_num_rows($clansss);
echo "<br />Всего: <b>".$total."</b>" ;
$clanrait=mysql_query("SELECT `rating` FROM `clans` WHERE short = '".$clan."' LIMIT 1");
while ($row4 = mysql_fetch_array($clanrait))
{
echo "<br />Очки рейтинга: <b>$row4[rating]</b><br /><br />" ;
}
}
mysql_close($db); */