Вход Регистрация
Файл: profiwm.pp.ua/loads/load.php
Строк: 130
<?php

require '../system/sid.php';
require 
'../system/config.php';
include 
'../system/user.php';
include 
'../system/head.php';

whorm(0, 'loads');

if (
$user['level'] != 5) {
    
header('Location: index.php');
    die();
}

$zip = new ZipArchive;

echo 
$div_title . 'WAP-скрипты' . $div_end .
     
$div_menu . '
     <img src="../ico/up.gif" alt=""/> <b>WAP-скрипты</b>
     ' 
. $block . '
     <a href="search.php?">Поиск</a><br/>
     <a href="pop.php?">Популярные</a> |
     <a href="new.php?">Новые</a>
     ' 
. $div_end;

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

   if (isset(
$_POST['up'])) {
      
$folder = check($_POST['folder']);
      
$upl = my_int($_POST['upl']);
      
$activity = floatval($_POST['activity']);
      
$name = trim(mysql_real_escape_string(check($_POST['name'])));
      
$opis = trim(mysql_real_escape_string(check($_POST['opis'])));
      if (isset(
$_POST['url'])) $url = htmlentities($_POST['url']);

if (
$upl == 1)
{

      
$FileName = $_FILES['object']['name'];
      
$FileSize = $_FILES['object']['size'];
      
$ScreenName = $_FILES['screen']['name'];
      
$ScreenSize = $_FILES['screen']['size'];

      
$archive = array('.zip', '.rar', '.tar', '.cab', '.gz', '.gzip');
      
$frm = array('.jpg', '.jpeg', '.gif', '.png');

         
$ext = strtolower(strrchr($FileName, '.'));
         
$scr = mb_strtolower(strrchr($ScreenName, '.'), 'UTF8');

         if (
$FileSize > (1024 * 20 * 1024))
         {
            
err('Размер файла не должен быть более 20 Mb!');
         }
         elseif (empty(
$folder))
         {
            
err('Не выбран раздел для загрузки!');
         }
         elseif (empty(
$FileName))
         {
            
err('Не выбран файл!');
         }
         elseif (
preg_match('/(.php|.pl|.htaccess)/i', $FileName) || !in_array($ext, $archive))
         {
            
err('Файл не является архивом!');
         }
         elseif (!empty(
$ScreenName) && $ScreenSize > (1024 * 500))
         {
            
err('Размер скриншота не должен быть более 500 Kb!');
         }
         elseif (!empty(
$ScreenName) && preg_match('/(.php|.pl|.htaccess)/i', $ScreenName) || !empty($ScreenName) && !in_array($scr, $frm))
         {
            
err('Скриншот не является изображением!');
         }
         else
         {
            if (
$zip->open($_FILES['object']['tmp_name']) === TRUE)
            {
                
$zip->setArchiveComment($site . ' - best collection of scripts.');
                
$zip->addFromString('ReadMe_' . $site . '.txt', 'Cкрипт проверен и исправлен на сайте http://' . $site . ' заходите еще :)');
                
$zip->close();
            }

            
$NameFile = 'files/' . mt_rand(10000, 99999) . '_' . strtoupper($site) . '_' . mt_rand(10000, 99999) . $ext;
            
copy($_FILES['object']['tmp_name'], $NameFile);
            
$nazvanie = (empty($name)) ? $FileName : $name;

            if (!empty(
$ScreenName))
            {
                
$ScreenFile = 'screen/' . mt_rand(10000, 99999) . '_' . strtoupper($site) . '_' . $ScreenName;
                if (
$scr != '.gif')
                {
                      
$imgc = @imagecreatefromstring(file_get_contents($_FILES['screen']['tmp_name']));
                      
$imgc = img_copyright($imgc); // наложение копирайта
                      
imagejpeg($imgc, $ScreenFile, 90);
                  } else {
                      
copy($_FILES['screen']['tmp_name'], $ScreenFile);
                  }

                
$scrsql = ", `screen` = '$ScreenFile'";
            }

              
mysql_query("INSERT INTO `loads_f` SET
                           `url` = '
$NameFile',
                           `time` = '" 
. time() . "',
                           `author` = '
$user[id]',
                           `title` = '
$nazvanie',
                           `info` = '
$opis',
                           `cat` = '
$folder',
                           `activity` = '
$activity'
                           
$scrsql");

              
header('Location: load.php?ok');
        }
    } elseif (
$upl == 2) {
        
$ScreenName = $_FILES['screen']['name'];
        
$ScreenSize = $_FILES['screen']['size'];
        
$file = getWithOutPath($url);
        
$format = mb_strtolower(strrchr($file, '.'), 'UTF8');
        
$scr = mb_strtolower(strrchr($ScreenName, '.'), 'UTF8');
        
$ext = array('.zip', '.rar', '.gz', '.gzip', '.tar', '.cab');
        
$frm = array('.jpg', '.jpeg', '.gif', '.png');
        
$f = @fopen($url, 'r');
        while(
$c = @fread($f, 1024)) $filedata .= $c;

        if (!
$f)
        {
            
err('Ошибка импортирования файла!');
        }
        elseif (
preg_match('/(.php|.pl|.htaccess)/i', $file) || !in_array($format, $ext))
        {
            
err('Файл не является архивом!');
        }
        elseif (!empty(
$ScreenName) && $ScreenSize > (1024 * 500))
        {
           
err('Размер скриншота не должен быть более 500 Kb!');
        }
        elseif (!empty(
$ScreenName) && preg_match('/(.php|.pl|.htaccess)/i', $ScreenName) || !empty($ScreenName) && !in_array($scr, $frm))
        {
           
err('Скриншот не является изображением!');
        }
        elseif (
strlen($filedata) > (1024 * 20 * 1024))
        {
            
err('Слишком большой размер файла!');
        } else {

            
mkdir('extract', 0777);
            
copy($url, 'extract/' . $file);
            if (
$zip->open('extract/' . $file) === TRUE)
            {
                
$zip->setArchiveComment($site . ' - best collection of scripts.');
                
$zip->addFromString('ReadMe_' . $site . '.txt', 'Cкрипт проверен и исправлен на сайте http://' . $site . ' заходите еще :)');
                
$zip->close();
            }

            if (!empty(
$ScreenName))
            {
                
$ScreenFile = 'screen/' . mt_rand(10000, 99999) . '_' . strtoupper($site) . '_' . $ScreenName;
                
copy($_FILES['screen']['tmp_name'], $ScreenFile);
                
$scrsql = ", `screen` = '$ScreenFile'";
            }

            
$NameFile = 'files/' . mt_rand(10000, 99999) . '_' . strtoupper($site) . '_' . $file;
            
copy('extract/' . $file, $NameFile);
            
removeDir('extract');
            
$nazvanie = (empty($name)) ? $file : $name;
            
mysql_query("INSERT INTO `loads_f` SET
                           `url` = '
$NameFile',
                           `time` = '" 
. time() . "',
                           `author` = '
$user[id]',
                           `title` = '
$nazvanie',
                           `info` = '
$opis',
                           `cat` = '
$folder',
                           `activity` = '
$activity'
                           
$scrsql");

              
header('Location: load.php?ok');
        }
     }
   }

    echo 
'<FORM action="load.php?" method="POST" ENCTYPE="multipart/form-data">
          <label>Выбрать файл: <small>(*max: 20 Mb)</small></label><br/>
          <input type="file" name="object"/>
          <br/>
          <label>Импорт файла:</label><br/>
          <input type="text" name="url" value="http://"/>
          <br/>
          <label>Скриншот: <small>(*max: 500 Kb)</small></label><br/>
          <input type="file" name="screen"/>
          <br/>
          <label>Название файла:</label><br/>
          <input type="text" name="name"/>
          <br/>
          <label>Описание файла:</label><br/>
          <textarea name="opis" cols="50" rows="5" style="width: 99%;"></textarea>
          <br/>
          <label>Активность для скачивания:</label><br/>
          <input type="text" name="activity" value="0.00" size="3"/>
          <br/>
          <label>В раздел:</label>
          <br/>
          <select name="folder">'
;

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

    echo 
'</select>
          <br/>
          <input type="radio" name="upl" checked value="1"/> Обычная загрузка
          <input type="radio" name="upl" value="2"/> Импорт
          <br/>
          <input type="submit" name="up" value="Загрузить"/>
          </FORM>'
;

include 
'../system/foot.php';
?>
Онлайн: 2
Реклама