Вход Регистрация
Файл: fo/load.php
Строк: 99
<?php
require '../lang_inc.php';
require 
'../sid.php';
require 
'../config.php';
$link connect_db();
list(
$user$id$ps) = check_login($link);

whorm(0'fo');

include 
'../head.php';

$r my_int($_REQUEST['r']);

echo 
$div_title ''.$lang['Зона обмена'].'' $div_end $div_left .
     
$div_menu '
     <img src="../ico/up.gif" alt=""/> <b>'
.$lang['Зона обмена'].'</b>
     ' 
$block '
     <a href="search.php?lg='
.$lg.'&amp;'.$ref.'">'.$lang['Поиск'].'</a><br/>
     <a href="pop.php?lg='
.$lg.'&amp;'.$ref.'">'.$lang['Популярные'].'</a> |
     <a href="new.php?lg='
.$lg.'&amp;'.$ref.'">'.$lang['Новые'].'</a>
     ' 
$div_end;

    
$em mysql_query("SELECT * FROM fo_cat WHERE id = '$r' LIMIT 1");
    if (
mysql_num_rows($em) == false)
    {
        
err(''.$lang['Раздел не найден'].'!');
        include 
'../foot.php';
         exit();
    }

   if (
rat($user['id']) < 90) {
      
err(''.$lang['Для загрузки файлов Вам нужно минимум 90% рейтинга'].'!');
      include 
'../foot.php';
      exit();
   }

   
//--------------------//
   
$sets mysql_fetch_array(mysql_query("SELECT `fo_limit`, `fo_moder` FROM `setting` WHERE `ids` = '1'"));
   
$_mod = ($sets[1] == 1) ? '<br/>'.$lang['Файл будет доступен после проверки Администратором'].'.' '';
   
