EIOS/inc/class_SYSTEM.php

58 lines
1.5 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
class SYSTEMclass
{
//private $IP = '';
function __construct()
{
//$this->IP = '';
}
/**
* Проверка файла на загрузку
* @param $Fname
* @param $file
* @return bool
*/
function sysUPLOAD($Fname,$file){
//GLOBAL $_FILES;
$out = false;
$mes = $file."\n";
$mes .= print_r($_FILES,1);
//file_put_contents('uplfile.txt',date('H:i:s d.m.Y').':'.$mes."\n",FILE_APPEND);
if($this->check_file($file)){
if (move_uploaded_file($Fname,$file)){
$out = true;
}else{
$out = false;
}
}else{
$out = false;
}
return $out;
}
/**
* Проверка на расширение у файлов
* @param $file
* @return bool
*/
private function check_file($file){
$out = true;
$parts = pathinfo($file);
// Разрешенные расширения файлов.
$allow = array();
// Запрещенные расширения файлов.
$deny = array(
'phtml', 'php', 'php3', 'php4', 'php5', 'php6', 'php7', 'phps', 'cgi', 'pl', 'asp',
'aspx', 'shtml', 'shtm', 'htaccess', 'htpasswd', 'ini', 'log', 'sh', 'js', 'html',
'htm', 'css', 'sql', 'spl', 'scgi', 'fcgi'
);
if (in_array(strtolower($parts['extension']), $deny)){
$out = false;
}
return $out;
}
}