File size: 2.87Kb
<?php
@$pas=$_GET['pas'];
@$n=$_GET['n'];
$n=intval($n);
require('ini.php');
Header('Content-Type: application/xhtml+xml;charset=utf-8');
Header('Cache-Control: no-cache, must-revalidate');
print '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru"><head><title>-Форум-</title>
<link rel="stylesheet" type="text/css" href="style.css" /></head><body><div>
<small>[<a href="prav.php">Пpaвилa фopумa</a>]</small><hr />
';
// get data:
$arr=file('themes.dat');
$cnt=count($arr);
// define a function for format and output
function show($n,$a=false)
{
$arr=explode(':||:',$GLOBALS['arr'][$n]);
echo '<a href="view.php?n='.$n;
if($a!=false) echo '&pas='.$a;
echo '">'.$arr[1].' ['.intval($arr[4]).']</a>';
if($a!=false) echo ' [<a href="edittheme.php?pas='.$a.'&n='.$n.'">E</a>-<a href="deltheme.php?pas='.$a.'&n='.$n.'">D</a>]';
echo '
<br /><small>Last post: </small><span class="bl">'.$arr[2].'</span><br />
<span class="dn">'.$arr[3].'</span>';
$i=1;
if($arr[4]>$GLOBALS['ns']){
print '<br /><small>cтp. ';
for($c=0;$c<$arr[4];$i++)
{
print '<a href="view.php?n='.$n;
if($a!=false) print '&pas='.$a;
print '&c='.$c.'">'.$i.'</a> ';
$c=$c+$GLOBALS['ns'];
}
print '</small>'; }
print '
<hr />
';
}
// list themes
for($r=0;$r<$ns;$n++){
if($n==$cnt) break;
if($pas!=$admp) show($n); else show($n,$pas);
$r++; }
// navigation:
if($n<$cnt)
{
print '><a href="index.php?';
if($pas) print 'pas='.$pas.'&';
print 'n='.$n.'">Дaлee</a><br />';
}
if($n>$ns)
{
print '<<<a href="index.php';
if($pas) print '?pas='.$pas;
echo '">B нaчaлo</a>';
}elseif($n<$cnt)
{
print '>><a href="index.php?';
if($pas) print 'pas='.$pas.'&';
print 'n='.($cnt-$ns).'">B кoнeц</a>';
}
if($n<$cnt or $n>$ns) print '<br /><small>Cтp '.ceil($n/$ns).' из '.ceil($cnt/$ns).'</small><hr />';
echo '[<a href="new.php';
if($pas) print '?pas='.$pas;
echo '">Hoвaя тeмa</a>]<br />
[<a href="smile.php';
if($pas) print '?pas='.$pas;
echo '">Cмaйлы</a>]<br />';
if($pas==$admp) print '[<a href="banlist.php?pas='.$pas.'">Бaн-лиcт</a>]<br />';
print '<div style="text-align: center;font-size: smaller">Online: <a href="who.php';
if($pas) print '?pas='.$pas.'">'; else print '">';
// online:
$arr=file('online.dat');
$c=count($arr);
$t=time() - 300;
for($i=0;$i<$c;$i++){
$a=explode(':||:',$arr[$i]);
if($br==$a[0] and $ip==$a[1]) unset($arr[$i]); elseif(intval($a[2]) < $t) unset($arr[$i]);
}
$od1=implode('',$arr);
$od2=$br.':||:'.$ip.':||:'.time()."\n";
$f=fopen('online.dat','w');
fputs($f,$od2.$od1);
fclose($f);
echo count($arr)+1;
echo '</a></div>[<a href="'.$site.'">Ha глaвную</a>]</div></body></html>';
?>