View file include/pasts/pasts.php

File size: 2.89Kb
<?php

$title = $tlapa.': pastkaste';
$sakt = microtime(1);
$id = idsid($sid);
$info1 = infoid($id);

/////////////////////////////////////////apstrādājam datus

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

	$cik_vestulu = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM pasts WHERE kam='".$id."'"));
	$vestules = mysql_query("SELECT * FROM pasts WHERE kam='".$id."' ORDER BY laiks DESC LIMIT $lapa, $vssl");
	$lapu_skaits = ceil($cik_vestulu[0]/$vssl);
}

//////////////////////////////////////////////////////////

require_once('include/augsa.php');

echo '<div class="sani" style="text-align: center">';
echo '<font class="ramis">-Pastkaste-</font>';
echo '</div>';
echo '<div class="vidus" style="text-align: left">';

if (empty($sid))
{
	echo 'Lai apskatītu savu pastkasti sākumā <b><a href="./?kas=ienakt">ielogojies</a></b> vai ';
	echo '<b><a href="./?kas=reg">reģistrējies</a></b>!';
	echo '<hr></hr>';
}
else
{
	echo '<small>&#8226; <a href="./?kas=sutit&amp;sid='.$sid.'">Sūtīt</a></small> ';
	echo '<small>&#8226; <a href="./?kas=sutitas&amp;sid='.$sid.'">Sūtītās</a></small><br/>';
	echo '<small>&#8226; <a href="./?kas=ciespejas&amp;sid='.$sid.'">Citas iespējas</a></small><br/>';
	echo '<hr></hr>';
	
	if ($cik_vestulu[0]>0)
	{
		while ($vestule = mysql_fetch_array($vestules, MYSQL_ASSOC))
		{
			$info = infoid($vestule['no_ka']);
			
			if ($vestule['lasita']==2)
			{
				$stat = '<font class="kluda">(-)</font>';
			}
			else
			{
				$stat = '<font class="ok">(+)</font>';
			}
			
			echo '<small>'.$stat.' No: ';
			echo '<a href="./?kas=lasit&amp;sid='.$sid.'&amp;pid='.$vestule['pid'].'">'.$info['niks'].'</a></small><br/>';
		}
		
		if ($lapu_skaits>1)
		{
			echo '</div>';
			echo '<div class="vidus" style="text-align: center"><small>';
			
			if ($lapa>0)
			{
				echo '<a href="./?kas=pasts&amp;sid='.$sid.'&amp;lapa='.($nr-1).'">&#171;Atpakaļ</a> ';
			}
				
			echo '<b>'.$nr.'</b>/<b>'.$lapu_skaits.'</b>';
				
			if ($nr<$lapu_skaits)
			{
				echo ' <a href="./?kas=pasts&amp;sid='.$sid.'&amp;lapa='.($nr+1).'">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="pasts"/>';
		        	echo '<input name="sid" type="hidden" value="'.$sid.'"/>';
				echo ' <input type="submit" value="Aiziet"/>';
		        	echo "</form>"; 
		   	}
		}
	}
	else
	{
		echo '<b>Tavs pasts ir tukšs!</b>';
	}
}

echo '</div><div class="vidus" style="text-align: left">';
echo '<small>&#8226; <a href="./?kas=&amp;sid='.$sid.'">Galvenā</a></small><br/>';
echo '</div>';

?>