Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
<?php
$broinastranica = 20;
$pageNum = 1;
if(((int) $_GET['page']) > 0 )
{
$pageNum = $_GET['page'];
}
$redove = ($pageNum - 1) * $broinastranica;
$sql = mysql_query("SELECT count(id) as broi FROM users");
$row = mysql_fetch_array($sql);
$max = $row['broi'];
$sql = mysql_query("SELECT username,id,meil,username,avatar,userlevel,lastonline,date FROM users ORDER BY date DESC LIMIT $redove,$broinastranica");
$users_rowset = array();
$total_users = 0;
while( $row = mysql_fetch_array( $sql ) )
{
$total_users++;
$users_rowset[] = $row;
}
if($total_users)
{
for($i=0;$i<$total_users;$i++)
{
$online = ( $users_rowset[$i]['lastonline'] >= (time()-5*60) ) ? '<span style="cursor:default">
Online now' : '<span style="cursor:default">
<font color="000000">Offline';
$avatarmi=$users_rowset[$i]['avatar'];
$lastonline=$users_rowset[$i]['lastonline'];
if ($avatarmi == null)
{
$avatarami="<img src='../img/noavatar.gif'>";
}
else
{
$avatarami="<img src='../avatars/$avatarmi' border='0'>";
}
echo '<tr><td> <a href="../'.$users_rowset[$i]['username'].' "style="text-decoration: none;">'.$users_rowset[$i]['username'].'</a>
'.$online.'<br>'.$avatarami.' </td>
<td>'.times($users_rowset[$i]['date']).'</td>
<td><a href="mailto:'.$users_rowset[$i]['meil'].'">
'.$users_rowset[$i]['meil'].' </a></td> ';
}
echo '<tr><td colspan="4" align="center">';
$query = "SELECT COUNT(id) AS numrows FROM users";
$result = mysql_query($query) or die('Error, query failed');
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$numrows = $row['numrows'];
$maxPage = ceil($numrows/$broinastranica);
$self = $_SERVER['PHP_SELF'];
$nomeranastranici = '';
for($page = 1; $page <= $maxPage; $page++)
{
if ($page == $pageNum)
{
$nomeranastranici .= " $page ";
}
else
{
$nomeranastranici .= " <a href=\"$self?page=$page\">$page</a> ";
}
}
if ($pageNum > 1)
{
$page = $pageNum - 1;
$predishna = " <a href=\"$self?page=$page\"> [<<<<<] </a> ";
$parva = " <a href=\"$self?page=1\">[първа]</a> ";
}
else
{
$predishna = ' ';
$parva = ' ';
}
if ($pageNum < $maxPage)
{
$page = $pageNum + 1;
$sledvashta = " <a href=\"$self?page=$page\"> [>>>>>] </a> ";
$posledna = " <a href=\"$self?page=$maxPage\">[последна]</a> ";
}
else
{
$sledvashta = ' ';
$posledna = ' ';
}
// показваме
echo $parva . $predishna . $nomeranastranici . $sledvashta . $posledna;
}
?>
$sql = mysql_query("SELECT username, lastonline FROM users");
$row = mysql_fetch_array($sql);
$username = $row['username'];
$lastonline = $row['lastonline'];
if(($username == $_POST['username']) && ($lastonline >= (time()-5*60)){
echo "Online";}
else {
echo "Offline";}