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

Размер файла: 6.83Kb
<?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";


/* Pārbaudam meklētāja ieslēgumu */
if($setup['search_change']){
/* Datu pārbaude */
$onpage = iegut_sesiju('onpage');
$sort = iegut_sesiju('sort');
$id = intval($_GET['id']);
$page = intval($_GET['page']);
$page = $page ? $page : 1;
ir_numurs($onpage,'onpage');

echo '<img src="pic/main/search.gif" alt=""><b> '.sys_src.'</b><br>';

/* Ievades forma */
if(!$_GET['act']){
echo '<form action="search.php?act=search&'.SID.'" name="form"  method="post"><br>';
echo '<b>'.src_002.':</b><br>';
echo '<input name="word" type="text" maxlength="20" value=""><br><br>';
echo '<input type="submit" value="'.sys_find.'"></form><br>';

echo '<img src="pic/main/dot.gif" alt=""> <a href="index.php">'.sys_dl.'</a><br>';
echo '<img src="pic/main/home.gif" alt=""> <a href="'.$setup['home'].'">'.sys_home.'</a>';
include_once"thm/$setup[thm]/foot.php";
}



/* Datu izvade */
if($_GET['act']=='search'){

/* Datu pārbaude */
if(!$_REQUEST['word']) die (src_006.'<br>'
);
$word = tirit(dzest(griezt($_REQUEST['word'],15)));
$word_search_query = mysql_query("SELECT * FROM `".$MY_pre."faili` WHERE `name` LIKE '%".$word."%' AND `size` > 0");
$i = 0;
while($result = mysql_fetch_array($word_search_query)) $array_id[] = $result['id'];
$all = count($array_id);

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

echo '<br>'.dl_127.' "'.stripslashes($word).'" '.dl_131.' '.$all.' '.sys_file_s.'<br><br>';

if($all == 0){ 
echo '<br>'.src_010.'<br><br>';
}

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

if(is_integer($n / 2)) $row = '<div class="b">'; else $row = '<div class="b">';

$file_info = mysql_fetch_array(mysql_query('SELECT * FROM `'.$MY_pre.'faili` WHERE `id` = '.$array_id[$n]));
$backdir = @mysql_fetch_array(mysql_query("SELECT * FROM `".$MY_pre."faili` WHERE `path` = '".$file_info['infolder']."'"));
$basename = basename($file_info['path']);
$ex = pathinfo($file_info['path']);
$ext = strtolower($ex['extension']);
$name_file = str_replace('.'.$ex,'',$basename);

/* Translējam */
if(strpos($basename , '!') !== false){
$name_file = trans($name_file);}else{
$name_file = trans2($name_file);}

/* Skaists izmērs */
$file_info['size'] = izmers($file_info['size']) ;

/* Jauna faila noteikšana */
$new_info = '';
$filtime2 = $file_info['timeupload']+(3600*24*$setup['day_new']);
if($filtime2>=$time){
$new_info = '<font color="#00AF00">NEW</font>';
}

/* Priekšskats */
$pre = '';
if($setup['modulis_preview']==ON){
if($ext == 'bmp'){
$pre = '';}elseif($ext == 'gif' or $ext == 'jpeg' or $ext == 'jpe' or $ext == 'jpg' or $ext == 'png'){
$pre = '<img style="margin:1px;" src="screen_pic.php?id='.$file_info['id'].'" alt=""/><br>';
}}

/* Faila ikona */
if ($ext !== 'gif' && $ext !== 'jpeg' && $ext !== 'jpg' && $ext !== 'png'){
if(!file_exists('pic/icons/'.$ext.'.gif')){ 
$ico = '<img src="pic/icons/other.gif" alt="">';}else{ 
$ico = '<img src="pic/icons/'.$ext.'.gif" alt="">';}
}else{
$ico = '';}

/* Formāta izvade */
if($setup['ext']==1){
$extension = '('.$ext.')';}else{
$extension = '';}

/* Tieši izvade */
echo $row;
echo $pre;
echo $ico.'<b><a href="about.php?id='.$file_info['id'].'">'.$name_file.'</a></b>';
echo $extension;
echo $file_info['size'];
echo '[<a href="index.php?id='.$backdir['id'].'">>></a>]<br></div>';

$n++;
}


/* Lapu izvade un navigācija */
if($all > 1) {
echo '<br>'.sys_pages.': ';
$asd = $page - 2;
$asd2 = $page + 3;
if($asd<$all && $asd>0 && $page>3){
echo '<a href="search.php?act=search&amp;page=1&amp;onpage='.$onpage.'&amp;word='.$word.'">1</a> ... ';}
for($i=$asd; $i<$asd2;$i++){
if($i<$all && $i>0){
if($i > $pages) break;
if($page==$i){
echo '<strong>['.$i.']</strong> ';}else{
echo '<a href="search.php?act=search&amp;page='.$i.'&amp;onpage='.$onpage.'&amp;word='.$word.'">'.$i.'</a> ';}}}
if($i <= $pages){
if($asd2<$all) echo ' ... <a href="search.php?act=search&amp;page='.$pages.'&amp;onpage='.$onpage.'&amp;word='.$word.'">'.$pages.'</a>';}
echo '<br>';}

/* Ar roku vadītas lapas */
if($pages>$setup['pagehand'] and $setup['pagehand_change'] == 1){
echo '<br>'.sys_pgg.' '.$page.' '.sys_at.' '.$pages.':<br>';
echo '<form action="search.php" method="get">';
echo '<input name="act" type="hidden" value="search">';
echo '<input name="word" type="hidden" value="'.$word.'">';
echo '<input name="page" type="text" maxlength="4" size="8">';
echo '<input type="submit" value=" »"></form>';}

/* Leja */
echo '<img src="pic/main/dot.gif" alt=""> <a href="search.php?onpage='.$onpage.'&amp;id='.$id.'&amp;'.SID.'">'.sys_find.'</a><br>';
echo '<img src="pic/main/dot.gif" alt=""> <a href="index.php?onpage='.$onpage.'&amp;'.SID.'">'.sys_dl.'</a><br>';
echo '<img src="pic/main/home.gif" alt=""> <a href="'.$setup['home'].'/?'.SID.'">'.sys_home.'</a><br>';
} else { header ("Location: index.php?sayer=404&".SID); exit;}

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

?>