View file forum/upload.php

File size: 4.11Kb
<?php
require_once"../template/start.php";
require_once"../template/regglobals.php";
require_once"../template/config.php";
require_once"setforum.php";
require_once"../template/functions.php";
require_once"../template/antidos.php";
require_once"../template/cookies.php";
require_once"../template/gzip.php";
require_once"../template/header.php";
require_once"../template/referer.php";

if($config_forum_off=="1"){

if ($provlog==$_SESSION['log'] && $provpar==md5($_SESSION['par']) && $_SESSION['log']!="" && md5($_SESSION['par'])!=""){
if($config_file_post=="1"){
if($udata[36]>$config_file_usball){

$text = @file("../local/profil/$log.prof"); 
if ($text!=""){
$udata = explode(":||:",$text[0]);
$added=trim($udata[0]);}
if ($added==''){
$added='Гость';}

function save_file ($_FILES,$uploadfile){
global $ext;
global $added;
$op=htmlspecialchars(stripslashes($_POST['msg']));

if($_FILES['userfile']['size']<=5520000){

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
if ($op!=''){
$op=stripslashes(htmlspecialchars($op));
$op=str_replace("\n\r","<br />",$op);
$op=str_replace("\n","<br />",$op);
$op=str_replace("\r","<br />",$op);
$op=str_replace("<br /><br />","<br />",$op);
$fn=$_FILES['userfile']['name'];
$fp=fopen("$ext/$fn.txt","wb");

$upltime = time();
flock ($fp,LOCK_EX);
fputs($fp,"$op|:|:|:|$added|:|:|:|$upltime\r\n");
flock ($fp,LOCK_UN);
fclose($fp);
}else {

$fn=$_FILES['userfile']['name'];
$fp=fopen("$ext/$fn.txt","wb");
flock ($fp,LOCK_EX);
fputs($fp,"$dt[6]||:|:|:|$added|:|:|:|$upltime\r\n");
flock ($fp,LOCK_UN);
fclose($fp);}

}else{
echo 'Ошибка загрузки файла!!!<br />';
require_once"../template/foot.php";
exit;}}}

if (ereg(".php",$_FILES['userfile']['name']) || ereg(".wmls",$_FILES['userfile']['name'])){echo 'Больше так не делай!!!<br />';}

$ext = explode('.',$_FILES['userfile']['name']);
$ext = $ext[count($ext)-1];
$ext = strtolower($ext);
$fn = strtolower($fn);
$fn=ucfirst($fn);
$f="/";
$ext1=$ext;


//----Проверка типов файлов----//
//---формируем имя файла с русским именем файла---//
//--Пишем функцию сохранения файла с русским именем--//

if ($ext=='mid')
{$upmid = $upmelod.$ext.$f. basename($_FILES['userfile']['name']);
save_file ($_FILES,$upmid);}

if ($ext=='mp3')
{$upmp3 = $ext.$f. basename($_FILES['userfile']['name']);
save_file ($_FILES,$upmp3);}
 
if ($ext=='amr')
{$upamr = $ext.$f. basename($_FILES['userfile']['name']);
save_file ($_FILES,$upamr);}
 
if ($ext=='mmf')
{$upmmf = $ext.$f. basename($_FILES['userfile']['name']);
save_file ($_FILES,$upmmf);}
  
if ($ext=='wav')
{$upwav = $ext.$f. basename($_FILES['userfile']['name']);
save_file ($_FILES,$upwav);}
   
if ($ext=='bmp')
{$upbmp = $ext.$f. basename($_FILES['userfile']['name']);
save_file ($_FILES,$upbmp);}
   
if ($ext=='rar')
{$uprar = $ext.$f. basename($_FILES['userfile']['name']);
save_file ($_FILES,$uprar);}
   
if ($ext=='gif')
{$upgif = $ext.$f.$_FILES['userfile']['name'];
save_file ($_FILES,$upgif);}
    
if ($ext=='jpg')
{$upjpg = $ext.$f. basename($_FILES['userfile']['name']);
save_file ($_FILES,$upjpg);}
 
if ($ext=='png')
{$uppng = $ext.$f. basename($_FILES['userfile']['name']);
save_file ($_FILES,$uppng);}
     
if ($ext=='zip')
{$upzip = $ext.$f. basename($_FILES['userfile']['name']);
save_file ($_FILES,$upzip);}
     
if ($ext=='3gp')
{$upvideo = $ext.$f. basename($_FILES['userfile']['name']);
save_file ($_FILES,$upvideo);}
     
if ($ext=='jar')
{$upjar = $ext.$f. basename($_FILES['userfile']['name']);
save_file ($_FILES,$upjar);}

if ($ext=='sis')
{$upsis = $ext.$f. basename($_FILES['userfile']['name']);
 save_file ($_FILES,$upsis);}
 
 if ($ext=='cab')
{$upcab = $ext.$f. basename($_FILES['userfile']['name']);
 save_file ($_FILES,$upcab);}
 
 if ($ext=='arm')
{$uparm = $ext.$f. basename($_FILES['userfile']['name']);
 save_file ($_FILES,$uparm);}
 
  if ($ext=='jad')
{$upjad = $ext.$f. basename($_FILES['userfile']['name']);
 save_file ($_FILES,$upjad);}
 
}}}
}

if($config_forum_off=="0"){
echo'<center><font color="red">Форум сайта отключен!</font></center>';}
?>