File size: 1.73Kb
<?php
// Вау, работает, правда опять траблы с моторолой :(
// механизм кодирования в юникод
function unicode ($s) { if ( (ord($s)>=192) & (ord($s)<=255) ) $hexvalue=dechex(ord($s)+848); if ($s=="Ё") $hexvalue="401"; if ($s=="ё") $hexvalue="451"; return("�".$hexvalue.";");}
function utf_encode ($s) { return(preg_replace("/[А-яЁё]/e","unicode('\\0')",$s));}
header("Content-type:text/vnd.wap.wml;charset=utf-8");
print "<?xml version=\"1.0\"?>\n";
print "<wml>\n";
print "<card title=\"".utf_encode("Гостевая")."\">\n";
$xfile = @file("por.txt");
$p = 5;
if ($npage == ""){$npage = "1";}
$first = count($xfile) - ($p * ($npage - 1));
$second = count($xfile) - ($p * $npage) + 1;
if ($second < 1) {$second = 1;}
$npages = (int)(count($xfile) / $p);
if ($news_limiter>((int) ($npages*$p))) $npages = $npages+1;
if ($npage <= $npages and $npage>1) $gline_rew = "<a href=\"pros.php?npage=".($npage-1)."\">".utf_encode("Назад")."</a>";
if ($npages > 1 and $npage<$npages) $gline_next = "<a href=\"pros.php?npage=".($npage+1)."\">".utf_encode("Вперед")."</a>";
$line = " | ";
for ($p = 1; $p <= $npages; $p++) {
if ($p != $npage) { $line .= "<a href=\"pros.php?npage=$p\"> $p </a>|";}
if ($p == $npage) { $line .= "$p |"; }
}
print $line;
for ($i = $first-1; $i >= $second-1; $i--) {
$ii = $i;
$ii++;
$udata = explode("::",$xfile[$i]);
$names = $udata[0];
$mess = $udata[1];
$data = $udata[2];
print "<p>".utf_encode("Имя")." = $names<br/>".utf_encode("Сообщение")." = $mess<br/>".utf_encode("Время")." = $data<br/>==".$i."== </p>";
}
print $gline_rew." :: ".$gline_next."<br/>";
print "</card></wml>\n";
?>