File size: 5.66Kb
<?php
$title = $tlapa.': lietotāju tops';
$sakt = microtime(1);
//////////////////////////////////////////////////////////////////
if (intval($_GET['lapa'])<=0)
{
$lapa = 0;
$nr = 1;
}
else
{
$lapa = $nirsl*(intval($_GET['lapa'])-1);
$nr = intval($_GET['lapa']);
}
//////////////////////////////////nosakām kādā secībā kārtot nikus
if (isset($_GET['kliki']))
{
$get = 'kliki';
$nosaukums = '<small>Tops pēc kliku skaita</small>';
$sql = "SELECT * FROM lietotaji ORDER BY kliki DESC LIMIT $lapa, $nirsl";
}
elseif (isset($_GET['aparati']))
{
$get = 'aparati';
$nosaukums = '<small>Lietotāju aparāti</small>';
$sql = "SELECT browseris, COUNT(browseris) AS skaits1 FROM lietotaji GROUP BY browseris ORDER BY skaits1 DESC LIMIT $lapa, $nirsl";
$sql1 = "SELECT browseris FROM lietotaji GROUP BY browseris";
}
elseif (isset($_GET['teksti']))
{
$get = 'teksti';
$nosaukums = '<small>Tops pēc tekstu skaita forumā</small>';
$sql = "SELECT id, COUNT(id) AS skaits1 FROM foruma_teksti GROUP BY id ORDER BY skaits1 DESC LIMIT $lapa, $nirsl";
$sql1 = "SELECT id FROM foruma_teksti GROUP BY id";
}
elseif (isset($_GET['skatit']))
{
$get = 'skatit';
$nosaukums = '<small>Tops pēc skatījumu skaita</small>';
$sql = "SELECT * FROM lietotaji ORDER BY skatijas DESC LIMIT $lapa, $nirsl";
}
elseif (isset($_GET['punkti']))
{
$get = 'punkti';
$nosaukums = '<small>Tops pēc punktu skaita</small>';
$sql = "SELECT * FROM lietotaji ORDER BY punkti DESC LIMIT $lapa, $nirsl";
}
else
{
$get = 'laiks';
$nosaukums = '<small>Tops pēc pavadītā laika</small>';
$sql = "SELECT * FROM lietotaji ORDER BY online_laiks DESC LIMIT $lapa, $nirsl";
}
//////////////////////////////////////////////iegūstam informāciju
$vieta = $lapa+1;
if (isset($_GET['operatori']))
{
$lietotaju_sk = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM lietotaji"));
$tele2 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM lietotaji WHERE ip LIKE '%130.244.196.90%' OR ip LIKE '%193.12.40.38%'"));
$lmt = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM lietotaji WHERE ip LIKE '%212.93.96.65%' OR ip LIKE '%212.93.97.206%'"));
$bite = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM lietotaji WHERE ip LIKE '%213.226.131.133%'"));
}
else
{
if ($get!='aparati' && $get!='teksti')
{
$cik_niku = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM lietotaji"));
}
$niki = mysql_query($sql);
if ($get=='aparati' || $get=='teksti')
{
$cik_niku[0] = mysql_num_rows(mysql_query($sql1));;
}
$lapu_skaits = ceil($cik_niku[0]/$nirsl);
}
///////////////////////////////////////////////////////////////////
require_once('include/augsa.php');
echo '<div class="sani" style="text-align: center">';
echo '<font class="ramis">-Lietotāju tops-</font>';
echo '</div>';
echo '<div class="vidus" style="text-align: left">';
if ($cik_niku[0]>0)
{
echo '<b>'.$nosaukums.'</b>';
echo '<hr></hr>';
while ($nik = mysql_fetch_array($niki, MYSQL_ASSOC))
{
if ($get == 'teksti')
{
$info2 = infoid($nik['id']);
$nik['niks'] = $info2['niks'];
}
echo '<small><b>'.$vieta.')</b> ';
if ($get!='aparati')
{
echo '<a href="./?kas=profils&sid='.$sid.'&kam='.$nik['id'].'">'.$nik['niks'].'</a> ';
}
if ($get == 'kliki')
{
echo 'Kliki: <b>'.$nik['kliki'].'</b>';
}
elseif ($get == 'skatit')
{
echo 'Skatījumi: <b>'.$nik['skatijas'].'</b>';
}
elseif ($get == 'aparati')
{
echo $nik['browseris'].': <b>'.$nik['skaits1'].'</b>';
}
elseif ($get == 'teksti')
{
echo 'Teksti: <b>'.$nik['skaits1'].'</b>';
}
elseif ($get == 'punkti')
{
echo 'Punkti: <b>'.$nik['punkti'].'</b>';
}
else
{
echo 'Pavadītais laiks: '.plaiks($nik['online_laiks']);
}
echo '</small><br/>';
$vieta++;
}
if ($lapu_skaits>1)
{
echo '</div>';
echo '<div class="vidus" style="text-align: center"><small>';
if ($lapa>0)
{
echo '<a href="./?kas=lietstat&sid='.$sid.'&lapa='.($nr-1).'&'.$get.'">«Atpakaļ</a> ';
}
echo '<b>'.$nr.'</b>/<b>'.$lapu_skaits.'</b>';
if ($nr<$lapu_skaits)
{
echo ' <a href="./?kas=lietstat&sid='.$sid.'&lapa='.($nr+1).'&'.$get.'">Tālāk»</a>';
}
echo '</small>';
if ($lapu_skaits>2)
{
echo '<form action="./" method="get">';
echo '<small>Lapa</small> <input name="lapa" format="*N" size="3"/>';
echo '<input name="kas" type="hidden" value="lietstat"/>';
echo '<input name="sid" type="hidden" value="'.$sid.'"/>';
echo '<input name="'.$get.'" type="hidden" value=""/>';
echo ' <input type="submit" value="Aiziet"/>';
echo "</form>";
}
}
}
elseif (isset($_GET['operatori']))
{
echo '<small><b>Lietotāju operatori</b></small>';
echo '<hr></hr>';
echo '<small>';
echo 'Tele2 - <b>'.round($tele2[0]*100/$lietotaju_sk[0], 2).'%</b> ('.$tele2[0].')<br/>';
echo 'LMT - <b>'.round($lmt[0]*100/$lietotaju_sk[0], 2).'%</b> ('.$lmt[0].')<br/>';
echo 'Bite - <b>'.round($bite[0]*100/$lietotaju_sk[0], 2).'%</b> ('.$bite[0].')<br/>';
echo 'Cits - <b>'.round(($lietotaju_sk[0]-$tele2[0]-$lmt[0]-$bite[0])*100/$lietotaju_sk[0], 2).'%</b> ('.($lietotaju_sk[0]-$tele2[0]-$lmt[0]-$bite[0]).')<br/>';
echo '</small>';
}
else
{
echo '<b>Saraksts tukšs!</b>';
echo '<hr></hr>';
}
echo '</div>';
echo '<div class="vidus" style="text-align: left">';
echo '• <a href="./?kas=statistika&sid='.$sid.'">Statistika</a><br/>';
echo '• <a href="./?kas=&sid='.$sid.'">Galvenā</a>';
echo '</div>';
?>