battles/clans.php
2020-09-30 17:30:31 +03:00

24 lines
1.1 KiB
PHP

<?php
/**
* Copyright (c) 2018.
* Author: Igor Barkov <lopar.4ever@gmail.com>
* Project name: Battles-Game
*/
Template::header('Список кланов');
include_once "config.php";
$claninf = urldecode(filter_input(INPUT_SERVER,'QUERY_STRING'));
if ($claninf AND ($query = db::c()->query('SELECT * FROM `clans` WHERE `name` = "?s"', $claninf)->fetch_assoc())) {
echo "<h1>{$query['name']}</h1><p>{$query['descr']}</p>";
$clanlist = db::c()->query('SELECT `login`,`status` FROM `users` WHERE `klan` = ?i',$query['id']);
while ($member = $clanlist->fetch_assoc()) {
echo "<img src=i/align_",$query['align'],".gif> <img src=i/clan/",$query['short'],".gif> ",$member['login']," - ",$member['status'],"<br>";
}
} else {
echo "<h1>Список кланов</h1>";
$query = db::c()->query('SELECT `align`,`name`,`short` FROM `clans` ORDER BY `name` ASC');
while ($clanrow = $query->fetch_assoc()) {
$frm = "<img src='i/align_%s.gif'> <img src='i/clan/%s.gif'> <a href='?%s'>%s</a><br>";
echo sprintf($frm,$clanrow['align'],$clanrow['short'],$clanrow['name'],$clanrow['name']);
}
}