if ($member_id['user_group'] == "1" or $member_id['user_group'] == "3") {
$fpid=intval($cat_i_down[$cat_title]['parentid']);
$db->query("INSERT INTO " . PREFIX . "_".$modul_dbtitle." (autor, date, size, version, platform, description, title, screenshot, filename, category, approve, allow_rate, allow_br) values ('$member_id[name]', '$thistime', '$filesize1', '$version', '$platform', '$description', '$title', '$file_prefix$file_name_thumb', '$file_name', '$cat_title', '0', '1', '1')");
##=============================Добавляем аттач в таблицу========================================##
printf ("Последняя вставленная запись имеет id %d\n", mysql_insert_id());
$id_files = mysql_insert_id(); // вот 829 строка
##========Файл1=============##
if($_FILES['subfile_1']['name'] != "") {$file_name_1 = $_FILES['subfile_1']['name']; $file_size_1 = $_FILES['subfile_1']['size'];
$db->query("INSERT INTO " . PREFIX . "_".$modul_dbtitle_att." (file_id, name, size, author, date) values ('$id_files', '$file_name_1', '$filesize1_att_1','$member_id[name]', '$thistime')"); }
##========Файл2=============##
if($_FILES['subfile_2']['name'] != "" ) {$file_name_2 = $_FILES['subfile_2']['name']; $file_size_2 = $_FILES['subfile_2']['size'];
$db->query("INSERT INTO " . PREFIX . "_".$modul_dbtitle_att." (file_id, name, size, author, date) values ('$id_files', '$file_name_2', '$filesize1_att_2','$member_id[name]', '$thistime')"); }
##=========Файл3=============##
if($_FILES['subfile_3']['name'] != "" ) {$file_name_3 = $_FILES['subfile_3']['name']; $file_size_3 = $_FILES['subfile_3']['size'];
$db->query("INSERT INTO " . PREFIX . "_".$modul_dbtitle_att." (file_id, name, size, author, date) values ('$id_files', '$file_name_3', '$filesize1_att_3','$member_id[name]', '$thistime')"); }
##==============================================================================##
$db->query("UPDATE " . PREFIX . "_cat_".$modul_dbtitle." SET news_number=news_number+1 where id ='$cat_title'");
if ($fpid !=0) {
$db->query("UPDATE " . PREFIX . "_cat_".$modul_dbtitle." SET news_number=news_number+1 where id ='$fpid'");
}
} else {
$db->query("INSERT INTO " . PREFIX . "_".$modul_dbtitle." (autor, date, size, version, platform, description, title, screenshot, filename, category, approve, allow_rate, allow_br) values ('$member_id[name]', '$thistime', '$filesize1', '$version', '$platform', '$description', '$title', '$file_prefix$file_name_thumb', '$file_name', '$cat_title', '1', '1', '1')");
$db->query("UPDATE " . PREFIX . "_users set news_num=news_num+1 where user_id='$member_db[10]'");
}