//--------------------//

   
if (isset($_GET['ok'])) msg(''.$lang['Файл был успешно загружен'].'!' $_mod);

   if (isset(
$_POST['up'])) {
      
$folder check($_POST['folder']);
      
$parol my_int($_POST['parol']);
      
$xxx my_int($_POST['xxx']);
      
$opis trim(mysql_real_escape_string(check($_POST['opis'])));

         
$FileName $_FILES['object']['name'];
         
$FileSize $_FILES['object']['size'];

      
$pictures = array('.gif''.jpg''.jpeg''.jpe''.png''.wbmp''.pic''.bmp''.pco');
      
$music = array('.mmf''.mid''.amr''.mp3''.wav''.aac''.wma''.vox''.dxm''.imy''.emy''.pmd''.rng');
      
$video = array('.3gp''.mp4''.avi''.mpeg''.rm''.flv');
      
$theme = array('.thm''.sdt''.nth''.mtf''.col''.scs''.utz');
      
$game = array('.sis''.sisx''.jar''.jad''.apk');
      
$archive = array('.zip''.rar''.tar''.cab''.gz');
      
$flash = array('.swf');
      
$other = array('.doc''.docx''.pdf''.tsk''.txt');

         
$ext strtolower(strrchr($FileName'.'));

         if (
in_array($ext$pictures)) $type 'pictures';
         if (
in_array($ext$music)) $type 'music';
         if (
in_array($ext$video)) $type 'video';
         if (
in_array($ext$theme)) $type 'theme';
         if (
in_array($ext$game)) $type 'game';
         if (
in_array($ext$archive)) $type 'archive';
         if (
in_array($ext$flash)) $type 'flash';
         if (
in_array($ext$other)) $type 'other';

         
$st mysql_fetch_array(mysql_query("SELECT `formats` FROM `fo_pod` WHERE `id` = '$folder' LIMIT 1"));

         if (
$FileSize > (1024 $sets[0] * 1024))
         {
            
err(''.$lang['Размер файла не должен быть более'].' ' $sets[0] . ' '.$lang['Мб'].'.');
         }
         elseif (empty(
$folder))
         {
            
err(''.$lang['Не выбрана папка для загрузки'].'!');
         }
         elseif (empty(
$FileName))
         {
            
err(''.$lang['Не выбран файл'].'!');
         }
         elseif (
$type != $st[0])
         {
            
err(''.$lang['Формат вашего файла не соответствует категории'].'!');
         }
         elseif (
preg_match('/(.php|.pl|.htaccess|.js)/i'$FileName))
         {
            
err(''.$lang['Файлы такого типа запрещены'].'!');
         }
         else
         {

            
$NameFile 'files/' $type '/' time() . '_' $site '.' $ext;

            if (
$type == 'pictures' && $ext != '.gif') {
                  
$imgc = @imagecreatefromstring(file_get_contents($_FILES['object']['tmp_name']));
                 
$imgc img_copyright($imgc); // наложение копирайта
                 
imagejpeg($imgc$NameFile90);
            } else {
                
copy($_FILES['object']['tmp_name'], $NameFile);
            }

              
mysql_query("INSERT INTO `fo_files` SET
                           `url` = '
$NameFile',
                           `time` = '" 
time() . "',
                           `author` = '
$user[id]',
                           `xxx` = '
$xxx',
                           `title` = '
$FileName',
                           `info` = '
$opis',
                           `parol` = '
$parol',
                           `rid` = '
$r',
                           `cat` = '
$folder',
                           `moder` = '
$sets[1]'");

        
/*--------------------рассылка в ленту---------------------*/
        
$frnd mysql_query("SELECT * FROM `friends` WHERE `user` = '$user[id]' AND `zajavka` = '1'");
        while(
$send mysql_fetch_assoc($frnd)) {
             if (
user_inf($send['who'], 'my_lenta_files') == && $user['fr_lenta_files'] == 1) {
                
$last_file mysql_fetch_assoc(mysql_query("SELECT `id` FROM `fo_files` ORDER BY `id` DESC LIMIT 1"));
                
$message us($user['id']) . ' '.$lang['загрузил новый'].' <a href="fo/info.php?i='.$last_file['id'].'&amp;lg='.$lg.'">'.$lang['файл'].'</a> '.$lang['в зону обмена'].'!';
                
mysql_query("INSERT INTO `lenta` SET
                               `user` = '
$send[who]',
                            `text` = '
$message',
                            `type` = 'friends',
                            `date` = '" 
time() . "',
                            `read` = '1'"
);
             }
        }
        
/*--------------------рассылка в ленту---------------------*/
              
header('Location: load.php?r='.$r.'&ok&lg='.$lg.'');
        }
   }

    echo 
'<fieldset>
          <FORM action="load.php?lg='
.$lg.'&amp;'.$ref.'" method="POST" ENCTYPE="multipart/form-data">
          <label>'
.$lang['Выбрать файл'].': <small>(*max: ' $sets[0] . ' Mb)</small></label><br/>
          <input type="file" name="object"/>
          <br/>
          <label>'
.$lang['Описание файла'].':</label><br/>
          <input type="text" name="opis"/>
          <br/>
          <label>'
.$lang['Пароль(можна оставить пустым)'].':</label><br/>
          <input type="password" name="parol"/>
          <br/>
          <label>'
.$lang['В папку'].':</label>
          <br/>
          <select name="folder">'
;

    
$lists mysql_query("SELECT * FROM fo_pod WHERE cid = '$r'");
    echo 
'<option value="0">-'.$lang['Не выбрано'].'-</option>';
    while(
$A mysql_fetch_assoc($lists))
    {
        echo 
'<option value="'.$A['id'].'">'.$A['title'].'</option>';
    }

    echo 
'</select>
          <br/>
          <input type="checkbox" name="xxx" value="1"/> '
.$lang['Файл +18'].'
          <br/>
          <input type="hidden" name="r" value="'
.$r.'"/>
          <input type="submit" name="up" value="'
.$lang['Загрузить'].'"/>
          </FORM>
          </fieldset>'
;

echo 
$div_end;
include 
'../foot.php';
?>
Онлайн: 1
Реклама