Вход Регистрация
Файл: vsime.com/search/inc/act_files.php
Строк: 415
<?
    $unique_code 
"unique_code";
    
$title .= ' - Поиск файлов';
    
ex_head();
    
$cases_array = array('pictures' => 'Картинки''musics' => 'Музыка''videos' => 'Видео''games' => 'Игры''programs' => 'Программы''gifs' => 'Анимашки''themes' => 'Темы''articles' => 'Статьи, документы''books' => 'Книги''flash' => 'Флэш''others' => 'Прочее');
    if (isset(
$moderate_files))$skp NULL; else $skp " `sk` = '0' AND";
    
$case my_esc(@$_GET['case']);
    
$query NULL;
    if (isset(
$_GET['query']))$query esc(stripcslashes(hsc(search_str($_GET['query']))));
    if (isset(
$_POST['query']))$query esc(stripcslashes(hsc(search_str($_POST['query']))));
    if (isset(
$cases_array[$case])) {
        if (isset(
$_GET['from'])) {
            
$from my_esc($_GET['from']);
            if (
$from == 'files_zone') {
                
$from_fur "&from=files_zone";
                
$from_url "?act=files&query=$query$from_fur";
            } else {
                
$from NULL;
                
$from_fur NULL;
            }
        } else {
            
$from NULL;
            
$from_fur NULL;
        }
        if (
trim($query)) {
            
$others_where NULL;
            foreach (
$cases_array AS $key => $value) {
                
$fz_dir_for mysqli_fetch_array(mysqli_query($dbi"SELECT * FROM `files_zone` WHERE `name` = '$value' LIMIT 1"));
                if (@
$fz_dir_for['id'])$others_where .= " AND `counter` NOT LIKE '%/$fz_dir_for[id]/%'";
                if (
$case == $key) {
                    if (@
$fz_dir_for['id']) {
                        
$count_results mysqli_result("SELECT COUNT(*) FROM `files_zone` WHERE `name` LIKE '%".my_esc($query)."%' AND (`type` = 'file' OR `type` = 'foto')".($value == 'others'?$others_where:" AND `counter` LIKE '%/$fz_dir_for[id]/%'")."");
                        
$count_pages navi :: count_pages($count_results);
                        
$page navi :: page();
                        
$start navi :: start_pages();
                        if (!
$count_results) {
                            
list_empty("Поиск не дал результатов");
                        }
                        
$query_files mysqli_query($dbi"SELECT * FROM `files_zone` WHERE `name` LIKE '%".my_esc($query)."%' AND (`type` = 'file' OR `type` = 'foto')".($value == 'others'?$others_where:" AND `counter` LIKE '%/$fz_dir_for[id]/%'")."");
                        while (
$post_file mysqli_fetch_array($query_files)) {
                            if (
$post_file['type']=='file') {
                                
$file mysqli_fetch_array(mysqli_query($dbi"SELECT * FROM `files` WHERE `id` = '$post_file[id_file]' AND `id_comm` = '0'"));
                                
$file['path']=H."system/files/files/users/user$file[id_user]/dir$file[id_dir]/".$file['id'].".dat";
                                
$file['size']=filesize($file['path']);
                                
$count_komm mysqli_num_rows(mysqli_query($dbi"SELECT * FROM `files_komm` WHERE$skp `id_comm` = '0' AND `id_file` = '$file[id]'"));
                                
$count_komm_new mysqli_num_rows(mysqli_query($dbi"SELECT * FROM `files_komm` WHERE$skp `id_comm` = '0' AND `id_file` = '$file[id]' AND `time` > '".($time-(3600*24))."'"));
                                
$count_komm_show $count_komm.($count_komm_new>0?"/+$count_komm_new":NULL);
                                echo 
"<div class='list'>n";
                                    echo 
"<div class='left'>n";
                                    if (isset(
$_SESSION['files_zone_multi_select']) && isset($moderate_files))echo "<input type='checkbox' name='multi_select_file_$post_file[id]' value='1'".(in_array($post_file['id'], $_SESSION['files_zone_multi_select'])?" CHECKED":NULL)." />n";
                                    echo 
ffs_screen($file['id'], 'file'WapWeb_show(4896), WapWeb_show(4896));
                                    echo 
"</div>n";
                                    
mysqli_query($dbi"UPDATE `files_zone` SET `name` = '".($file['name']).".".($file['ras'])."' WHERE `id` = '$post_file[id]'");
                                    echo 
"<div class='overfl_hid'>n";
                                        echo 
"<a href='/files/?file=$file[id]'>n";
                                        if (
is_file(H.'/i/file_type/'.$file['ras'].'.png'))echo "<img src='/i/file_type/$file[ras].png' alt='$file[ras]' /> n";
                                        else echo 
"<img src='/i/file_type/file.png' alt='file' /> n";
                                        echo 
hsc($file['name']).".".hsc($file['ras'])."</a> ($count_komm_show)n";
                                        echo 
"<br />n";
                                        echo 
"<img src='/i/site/download.png' /> Размер: ".size_file($file['size'])."<br />n";
                                        
                                
$audio_rasar = array('amr''mid''midi''mmf''mp3''wav''wma');
                                if (
in_array($file['ras'], $audio_rasar) && $config['web']==true)
                                {
                                
?>
                                <div class="mediaspace">
                                    <script language="JavaScript" src="/i/swf/audio-player.js"></script>
                                        <object type="application/x-shockwave-flash" data="/i/swf/player.swf" id=audioplayer<? echo $file['id'];?> height="24" width="530">
                                        <param name=movie value="/i/swf/player.swf"></param>
                                        <param name=FlashVars value="playerID=audioplayer<? echo $file['id'];?>&soundFile=<? echo "/files/download/".md5($file['id'])."/$unique_code/$mdp/".file_name_html($file['name']).".".hsc($file['ras'])."";?>">
                                        </param>
                                        <param name=quality value=high></param>
                                        <param name=menu value=false></param>
                                        <param name=wmode value=transparent></param>
                                    </object>
                                </div>
                                <?
                                
}
                                    echo 
"</div>n";
                                    echo 
"<div class='clear'></div>n";
                                echo 
"</div>n";
                            } elseif (
$post_file['type']=='foto')
                            {
                                
$foto mysqli_fetch_array(mysqli_query($dbi"SELECT * FROM `foto` WHERE `id` = '$post_file[id_file]'"));
                                
$foto['path']=H."system/files/fotos/d$foto[id_dir]/".$foto['id'].".dat";
                                
$foto['size']=filesize($foto['path']);

                                
$count_komm mysqli_num_rows(mysqli_query($dbi"SELECT * FROM `foto_komm` WHERE$skp `id_foto` = '$foto[id]'"));
                                
$count_komm_new mysqli_num_rows(mysqli_query($dbi"SELECT * FROM `foto_komm` WHERE$skp `id_foto` = '$foto[id]' AND `time` > '".($time-(3600*24))."'"));
                                
$count_komm_show $count_komm.($count_komm_new>0?"/+$count_komm_new":NULL);
                                echo 
"<div class='list'>n";
                                    echo 
"<div class='left'>n";
                                    if (isset(
$_SESSION['files_zone_multi_select']) && isset($moderate_files))echo "<input type='checkbox' name='multi_select_file_$post_file[id]' value='1'".(in_array($post_file['id'], $_SESSION['files_zone_multi_select'])?" CHECKED":NULL)." />n";
                                    echo 
ffs_screen($foto['id'], 'foto'WapWeb_show(4896), WapWeb_show(4896));
                                    echo 
"</div>n";
                                    
mysqli_query($dbi"UPDATE `files_zone` SET `name` = '$foto[name].$foto[ras]' WHERE `id` = '$post_file[id]'");
                                    echo 
"<div class='overfl_hid'>n";
                                        echo 
"<a href='/fotos/?foto=$foto[id]'>n";
                                        if (
is_file(H.'/i/file_type/'.$foto['ras'].'.png'))echo "<img src='/i/file_type/$foto[ras].png' alt='$foto[ras]' /> n";
                                        else echo 
"<img src='/i/file_type/file.png' alt='file' /> n";
                                        echo 
hsc($foto['name']).".".hsc($foto['ras'])."</a> ($count_komm_show)n";
                                        echo 
"<br />n";
                                        echo 
"<img src='/i/site/download.png' /> Размер: ".size_file($foto['size'])."<br />n";
                                    echo 
"</div>n";
                                    echo 
"<div class='clear'></div>n";
                                echo 
"</div>n";
                            }
                        }
                        
pages_show("?act=files&case=$case&query=$query$from_fur&");
                        
$show_search_form true;
                    } else {
                        
show_errors("Произошла ошибка на стороне сервера. Обратитесь к администрации сайта.");
                    }
                    
$showed true;
                }
            }
            if (!isset(
$showed)) {
                
show_errors("Произошла ошибка на стороне сервера. Обратитесь к администрации сайта.");
            }
        } else {
            
$show_word true;
            
$show_search_form true;
        }
        if (isset(
$show_search_form)) {
            echo 
"<form method='POST' action='?act=files&case=$case$from_fur'>n";
                if (isset(
$show_word))echo "Что будем искать?<br />n";
                else {
                    echo 
"<b>Поиск:</b> «".($query)."»<br />";
                }
                echo 
"<input type='text' style='width: 98%; margin: 0px; padding: 4px 0px; vertical-align: middle;line-height: 100%;border: 1px solid #ccc;' name='query' value='' />n";
                echo 
"<div class='freespace'>n";
                    echo 
"<input type='submit' name='submited' style='line-height: 19px;  margin-top: 0;' value='Найти'/>n";
                echo 
"</div>n";
            echo 
"</form>n";
        }
        echo 
"<div class='foot'>n";
            echo 
image_back()."<a href='".($from?$from_url:"?query=$query")."'>Назад</a>n";
        echo 
"</div>n";
    } else {
        if (isset(
$_GET['from'])) {
            
$from my_esc($_GET['from']);
            if (
$from == 'files_zone') {
                
$from_fur "&from=files_zone";
                
$from_url "/files_zone";
            } else {
                
$from NULL;
                
$from_fur NULL;
            }
        } else {
            
$from NULL;
            
$from_fur NULL;
        }
        
$query NULL;
        if (isset(
$_GET['query']))$query esc(stripcslashes(hsc(search_str($_GET['query']))));
        if (isset(
$_POST['query']))$query esc(stripcslashes(hsc(search_str($_POST['query']))));
        if (
trim($query)) {
            
$others_where NULL;
            
$fz_dir_for_pictures mysqli_fetch_array(mysqli_query($dbi"SELECT * FROM `files_zone` WHERE `name` = 'Картинки' LIMIT 1"));
            if (@
$fz_dir_for_pictures['id']) {
                
$others_where .= " AND `counter` NOT LIKE '%/$fz_dir_for_pictures[id]/%'";
                
$count_founded_pictures mysqli_result("SELECT COUNT(*) FROM `files_zone` WHERE `name` LIKE '%".my_esc($query)."%' AND `counter` LIKE '%/$fz_dir_for_pictures[id]/%' AND (`type` = 'file' OR `type` = 'foto')");
            } else 
$count_founded_pictures 0;
            
// картинки
            
$fz_dir_for_musics mysqli_fetch_array(mysqli_query($dbi"SELECT * FROM `files_zone` WHERE `name` = 'Музыка' LIMIT 1"));
            if (@
$fz_dir_for_musics['id']) {
                
$others_where .= " AND `counter` NOT LIKE '%/$fz_dir_for_musics[id]/%'";
                
$count_founded_musics mysqli_result("SELECT COUNT(*) FROM `files_zone` WHERE `name` LIKE '%".my_esc($query)."%' AND `counter` LIKE '%/$fz_dir_for_musics[id]/%' AND (`type` = 'file' OR `type` = 'foto')");
            } else 
$count_founded_musics 0;
            
// музыка
            
$fz_dir_for_videos mysqli_fetch_array(mysqli_query($dbi"SELECT * FROM `files_zone` WHERE `name` = 'Видео' LIMIT 1"));
            if (@
$fz_dir_for_videos['id']) {
                
$others_where .= " AND `counter` NOT LIKE '%/$fz_dir_for_videos[id]/%'";
                
$count_founded_videos mysqli_result("SELECT COUNT(*) FROM `files_zone` WHERE `name` LIKE '%".my_esc($query)."%' AND `counter` LIKE '%/$fz_dir_for_videos[id]/%' AND (`type` = 'file' OR `type` = 'foto')");
            } else 
$count_founded_videos 0;
            
// видео
            
$fz_dir_for_games mysqli_fetch_array(mysqli_query($dbi"SELECT * FROM `files_zone` WHERE `name` = 'Игры' LIMIT 1"));
            if (@
$fz_dir_for_games['id']) {
                
$others_where .= " AND `counter` NOT LIKE '%/$fz_dir_for_games[id]/%'";
                
$count_founded_games mysqli_result("SELECT COUNT(*) FROM `files_zone` WHERE `name` LIKE '%".my_esc($query)."%' AND `counter` LIKE '%/$fz_dir_for_games[id]/%' AND (`type` = 'file' OR `type` = 'foto')");
            } else 
$count_founded_games 0;
            
// игры
            
$fz_dir_for_programs mysqli_fetch_array(mysqli_query($dbi"SELECT * FROM `files_zone` WHERE `name` = 'Программы' LIMIT 1"));
            if (@
$fz_dir_for_programs['id']) {
                
$others_where .= " AND `counter` NOT LIKE '%/$fz_dir_for_programs[id]/%'";
                
$count_founded_programs mysqli_result("SELECT COUNT(*) FROM `files_zone` WHERE `name` LIKE '%".my_esc($query)."%' AND `counter` LIKE '%/$fz_dir_for_programs[id]/%' AND (`type` = 'file' OR `type` = 'foto')");
            } else 
$count_founded_programs 0;
            
// программы
            
$fz_dir_for_gifs mysqli_fetch_array(mysqli_query($dbi"SELECT * FROM `files_zone` WHERE `name` = 'Анимашки' LIMIT 1"));
            if (@
$fz_dir_for_gifs['id']) {
                
$others_where .= " AND `counter` NOT LIKE '%/$fz_dir_for_gifs[id]/%'";
                
$count_founded_gifs mysqli_result("SELECT COUNT(*) FROM `files_zone` WHERE `name` LIKE '%".my_esc($query)."%' AND `counter` LIKE '%/$fz_dir_for_gifs[id]/%' AND (`type` = 'file' OR `type` = 'foto')");
            } else 
$count_founded_gifs 0;
            
// анимашки
            
$fz_dir_for_themes mysqli_fetch_array(mysqli_query($dbi"SELECT * FROM `files_zone` WHERE `name` = 'Темы' LIMIT 1"));
            if (@
$fz_dir_for_themes['id']) {
                
$others_where .= " AND `counter` NOT LIKE '%/$fz_dir_for_themes[id]/%'";
                
$count_founded_themes mysqli_result("SELECT COUNT(*) FROM `files_zone` WHERE `name` LIKE '%".my_esc($query)."%' AND `counter` LIKE '%/$fz_dir_for_themes[id]/%' AND (`type` = 'file' OR `type` = 'foto')");
            } else 
$count_founded_themes 0;
            
// темы
            
$fz_dir_for_books mysqli_fetch_array(mysqli_query($dbi"SELECT * FROM `files_zone` WHERE `name` = 'Книги' LIMIT 1"));
            if (@
$fz_dir_for_books['id']) {
                
$others_where .= " AND `counter` NOT LIKE '%/$fz_dir_for_books[id]/%'";
                
$count_founded_books mysqli_result("SELECT COUNT(*) FROM `files_zone` WHERE `name` LIKE '%".my_esc($query)."%' AND `counter` LIKE '%/$fz_dir_for_books[id]/%' AND (`type` = 'file' OR `type` = 'foto')");
            } else 
$count_founded_books 0;
            
// книги
            
$fz_dir_for_articles mysqli_fetch_array(mysqli_query($dbi"SELECT * FROM `files_zone` WHERE `name` = 'Статьи, документы' LIMIT 1"));
            if (@
$fz_dir_for_articles['id']) {
                
$others_where .= " AND `counter` NOT LIKE '%/$fz_dir_for_articles[id]/%'";
                
$count_founded_articles mysqli_result("SELECT COUNT(*) FROM `files_zone` WHERE `name` LIKE '%".my_esc($query)."%' AND `counter` LIKE '%/$fz_dir_for_articles[id]/%' AND (`type` = 'file' OR `type` = 'foto')");
            } else 
$count_founded_articles 0;
            
// статьи, документы
            
$fz_dir_for_flashs mysqli_fetch_array(mysqli_query($dbi"SELECT * FROM `files_zone` WHERE `name` = 'Флэш' LIMIT 1"));
            if (@
$fz_dir_for_flashs['id']) {
                
$others_where .= " AND `counter` NOT LIKE '%/$fz_dir_for_flashs[id]/%'";
                
$count_founded_flashs mysqli_result("SELECT COUNT(*) FROM `files_zone` WHERE `name` LIKE '%".my_esc($query)."%' AND `counter` LIKE '%/$fz_dir_for_flashs[id]/%' AND (`type` = 'file' OR `type` = 'foto')");
            } else 
$count_founded_flashs 0;
            
// флэш
            
$count_founded_others mysqli_result("SELECT COUNT(*) FROM `files_zone` WHERE `name` LIKE '%".my_esc($query)."%' AND (`type` = 'file' OR `type` = 'foto')$others_where");
            
// все остальное
            
$count_founded_all $count_founded_pictures $count_founded_musics $count_founded_videos $count_founded_games $count_founded_programs $count_founded_gifs $count_founded_themes $count_founded_books $count_founded_articles $count_founded_flashs $count_founded_others;
            echo 
"<form method='POST' action=''>n";
                echo 
"<b>Поиск:</b> «".($query)."»<br />";
                echo 
"<input type='text' style='width: 65%; margin: 0px; padding: 4px 0px; vertical-align: middle;line-height: 100%;border: 1px solid #ccc;' name='query' value='' />n";

                    echo 
"<input type='submit' name='submited' style='line-height: 19px;  margin-top: 0;' value='Найти'/>n";
                echo 
"</div>n";
            echo 
"</form>n";
            if (
$count_founded_all) {
                echo 
"<div class='list'>n";
                    if (
$count_founded_pictures)echo imgsd('pictures.png')." <a href='?act=files&case=pictures&query=$query$from_fur'>Картинки</a> <span class='counter'>$count_founded_pictures</span><br />n";
                    if (
$count_founded_musics)echo imgsd('musics.png')." <a href='?act=files&case=musics&query=$query$from_fur'>Музыка</a> <span class='counter'>$count_founded_musics</span><br />n";
                    if (
$count_founded_videos)echo imgsd('videos.png')." <a href='?act=files&case=videos&query=$query$from_fur'>Видео</a> <span class='counter'>$count_founded_videos</span><br />n";
                    if (
$count_founded_games)echo imgsd('games.png')." <a href='?act=files&case=games&query=$query$from_fur'>Игры</a> <span class='counter'>$count_founded_games</span><br />n";
                    if (
$count_founded_programs)echo imgsd('programs.png')." <a href='?act=files&case=programs&query=$query$from_fur'>Программы</a> <span class='counter'>$count_founded_programs</span><br />n";
                    if (
$count_founded_gifs)echo imgsd('gifs.png')." <a href='?act=files&case=gifs&query=$query$from_fur'>Анимашки</a> <span class='counter'>$count_founded_gifs</span><br />n";
                    if (
$count_founded_themes)echo imgsd('themes.png')." <a href='?act=files&case=themes&query=$query$from_fur'>Темы</a> <span class='counter'>$count_founded_themes</span><br />n";
                    if (
$count_founded_books)echo imgsd('guestbook.png')." <a href='?act=files&case=books&query=$query$from_fur'>Книги</a> <span class='counter'>$count_founded_books</span><br />n";
                    if (
$count_founded_articles)echo imgsd('article.png')." <a href='?act=files&case=articles&query=$query$from_fur'>Статьи, документы</a> <span class='counter'>$count_founded_articles</span><br />n";
                    if (
$count_founded_flashs)echo imgsd('flashs.png')." <a href='?act=files&case=flashs&query=$query$from_fur'>Флэш</a> <span class='counter'>$count_founded_flashs</span><br />n";
                    if (
$count_founded_others)echo imgsd('tag.png')." <a href='?act=files&case=others&query=$query$from_fur'>Прочее</a> <span class='counter'>$count_founded_others</span><br />n";
                echo 
"</div>n";
            } else {
                
list_empty("Поиск не дал результатов");
            }
            echo 
"<div class='foot'>n";
                echo 
image_back()." <a href='?act=files$from_fur'>Назад</a>n";
            echo 
"</div>n";
            
ex_foot();
        }
        echo 
"<div class=list><form method='POST' action='?act=files$from_fur'>n";

            echo 
"Что будем искать?<br />n";
            echo 
"<input type='text' style='width: 65%; margin: 0px; padding: 4px 0px; vertical-align: middle;line-height: 100%;border: 1px solid #ccc;' name='query' value='' />n";

                echo 
"<input type='submit' name='submited' style='line-height: 19px;  margin-top: 0;' value='Найти'/>n";
            echo 
"</div>n";
        echo 
"</form>n";
        echo 
"<div class='foot'>n";
            echo 
image_back()."<a href='".($from?$from_url:"?query=$query")."'>Назад</a>n";
        echo 
"</div>n";
    }
    
ex_foot();
?>
Онлайн: 0
Реклама