= 6) {
if ($_GET['id'] == "") {
echo "ERROR
Back
";
require_once('../incfiles/end.php');
exit;
}
$typ = mysql_query("select * from `lib` where id='" . $id . "';");
$ms = mysql_fetch_array($typ);
if ($id != 0 && $ms['type'] != "cat") {
echo "ERROR
Back
";
require_once('../incfiles/end.php');
exit;
}
if ($ms['ip'] == 0) {
if (isset($_POST['submit'])) {
if (empty($_POST['name'])) {
echo functions::display_error($lng['error_empty_title'], '' . $lng['repeat'] . '');
require_once('../incfiles/end.php');
exit;
}
$name = mb_substr($_POST['name'], 0, 50);
$fname = $_FILES['fail']['name'];
$ftip = functions::format($fname);
$ftip = strtolower($ftip);
if ($fname != "") {
if (eregi("[^a-z0-9.()+_-]", $fname)) {
echo "Invalid file name
" . $lng['repeat'] . "
";
require_once('../incfiles/end.php');
exit;
}
if ((preg_match("/.php/i", $fname)) or (preg_match("/.pl/i", $fname)) or ($fname == ".htaccess")) {
echo "Invalid file format
" . $lng['repeat'] . "
";
require_once('../incfiles/end.php');
exit;
}
if ($ftip != "txt") {
echo "This is not a text file
" . $lng['repeat'] . "
";
require_once('../incfiles/end.php');
exit;
}
57 СТРОЧКА if ((move_uploaded_file($_FILES["fail"]["tmp_name"], "temp/$fname")) == true) {
$ch = $fname;
@chmod("$ch", 0777);
@chmod("temp/$ch", 0777);
$txt = file_get_contents("temp/$ch");
if (mb_check_encoding($txt, 'UTF-8')) { } elseif (mb_check_encoding($txt, 'windows-1251')) {
$txt = iconv("windows-1251", "UTF-8", $txt);
} elseif (mb_check_encoding($txt, 'KOI8-R')) {
$txt = iconv("KOI8-R", "UTF-8", $txt);
} else {
echo "File in an unknown encoding
" . $lng['repeat'] . "
";
require_once('../incfiles/end.php');
exit;
}
$anons = !empty($_POST['anons']) ? mb_substr($_POST['anons'], 0, 100) : mb_substr($txt, 0, 100);
mysql_query("insert into `lib` set
`refid`='" . $id . "',
`time`='" . $realtime . "',
`type`='bk',
`name`='" . mysql_real_escape_string($name) . "',
`announce`='" . mysql_real_escape_string($anons) . "',
`avtor`='" . $login . "',
`text`='" . mysql_real_escape_string($txt) . "',
`ip`='" . $ip . "',
`soft`='" . mysql_real_escape_string($agn) . "',
`moder`='1'
");
unlink("temp/$ch");
$cid = mysql_insert_id();
echo $lng_lib['article_added'] . "
" . $lng_lib['to_article'] . "
";
} else {
echo $lng_lib['error_uploading'] . "
" . $lng['repeat'] . "
";
require_once('../incfiles/end.php');
exit;
}
}
} else {
echo '