<?php
header("Content-type: text/vnd.wap.wml");
header("Cache-Control: no-store, no-cache, must-revalidate");
include("header.php");
echo "<wml>";
echo "<card title=\"&#169;Vidzo gb\"><p align=\"center\">"; $id=$_GET["id"];  if($id=="") { echo"<b>Mano gb!</b><br/>----------<br/><a href=\"knyga.php?id=raso\">Rasyti</a><br/>"; $zinute=explode("-",file_get_contents("1.txt"));
$nickas=explode("-",file_get_contents("2.txt"));
  $skaicius=count($zinute); padarome kad noretume matyti 5zin,  $puslapeliu=$skaicius/5; $psl=$_GET["psl"]; if($psl=="") { $psl="1"; }   $puslapeliu=ceil($puslapeliu);  $nuo=$psl*5-5; $iki=$psl*5;  for($i=$nuo; $i<$iki; $i++) {  if(!empty($zinute[$i])) { echo"<a href=\"knyga.php?id=apie&amp;b=$i\">$nickas[$i]:</a> $zinute[$i]<br/>"; }  } if($psl<$puslapeliu && $iki<$skaicius) { $kiti=$psl+1; echo"<a href=\"knyga.php?psl=$kiti\">Next</a>"; }  if($psl>1) { $darkiti=$psl-1; echo"<a href=\"knyga.php?psl=$darkiti\">Back</a>"; }  }  if($id=="raso") { echo"Zinute:<br/>"; echo"<input name=\"z\" type=\"text\" maxlength=\"220\"/><br/>Nickas:<br/><input name=\"n\" type=\"text\" maxlength=\"20\"/><br/><anchor>Rasyti<go href=\"knyga.php?id=tikrina\" method=\"post\"><postfield name=\"z\" value=\"$(z)\"/><postfield name=\"n\" value=\"$(n)\"/></go></anchor>";  }  if($id=="tikrina") { $z=$_POST["z"]; $n=$_POST["n"]; $z=str_replace("-","",$z);
 $n=str_replace("-","",$n);  $z1=strlen($z);
$n1=strlen($n);  $z=htmlspecialchars($z);
$n=htmlspecialchars($n);   if(empty($n)) { $klaida="Yrasyk nicka!"; } else if($n1>20) { $klaida="Per ilgas nick!"; }  if(empty($z)) { $klaida=="Irasyk zinute!"; } else if($z1>220) { $klaida="Per ilga zinute!"; }  if(!empty($klaida)) { echo $klaida; } else { echo"Irasyta!<br/><a href=\"knyga.php\">I knyga</a>"; $pirmas=@file_get_contents("1.txt");
$antras=@file_get_contents("2.txt");
$trecias=@file_get_contents("3.txt"); file_put_contents("1.txt","$z-$pirmas");
file_put_contents("2.txt","$n-$antras"); $d=Date("Y/m/d | H:i:s");  $ip=$ADDR_REMOTE;  list($narsykle)=explode("/",$HTTP_USER_AGENT); file_put_contents("3.txt","Data: $d<br/>IP: $ip<br/>Narsykle: $narsykle-$trecias");  } }
 if($id=="apie") {  $b=$_GET["b"]; $duomenukai=explode("-",file_get_contents("3.txt")); echo"<b>Komentaro duomenys</b><br/>----------<br/>";  echo $duomenukai[$b]; echo"<br/>----------<br/><a href=\"knyga.php\">I knyga</a>";   }
echo"<br/><small>&#169;Vidzas 2007</small></p></card></wml>"; ?> 