$id = explode("/", $REQUEST_URI); $strona="felietony"; require("functions.inc.php"); if($action=="ocen"){ $zap = "SELECT * FROM $table_fel WHERE id='$idf'"; $wyk = mysql_query($zap); while($rzad = mysql_fetch_array($wyk)){ $ocena_users=$rzad['ocena_users']; $votes=$rzad['votes']; } $suma=$ocena_users*$votes; $suma_new=$suma+$ocena; $votes_new=$votes+1; $ocena_new=$suma_new / $votes_new; $zap = "UPDATE $table_fel SET ocena_users='$ocena_new', votes='$votes_new' WHERE id='$idf'"; $wyk = mysql_query($zap); setcookie('iik_votesf_'.$idf, tak); Header("Location: ../felietony.php/$idf"); exit(); } gora(); if($id[2]==""){ if($s==""){ $s="data DESC"; } if($s=="data"){ $s="data DESC"; } if($s=="ocena_users"){ $s="ocena_users DESC"; } if($s=="wys"){ $s="wys DESC"; } if($str==""){ $str="1"; } $pocz=($str-1)*$felnastr; $kon=$pocz+$felnastr; $zap = "SELECT * FROM $table_fel WHERE status='1'"; $wyk = mysql_query($zap); $i = mysql_num_rows($wyk); echo("
F e l i e t o n y (ilość: $i)
"); if($i>$felnastr){ echo("");
$max=ceil($i/$felnastr);
if($str!=1){
$a=5;
$st=$str-$a;
while($st<=0){
$a--;
$st=$str-$a;
}
$stp=$str-1;
echo("<<< ");
if($str>6){ echo("1... "); }
do{
echo("$st ");
$a--;
$st=$str-$a;
}while($a>0&&$st>0);
}
echo("$str ");
if($str!=$max){
$b=1;
$st=$str+$b;
do{
echo("$st ");
$b++;
$st=$str+$b;
}while($b<6&&$st<=$max);
}
echo("z $max");
if($str!=$max){
$stn=$str+1;
echo(" >>\">>>>");
}
echo("
| $tytulf |
| $tresc[0] [więcej...] Autor:".$rzad['autor']." Dodano: $data |
| |
");
$max=ceil($i/$felnastr);
if($str!=1){
$a=5;
$st=$str-$a;
while($st<=0){
$a--;
$st=$str-$a;
}
$stp=$str-1;
echo("<<< ");
if($str>6){ echo("1... "); }
do{
echo("$st ");
$a--;
$st=$str-$a;
}while($a>0&&$st>0);
}
echo("$str ");
if($str!=$max){
$b=1;
$st=$str+$b;
do{
echo("$st ");
$b++;
$st=$str+$b;
}while($b<6&&$st<=$max);
}
echo("z $max");
if($str!=$max){
$stn=$str+1;
echo(" >>\">>>>");
}
echo("
$zap = "UPDATE $table_fel SET wys=wys+1 WHERE id='$id[2]'";
$wyk = mysql_query($zap);
$zap = "SELECT * FROM $table_fel WHERE id='$id[2]'";
$wyk = mysql_query($zap);
while($rzad = mysql_fetch_array($wyk)) {
$tytul=$rzad['tytul'];
$autor=$rzad['autor'];
$email=$rzad['email'];
$data=$rzad['data'];
$tresc=$rzad['tresc'];
$ocena_users=$rzad['ocena_users'];
$votes=$rzad['votes'];
}
echo("
K O M E N T A R Z E (ilość: $i) "); if($i=="0") { echo("Brak komentarzy do tego felietonuDodaj swój komentarz"); } else { $zap = "SELECT * FROM komentarze_fel WHERE idf='$id[2]' ORDER BY id DESC LIMIT 0, $kompodmat;"; $wyk = mysql_query($zap); while($rzad = mysql_fetch_array($wyk)) { echo("
|