if ($id==1): ?>
endif; ?>
if ($id==2) {
if(($Autor=="") or ($Tresc==""))
{
print(" Nie wypełniłe¶ wszytkich pól ! ");
print("Powrót do formularza ");
print("Powrót do księgi ");
}
if(($Autor<>"") && ($Tresc<>"")) {
$Tresc = ereg_replace("<","<", $Tresc);
$Tresc = ereg_replace(">",">", $Tresc);
$Tresc = ereg_replace("\n", " ", $Tresc);
$nazwa = "ksiega.txt";
if (ereg(".pl", $web)) {
$web="moja strona: $web ";
}
else {
$web="";
};
if ($adres=="") {
$adres="nie podano adresu e-mail";
$wpis = "".date("d.m.Y")." g. ".date("H.i")." $Autor $adres $web $Tresc\n";
}
else {
$wpis = "".date("d.m.Y")." g. ".date("H.i")." $Autor $adres $web $Tresc\n";
};
$myFile = fopen($nazwa, "r+");
$wpis=$wpis.fread($myFile, filesize($nazwa));
rewind($myFile);
fputs($myFile, $wpis);
fclose($myFile);
print("Dziękujemy za wpis! ");
print("Powrót ");
}
}
elseif (($id<>1) && ($id<>2)) {
print "";
print "Dodaj wpis";
print ("liczba wpisów w księdze: ");
$nazwa = "ksiega.txt";
$myFile = fopen($nazwa, "r");
$i=0;
while(!feof($myFile)) {
$myLine = fgets($myFile, 2000);
$i++;
}
fclose($myFile);
print(" $i
");
print "
";
$nazwa = "ksiega.txt";
$myFile = fopen($nazwa, "r");
$k=1;
$end=$st+9;
while(!feof($myFile))
{
$myLine = fgets($myFile, 2000);
if ($k>=$st) {
if ($k<=$end) {
print("$myLine
");
};
};
$k++;
}
fclose($myFile);
print("strony ");
$ile=floor($i/10);
$ctpage=floor($st/10)+1;
for ($z=0;$z<=$ile;$z++) {
$y=$z+1;
if ($y==$ctpage) {print (" $y ");}
else {print (" $y ");}
};
print ("");
}
?>
|