Script zde:
Kód: Vybrat vše
<?php
$dbHost = 'localhost';
$dbUser = '138899_mysql_db';
$dbPw = '******';
$dbDatabase = '138899_mysql_db';
?>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml' lang='cs'>
<head>
<meta charset='UTF-8' />
<meta name='author' content='Mysteria' />
<meta name='description' content='' />
<meta name='keywords' content='' />
<title>Seznam VIP hráčů</title>
<style>
table { font-family: verdana, Geneva, Tahoma, sans-serif; font-size: 0.8em; border-collapse: collapse; }
table thead th { padding: 2px 5px; border: 1px solid black; text-align: center; }
table tbody td { padding: 2px 5px; border: 1px solid black; }
table tbody td img { margin-right: 2px; vertical-align: text-bottom; }
table tbody td.mid { text-align: center; }
table tbody td.red { color: red; }
</style>
</head>
<body>
<!--
# Název: Seznam VIP hráčů
# Autor: Mysteria - http://www.mysty.cz
# Verze: 1.0.0
# Poslední update: 21. 10. 2013
# Více informací na: http://forum.fakaheda.eu/viewtopic.php?f=85&t=5946
-->
<?php
$rank = 1;
$db = new mysqli($dbHost, $dbUser, $dbPw, $dbDatabase);
if (empty($db->connect_error)):
$r = $db->query('SELECT name, permission, value FROM permissions WHERE type = 1 ORDER BY value DESC;');
?>
<table>
<thead>
<tr>
<th>#</th>
<th>Nick</th>
<th>Group</th>
<th>Expire date</th>
<th>Remaining days</th>
</tr>
</thead>
<tbody>
<?php while ($p = $r->fetch_assoc()): ?>
<tr>
<td class='mid'><?php echo $rank++; ?></td>
<td><img src='https://minotar.net/avatar/<?php echo $p['name'] ?>/16.png' alt='—' width='16' height='16' /><strong><?php echo $p['name'] ?></strong></td>
<td class='mid'><?php echo strtoupper(explode('-', $p['permission'])[1]) ?></td>
<td class='mid'><?php echo date('d. m. Y. H:i', $p['value']) ?></td>
<td class='mid <?php echo ($d = round(($p['value'] - time()) / 86400)) < 0 ? 'red' : 'green' ?>'><?php echo $d ?></td>
</tr>
<?php endwhile; else: echo "<strong style='color: red;'>Cannot connect to database: [Error $db->connect_errno] $db->connect_error</strong>"; endif;?>
</tbody>
</table>
</body>
</html>