View file include/statistika/registretie.php

File size: 3.49Kb
<?php

$title = $tlapa.': reģistrēto saraksts';
$sakt = microtime(1);
		
//////////////////////////////////iegūstam informāciju

if (intval($_GET['lapa'])<=0)
{
	$lapa = 0;
	$nr = 1;
}
else
{
	$lapa = $nirsl*(intval($_GET['lapa'])-1);
	$nr = intval($_GET['lapa']);
}

$vieta = $lapa+1;

if (isset($_GET['viriesi']))
{
	$get = 'viriesi';
	$cik_niku = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM lietotaji WHERE dzimums='v'"));
	$niki = mysql_query("SELECT * FROM lietotaji WHERE dzimums='v' ORDER BY niks ASC LIMIT $lapa, $nirsl");
}
elseif (isset($_GET['sievietes']))
{
	$get = 'sievietes';
	$cik_niku = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM lietotaji WHERE dzimums='s'"));
	$niki = mysql_query("SELECT * FROM lietotaji WHERE dzimums='s' ORDER BY niks ASC LIMIT $lapa, $nirsl");
}
else
{
	$get = '';
	$cik_niku = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM lietotaji"));
	$niki = mysql_query("SELECT * FROM lietotaji ORDER BY niks ASC LIMIT $lapa, $nirsl");
}

$lapu_skaits = ceil($cik_niku[0]/$nirsl);

//////////////////////////////////////////////////////
		
require_once('include/augsa.php');
		
echo '<div class="sani" style="text-align: center">';
echo '<font class="ramis">-Reģistrētie-</font>';
echo '</div>';
echo '<div class="vidus" style="text-align: left">';

if ($cik_niku[0]>0)
{
	if ($get == 'viriesi')
	{
		echo 'Kopā vīrieši: ';
	}
	elseif ($get == 'sievietes')
	{
		echo 'Kopā sievietes: ';
	}
	else
	{
		echo 'Kopā reģistrēti: ';
	}
	
	echo '<b>'.$cik_niku[0].'</b>';
	echo '<hr></hr>';
	
	while ($nik = mysql_fetch_array($niki, MYSQL_ASSOC))
	{
		$laiks = $nik['dzimene'];
		$gads = date("Y", $laiks);
				
		if (date("z", time())<date("z", $laiks))
		{
			$gadi = date("Y", time())-$gads-1;
		}
		else
		{
			$gadi = date("Y", time())-$gads;
		}
		
		if ($nik['ped_aktivitate']<(time()-$oses))
		{
			$stat = '<font class="kluda">(Off)</font>';
		}
		else
		{
			$stat = '<font class="ok">(On)</font>';
		}
			
		echo '<small><b>'.$vieta.')</b> ';
		echo '<a href="./?kas=profils&amp;sid='.$sid.'&amp;kam='.$nik['id'].'">'.$nik['niks'].'</a> ';
		echo '[<b>'.$gadi.'</b>] ['.$nik['dzimums'].'] <b>'.$stat.'</b></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=registretie&amp;sid='.$sid.'&amp;lapa='.($nr-1).'&amp;'.$get.'">&#171;Atpakaļ</a> ';
		}
			
		echo '<b>'.$nr.'</b>/<b>'.$lapu_skaits.'</b>';
			
		if ($nr<$lapu_skaits)
		{
			echo ' <a href="./?kas=registretie&amp;sid='.$sid.'&amp;lapa='.($nr+1).'&amp;'.$get.'">Tālāk&#187;</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="registretie"/>';
	        	echo '<input name="sid" type="hidden" value="'.$sid.'"/>';
			echo '<input name="'.$get.'" type="hidden" value=""/>';
			echo ' <input type="submit" value="Aiziet"/>';
	        	echo "</form>"; 
	   	}
	}
}
else
{
	echo '<b>Saraksts tukšs!</b>';
}

echo '<hr></hr>';
echo '&#8226; <a href="./?kas=statistika&amp;sid='.$sid.'">Statistika</a><br/>';
echo '&#8226; <a href="./?kas=mekletn&amp;sid='.$sid.'">Meklēt niku</a><br/>';
echo '&#8226; <a href="./?kas=&amp;sid='.$sid.'">Galvenā</a>';
echo '</div>';

?>