Просмотр файла dl/allkomm.php

Размер файла: 5.25Kb
<?php
#********************************** AgS MOD DOWNLOAD CENTR SEA *************************************#
#***************************************************************************************************#
#  /||||||||||||||| *********************  /||||||||||||||| *********************  /||||||||||||||| #
# | ||||||||||||||| ********************* | ||||||||||||||| ********************* | ||||||||||||||| #
# | |||||/////||||| ********************* | |||||/////////  ********************* | |||||/////////  #
# | |||||   | ||||| ****** E-MAIL ******* | |||||           ****** WAP/WEB ****** | |||||           #
# | |||||   | ||||| *** [email protected] *** | |||||           * http://ags.h2m.ru * | ||||||||||||||| #
# | |||||   | ||||| ********************* | ||||||||||||||| ********************* | ||||||||||||||| #
# | |||||   | ||||| ********************* | |||||/////||||| ********************* |///////////||||| #
# | ||||||||||||||| ****** SKYPE ******** | |||||   | ||||| ***** MOD AUTHOR ****           | ||||| #
# | |||||////|||||| ***** agrizz15 ****** | |||||   | ||||| ***** Agris Cišs ****  /||||||||||||||| #
# | |||||   | ||||| ********************* | ||||||||||||||| ********************* | ||||||||||||||| #
# |/////    |/////  ********************* |///////////////  ********************* |///////////////  #
#***************************************************************************************************#
#********************************* MOD by AgS in 2010 @ LATVIA *************************************#


require_once"system/start.php";
require_once"system/config.php";
require_once"system/db.php";
require_once"system/head.php";
require_once"lng/$setup[lng]/lng.php";
require_once"system/functions.php";
require_once"system/cookies.php";
require_once"system/counter.php";
include_once"thm/$setup[thm]/index.php";
include_once"system/msg.php";

/* Aizliedzam atvērt */
if($setup['modulis_komentari']){


$page = intval($_GET['page']);

$onpage = iegut_sesiju('onpage');
ir_numurs($onpage,'onpage');

$file_info_real = mysql_fetch_array(mysql_query('SELECT * FROM `'.$MY_pre.'faili` '));


if ($setup['adnick']==$_SESSION['log'] && $setup['adpass']==md5($_SESSION['par']) && $_SESSION['log']!="" && md5($_SESSION['par'])!="") {
$query = mysql_query('SELECT * FROM `'.$MY_pre.'komentari`  ORDER BY `time` DESC');}else{
$query = mysql_query('SELECT * FROM `'.$MY_pre.'komentari`  ORDER BY `time` DESC LIMIT '.$setup['top_num']);}

while($list_sw = mysql_fetch_array($query)){
$array_id[] = $list_sw['id'];
}
$all = sizeof($array_id);


// Nosaukums 
echo'<img src="pic/main/comments.gif" alt=""><b> '.com_018.' '.com_019.'</b><br><br>';

$n = 0;
$pages = ceil($all/$onpage);
if($page>$pages or $page<=0) $page=1;
if(!$pages) $pages = 1;
if($page) $n = ($onpage*$page)-$onpage;

if(!$all){ echo '<div class="b">'.com_009.'</div>';}

for($i=1; $i<=$onpage; $i++){
if(!isset($array_id[$n])){
$n++;
continue;}

$komments = mysql_fetch_array(mysql_query('SELECT * FROM `'.$MY_pre.'komentari` WHERE `id` = '.$array_id[$n]));
$d = mysql_fetch_assoc(mysql_query('SELECT `name` FROM `'.$MY_pre.'faili` WHERE `id` = '.$komments['file_id'].' LIMIT 1'));

echo '<a href="about.php?id='.$komments['file_id'].'">'.$d['name'].'</a>';
if ($setup['adnick']==$_SESSION['log'] && $setup['adpass']==md5($_SESSION['par']) && $_SESSION['log']!="" && md5($_SESSION['par'])!="") {
echo ' |<a href=admin.php?act=allkom_delete&amp;page='.$page.'&amp;id='.$array_id[$n].'"><font color="red"> DEL</font></a>';
}

 //Datu iegūšana un apstrāde 
$row = '<div class="b">';                                        ## Stils
$komments = mysql_fetch_array(mysql_query('SELECT * FROM `'.$MY_pre.'komentari` WHERE `id` = '.$array_id[$n]));
$komments['time'] = date('d.m.Y/H:i', $komments['time']);        ## Laiks
$komments['text'] = str_replace("\n", '<br>',$komments['text']); ## Teksts

 //Izvade 
echo $row ; ## Stils
echo '<b>'.$komments['name'].'</b> ('.$komments['time'].')<br>'.$komments['text'];
echo '</div><br>';

$n++;
}

/* Lapu izvade */
if($all > 1) {
echo '<br>'.sys_pages.': ';
$asd = $page - 2;
$asd2 = $page + 3;
if($asd<$all && $asd>0 && $page>3) echo ' <a href="allkomm.php?page=1&amp;id='.$id.'">1</a> ... ';
for($i=$asd; $i<$asd2;$i++){
if($i<$all && $i>0){
if ($i > $pages ) break;
if ($page==$i){
echo '<b>['.$i.']</b> ';}else{ 
echo '<a href="allkomm.php?page='.$i.'&amp;id='.$id.'">'.$i.'</a> ';}
}}
if ($i <= $pages){
if($asd2<$all) {
echo ' ... <a href="allkomm.php?page='.$pages.'&amp;id='.$id.'">'.$pages.'</a>';}}
echo '<br><br>';}

/* Lejas izvēlne */
echo '<img src="pic/main/dot.gif" alt=""> <a href="index.php?id='.$back['id'].'&amp;'.SID.'">'.sys_category.'</a><br>';
echo '<img src="pic/main/dot.gif" alt=""> <a href="index.php?'.SID.'">'.sys_dl.'</a><br>';
echo '<img src="pic/main/home.gif" alt=""> <a href="'.$setup['home'].'/?'.SID.'">'.sys_home.'</a><br>';

/* Komentāru automātiskā attīrīšana */
if($all > $setup['klimit']){
$max = mysql_fetch_row(mysql_query('SELECT MIN(`id`) FROM `'.$MY_pre.'komentari`;'));
mysql_query('DELETE FROM `'.$MY_pre.'komentari` WHERE `id` = '.$max[0]);
$page=1;
}
} else { header ("Location: index.php?sayer=404&".SID); exit;}


include_once"thm/$setup[thm]/foot.php";

?>