Просмотр файла forum/add.php

Размер файла: 12.82Kb
  1. <?php
  2. // автор скрипта - Arab
  3. // icq - 9988817 сайт: http://bola.net.ru
  4.  
  5. Error_Reporting(E_ALL & ~E_NOTICE);
  6. Error_Reporting (ERROR | WARNING);
  7.  
  8. include_once "includ/functions.php";
  9. include_once "includ/login.php";
  10. include_once "includ/setting.php";
  11. include_once "includ/online.php";
  12. $ver=full_check($ver);
  13.  
  14. $ip=check($_SERVER['REMOTE_ADDR']);
  15. if (!$_SESSION[login]=="" && !md5($_SESSION[password])=="" && md5($_SESSION[password])==$npassword && $_SESSION[login]==$nlogin){
  16. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  17. ////////////////////////////////////////////////////////////// ДОБАВЛЕНИЕ сооббщения //////////////////////////////////////////////////////////////
  18. if(isset($addmsg)){
  19. $addmsg=full_check($addmsg);
  20. if (isset($_POST['msg'])) $msg=($_POST['msg']);
  21. if (isset($_POST['id'])) $id=check($_POST['id']);
  22. if (isset($_POST['tems'])) $tems=check($_POST['tems']);
  23. if (isset($_POST['strok'])) $strok=check($_POST['strok']);
  24.  
  25. $checkop = @file("$maindir/forum/data/forum/".check($id).".tem");
  26. $chek = explode("|",$checkop[0]);
  27. if($chek[9]=="closed"){
  28. include_once "../css/red/index.php";
  29. echo'<center><font color="#dd1111"><b>Нельзя писать в закрытую тему!</b></font></center>';
  30. include_once "../css/red/foot.php"; exit;}
  31.  
  32. if($day_chas<=8 && $day_chas>=1){
  33. $msg_time=time()-70;
  34. if($m_antiflood>$msg_time){
  35. include_once "../css/red/index.php";
  36. echo'<p align="center"><br><b>Ночной сторож: нельзя добавлять сообщения чаще чем в каждые 70сек!</b></p>';
  37. include_once "../css/red/foot.php"; exit;}}
  38.  
  39. $msg_time=time()-$conf_antiflood;
  40. if($m_antiflood>$msg_time){
  41. include_once "../css/red/index.php";
  42. echo'<p align="center"><br><b>Анти-флуд: нельзя добавлять сообщения слишком часто!</b></p>';
  43. include_once "../css/red/foot.php"; exit;}
  44.  
  45. if(empty($msg)){
  46. include_once "../css/red/index.php";
  47. echo'<p align="center"><b>Забыли написать сообщение</b></p>';
  48. include_once "../css/red/foot.php"; exit;}
  49.  
  50. if(win_to_utf(strlen(utf_to_win($msg)))<3 || win_to_utf(strlen(utf_to_win($msg)))>2000){
  51. include_once "../css/red/index.php";
  52. echo'<p align="center"><b>Сообщение слишком короткое или длинное</b></p>';
  53. include_once "../css/red/foot.php"; exit;}
  54. $msg=check($msg);
  55.  
  56. if(!file_exists(''.$maindir.'/forum/data/forum/'.$id.'.tem')){
  57. include_once "../css/red/index.php";
  58. echo'<center>Такой темы не существует!</center>';
  59. include_once "../css/red/foot.php"; exit;}
  60. if(!is_numeric($id)){
  61. include_once "../css/red/index.php";
  62. echo'Пошел нах!'; include_once "../css/red/foot.php"; exit;}
  63. if(!is_numeric($tems)){
  64. include_once "../css/red/index.php";
  65. echo'Пошел нах!'; include_once "../css/red/foot.php"; exit;}
  66. if(!file_exists(''.$maindir.'/forum/data/forum/razd'.$tems.'.dat')){
  67. include_once "../css/red/index.php";
  68. echo'<center>Такого раздела не существует!</center>';
  69. include_once "../css/red/foot.php"; exit;}
  70.  
  71. ///////////////////////////////////////// проверка на мат. если есть мат то юзер летит в баню
  72. if($m_level=="4"){
  73. $msg=antimat($msg);
  74. if(eregi("W4d66R6T89ывnы7UвrаV3мKfD",$msg)){
  75. $povod = "мат на форуме";
  76. $realtime = time();
  77. $vremya = check($realtime+$conf_avtobantime);
  78. $allban = check($m_allban+1);
  79.  
  80. $text=$udata[0].'|'.$udata[1].'|'.$udata[2].'|'.$udata[3].'|'.$udata[4].'|'.$udata[5].'|'.$udata[6].'|'.$data[7].'|'.$udata[8].'|'.$udata[9].'|'.$udata[10].'|'.$udata[11].'|'.$udata[12].'|'.$udata[13].'|'.$udata[14].'|'.$udata[15].'|'.$udata[16].'|'.$udata[17].'|'.$vremya.'|'.$povod.'|'.$udata[20].'|'.$udata[21].'|'.$allban.'|'.$udata[23].'|'.$udata[24].'|'.$udata[25].'|'.$udata[26].'|'.$udata[27].'|'.$udata[28].'|'.time().'|';
  81. $text=str_replace("\r\n", "", $text);
  82. $fp=fopen(''.check($maindir).'/forum/data/users/'.check($login.log).'','r+');
  83. flock($fp,LOCK_EX);
  84. ftruncate($fp,0);
  85. fputs($fp,"$text");
  86. fflush($fp);
  87. flock($fp,LOCK_UN);
  88. fclose($fp);
  89. chmod (''.check($maindir).'/forum/data/users/'.check($login).'.log', 0666);
  90.  
  91. if($m_allban>"$conf_allbans"){ @unlink("$maindir/forum/data/users/$login.log"); @unlink("$maindir/forum/data/privat/$login.dat"); }
  92. $msgtime = check(date("G:i/j F"));
  93. $data = check(date("j.n.y"));
  94. $time = check(date("G:i"));
  95. $textmsg=$tems.'|'.$temname[1].'|Система|'.$temname[3].'|'.$id.'|Пользователь <b>'.$login.'</b> забанен за мат!|'.$time.'|'.$data.'|'.$ip.'|'.$temname[9].'|';
  96. $textmsg=str_replace("\r\n", "", $textmsg);
  97. $fp=fopen("$maindir/forum/data/forum/".check($id).".tem","a+");
  98. flock($fp,LOCK_EX);
  99. fputs($fp,"$textmsg\r\n");
  100. flock($fp,LOCK_UN);
  101. fclose($fp);
  102. chmod ("$maindir/forum/data/forum/$id.tem", 0666);
  103. if($ver=="web"){ header ("Location: web.php?".SID); }else{
  104. header ("Location: index.php?".SID); } exit; }}
  105.  
  106. $data = check(date("j.n.y"));
  107. $time = check(date("G:i"));
  108. $fx = file("$maindir/forum/data/mainforum.dat");
  109. $other = explode("|",$fx[$tems]);
  110. $f = file("$maindir/forum/data/forum/".check($id).".tem");
  111.  
  112. $temname = explode("|",$f[0]);
  113. $txttem=$tems.'|'.$temname[1].'|'.$login.'|'.$temname[3].'|'.$id.'|'.$msg.'|'.$time.'|'.$data.'|'.$ip.'|'.$temname[9].'|';
  114. $txttem=str_replace("\r\n", "", $txttem); ///// ТЕМА
  115. $fp=fopen("$maindir/forum/data/forum/".check($id).".tem","a+");
  116. fputs($fp,"$txttem\r\n");
  117. fclose($fp);
  118.  
  119. $plusmsg=$other[3]+1;
  120. $fx[$tems]="$other[0]|$other[1]|$other[2]|$plusmsg|$login|$temname[3]|$time|$data|$id|\r\n";
  121. $rezultat=implode("",$fx);
  122. $fp=fopen("$maindir/forum/data/mainforum.dat","w");
  123. fputs($fp,$rezultat);
  124.  
  125. $fff = file("$maindir/forum/data/users/$login.log"); // +1 балл
  126. $udata = explode("|",$fff[0]);
  127. $ballplus=$udata[20]+1;
  128. $forumplus=$udata[21]+1;
  129. $text=$udata[0].'|'.$udata[1].'|'.$udata[2].'|'.$udata[3].'|'.$udata[4].'|'.$udata[5].'|'.$udata[6].'|'.$data[7].'|'.$udata[8].'|'.$udata[9].'|'.$udata[10].'|'.$udata[11].'|'.$udata[12].'|'.$udata[13].'|'.$udata[14].'|'.$udata[15].'|'.$udata[16].'|'.$udata[17].'|'.$udata[18].'|'.$udata[19].'|'.$ballplus.'|'.$forumplus.'|'.$udata[22].'|'.$udata[23].'|'.$udata[24].'|'.$udata[25].'|'.$udata[26].'|'.$udata[27].'|'.$udata[28].'|'.time().'|';
  130. $text=str_replace("\r\n", "", $text);
  131. $fp=fopen("$maindir/forum/data/users/$login.log","r+");
  132. fputs($fp,"$text");
  133. fclose($fp);
  134. if($ver=="web"){ header ("Location: web.php?addmsg&messages&tem=$tems&id=$id&amp;".SID); }else{
  135. header ("Location: index.php?addmsg&messages&tem=$tems&id=$id&amp;".SID);} exit;}
  136.  
  137. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  138. ////////////////////////////////////////////////////////////// ДОБАВЛЕНИЕ ТЕМЫ /////////////////////////////////////////////////////////////////
  139. if(isset($newtema)){
  140. $newtema=full_check($newtema);
  141. if (isset($_POST['razdel'])) $razdel = full_check($_POST['razdel']);
  142. if(!is_numeric($razdel)){ echo'Пошел нах!'; exit; }
  143.  
  144. if (isset($_POST['msg'])) $msg=($_POST['msg']);
  145. if (isset($_POST['temname'])) $temname=($_POST['temname']);
  146.  
  147. if($day_chas<=8 && $day_chas>=1){
  148. $msg_time=time()-70;
  149. if($m_antiflood>$msg_time){
  150. include_once "../css/red/index.php";
  151. echo'<p align="center"><br><b>Ночной сторож: нельзя добавлять сообщения чаще чем в каждые 70сек!</b></p>';
  152. include_once "../css/red/foot.php"; exit;}}
  153.  
  154. $msg_time=time()-$conf_antiflood;
  155. if($m_antiflood>$msg_time){
  156. include_once "../css/red/index.php";
  157. echo'<p align="center"><br><b>Анти-флуд: нельзя добавлять сообщения слишком часто!</b></p>';
  158. include_once "../css/red/foot.php"; exit;}
  159.  
  160. if(empty($temname)){
  161. include_once "../css/red/index.php";
  162. echo'<br><p align="center"><b>Забыли написать название темы</b></p>';
  163. include_once "../css/red/foot.php"; exit;}
  164. if(empty($msg)){
  165. include_once "../css/red/index.php";
  166. echo'<br><p align="center"><b>Забыли написать сообщение</b></p>';
  167. include_once "../css/red/foot.php"; exit;}
  168.  
  169. if(win_to_utf(strlen(utf_to_win($msg)))<4 || win_to_utf(strlen(utf_to_win($msg)))>2000){
  170. include_once "../css/red/index.php";
  171. echo'<br><p align="center"><b>Сообщение слишком короткое или длинное</b></p>';
  172. include_once "../css/red/foot.php"; exit;}
  173.  
  174. if(win_to_utf(strlen(utf_to_win($temname)))<4 or win_to_utf(strlen(utf_to_win($temname)))>30){
  175. include_once "../css/red/index.php";
  176. echo'<br><p align="center"><b>Название слишком короткое или длинное</b></p>';
  177. include_once "../css/red/foot.php"; exit;}
  178.  
  179. $fmfile = file_get_contents("$maindir/forum/data/forum/razd$razdel.dat");
  180. if(strpos($fmfile,$temname)!==false){
  181. include_once "../css/red/index.php";
  182. echo'<br><p align="center"><b>Такая тема уже есть!</b></p>';
  183. include_once "../css/red/foot.php"; exit;}
  184.  
  185. $temname=full_check($temname); $msg=check($msg);
  186.  
  187. $data = check(date("j.n.y"));
  188. $time = check(date("G:i"));
  189. $ids=time();
  190. $rands=rand(0,9);
  191. $rand=rand(0,9);
  192. $id=full_check("$ids$rands$rand");
  193. $id=full_check($id);
  194. $f = file("$maindir/forum/data/mainforum.dat"); ///// ГЛАВНАЯ
  195. $other = explode("|",$f[$razdel]);
  196.  
  197. $plusmsg=$other[3]+1;
  198. $plustem=$other[2]+1;
  199. $f[$razdel]="$other[0]|$other[1]|".check($plustem)."|".check($plusmsg)."|$login|".check($temname)."|$time|".check($data)."|$id|\r\n";
  200. $rezultat=implode("",$f);
  201. $fp=fopen("$maindir/forum/data/mainforum.dat","w");
  202. fputs($fp,$rezultat);
  203.  
  204. $txtrazd=$razdel.'|'.$other[1].'|'.$login.'|'.check($temname).'|'.$id.'|'.$time.'|'.check($data).'|'; ///// РАЗДЕЛ
  205. $txtrazd=str_replace("\r\n", "", $txtrazd);
  206. $fp=fopen("$maindir/forum/data/forum/razd".full_check($razdel).".dat","a+");
  207. fputs($fp,"$txtrazd\r\n");
  208. fclose($fp);
  209. $txttem=$razdel.'|'.$other[1].'|'.$login.'|'.check($temname).'|'.$id.'|'.check($msg).'|'.$time.'|'.check($data).'|'.$ip.'||'; ///// ТЕМА
  210. $txttem=str_replace("\r\n", "", $txttem);
  211. $fp=fopen("$maindir/forum/data/forum/".full_check($id).".tem","a+");
  212. fputs($fp,"$txttem\r\n");
  213. fclose($fp);
  214.  
  215.  
  216. $fff = file("$maindir/forum/data/users/$login.log"); // +1 балл
  217. $udata = explode("|",$fff[0]);
  218. $ballplus=$udata[20]+1;
  219. $forumplus=$udata[21]+1;
  220. $text=$udata[0].'|'.$udata[1].'|'.$udata[2].'|'.$udata[3].'|'.$udata[4].'|'.$udata[5].'|'.$udata[6].'|'.$data[7].'|'.$udata[8].'|'.$udata[9].'|'.$udata[10].'|'.$udata[11].'|'.$udata[12].'|'.$udata[13].'|'.$udata[14].'|'.$udata[15].'|'.$udata[16].'|'.$udata[17].'|'.$udata[18].'|'.$udata[19].'|'.$ballplus.'|'.$forumplus.'|'.$udata[22].'|'.$udata[23].'|'.$udata[24].'|'.$udata[25].'|'.$udata[26].'|'.$udata[27].'|'.$udata[28].'||';
  221. $text=str_replace("\r\n", "", $text);
  222. $fp=fopen("$maindir/forum/data/users/$login.log","r+");
  223. fputs($fp,"$text");
  224. fclose($fp);
  225. if($ver=="web"){ header ("Location: web.php?addtema&messages&tem=$razdel&id=$id"); }else{
  226. header ("Location: index.php?addtema&messages&tem=$razdel&id=$id"); } exit;}
  227.  
  228. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  229. ////////////////////////////////////////////////////////////// ДОБАВЛЕНИЕ РАЗДЕЛА /////////////////////////////////////////////////////////////////
  230. if($m_level=="1" || $m_level=="2"){
  231. if (isset($_POST['razdel'])) $razdel = $_POST['razdel'];
  232. if(empty($razdel)){
  233. include_once "../css/red/index.php";
  234. echo'<br><p align="center"><b>Забыли написать название раздела</b></p>';
  235. include_once "../css/red/foot.php"; exit;}
  236.  
  237. if(win_to_utf(strlen(utf_to_win($razdel)))<3 or win_to_utf(strlen(utf_to_win($razdel)))>26){
  238. include_once "../css/red/index.php";
  239. echo'<br><p align="center"><b>Название слишком короткое или длинное</b></p>';
  240. include_once "../css/red/foot.php"; exit;}
  241.  
  242. $razdel=check($razdel);
  243.  
  244. $openf = @file("$maindir/forum/data/mainforum.dat");
  245. $array = @array_reverse($openf);
  246. $all_f = count($array);
  247.  
  248. $textmsg=$all_f.'|'.$razdel.'|0|0||||||';
  249. $fp=fopen("$maindir/forum/data/mainforum.dat","a+");
  250. fputs($fp,"$textmsg\r\n");
  251. fclose($fp);
  252. chmod ("$maindir/forum/data/mainforum.dat", 0666);
  253. //---
  254.  
  255. $fp=fopen("$maindir/forum/data/forum/razd".full_check($all_f).".dat","a+");
  256. fclose($fp);
  257. chmod ("$maindir/forum/data/forum/razd".full_check($all_f).".dat", 0666);
  258. if($ver=="web"){ header ("Location: web.php?addrazd".SID); }else{
  259. header ("Location: index.php?addrazd".SID); }
  260. }else{ echo'Гуляй нахуй!'; exit;}}else{
  261. include_once "../css/red/index.php";
  262. echo'Вы не авторизованы'; include_once "../css/red/foot.php"; exit;}
  263.  
  264. ?>
  265.