'.$referer; exit; } $sql_ip = 'SELECT * ' . ' FROM `forum_message` ' . ' WHERE (`ip` = \''.$real_ip.'\') ORDER BY `id` DESC'; $date=getdate(); $result_ip = mysql_query($sql_ip) or die("Не могу открыть базу пользователей"); if ($result_ip){ $kol_ip=mysql_num_rows($result_ip); } else { echo 'Ошибка выполнения запроса '; } if ($kol_ip==0) { } else { for ($i=0; $i<=$kol_ip-1; $i++) { $post_date=mysql_result($result_ip,$i,"create"); $tmp_date=$date[0]-$post_date; if ($tmp_date<300) { $forum_new_top=0; echo 'Запрещено добавление нового сообщения ранее чем через 5 минут!
'; } } } } ////////////anti flud if ($forum_new_top==1) { if (isset($user_id1)) { $forum_new_title1 = $HTTP_POST_VARS["new_title"]; $forum_new_text1 = $HTTP_POST_VARS["new_text"]; $forum_new_text1=trim($forum_new_text1); $forum_new_text1 = preg_replace("/<[^<]*>/", "", $forum_new_text1); $forum_new_text1 = preg_replace("/<[^<]*>/", "", $forum_new_text1); $forum_new_text1 = preg_replace("/script/", "скрипт", $forum_new_text1); $forum_new_text1 = preg_replace("/src/", "срц", $forum_new_text1); $forum_new_title1=trim($forum_new_title1); $forum_new_title1 = preg_replace("/<[^<]*>/", "", $forum_new_title1); $forum_new_title1 = preg_replace("/<[^<]*>/", "", $forum_new_title1); $forum_new_title1 = preg_replace("/script/", "скрипт", $forum_new_title1); $forum_new_title1 = preg_replace("/src/", "срц", $forum_new_title1); $user_is_ban = $HTTP_SESSION_VARS["user_is_ban"]; if ($user_is_ban==1){ $forum_new_title1 = "ГАВ-ГАВ-ГАВ"; $forum_new_text1 = "ГАВ-ГАВ-ГАВ"; } $add_time=mktime(); $sql = 'INSERT INTO `forum_topic` ( `id` , `autor_id` , `title` , `create` , `last_read` , `last_answer` , `last_autor` , `read_count` , `answer_count` ) ' . ' VALUES ( \'\', \''.$user_id1.'\', \''.$forum_new_title1.'\', \''.$add_time.'\', \'\', \''.$add_time.'\', \''.$user_id1.'\', \'\', \'1\' )'; $res=mysql_query($sql); $sql= "SELECT max(id) as id FROM forum_topic"; $res=mysql_query($sql); $topic_id=mysql_result($res,0,"id"); $sql = 'INSERT INTO `forum_message` ( `id` , `topic_id` , `autor_id` , `user3` , `message` , `create` , `ip` ) ' . ' VALUES ( \'\', \''.$topic_id.'\', \''.$user_id1.'\', \''.trim($user_name3).'\', \''.$forum_new_text1.'\', \''.$add_time.'\', \''.$real_ip.'\' )'; $res=mysql_query($sql); if ($res){ echo 'Вы успешно добавили новую тему!!!
' ; } else { echo 'Ошибка выполнения запроса
'.$sql; exit; } } else { echo ('Ошибка авторизации'); } } $forum_navi_str=''; if (!ereg("([0-9]+)",$topic_begin,$tmp)) { $topic_begin=0; } else { $topic_begin=$tmp[1]; } if ($topic_begin<0) { $topic_begin=0; } $zapros1="select t.id as topic_id, t.create as time_create, t.last_answer as last_ans, t.title as title, t.answer_count as answer_count, t.read_count as read_count , u.name as autor, a.name as answer_autor FROM users u, users a ,forum_topic t WHERE (t.autor_id=u.id ) AND (t.last_autor = a.id) GROUP BY t.id ORDER BY last_ans DESC"; $res=mysql_query($zapros1); $kol=0; if ($res){ $kol=mysql_num_rows($res); /// $str_count=floor($kol/$forum_topic_on_page); if (($str_count*$forum_topic_on_page < $kol) and ($kol>$forum_topic_on_page)) { $str_count=$str_count+1; } if (!($str_count==0)) { $forum_curent_page=floor($forum_begin/$forum_topic_on_page); for ($i=0; $i<$str_count; $i++) { $i_nav=$i+1; if ($forum_curent_page == $i) { $forum_navi_page="".$i_nav.""; } else{ $forum_navi_page=''.$i_nav.''; } $forum_navi_str=''.$forum_navi_str.$forum_navi_page.' '; } } if (!(trim($forum_navi_str)=='')) { $forum_navi_str='Страницы: '.$forum_navi_str.''; } $forum_last=$forum_begin+$forum_topic_on_page; if ($kol< $forum_last){ $forum_last=$kol; } ///////// if ($kol>0){ echo '
'.$forum_navi_str.'
'; ?>
 
>>Создать новую тему<<


'.$er_autontif.'
'; } for ($i=$forum_begin; $i<$forum_last; $i++) { $topic_id=mysql_result($res,$i,"topic_id"); $topic_autor=mysql_result($res,$i,"autor"); $topic_ans_autor=mysql_result($res,$i,"answer_autor"); $topic_title=mysql_result($res,$i,"title"); $topic_date=mysql_result($res,$i,"time_create"); $topic_ans_date=mysql_result($res,$i,"last_ans"); $topic_read_count =mysql_result($res,$i,"read_count"); $topic_ans_count=mysql_result($res,$i,"answer_count"); $kol_page=ceil($topic_ans_count/10)+1; $navi_page=''; if($kol_page>1){ for ($t=1; $t<$kol_page; $t++) { $navi_page=$navi_page.''.$t.' '; } } ?>
Автор:
Тема:
'.$topic_title.''?>
Страницы:
Последнее сообщение
сообщений: просмотров:



>>Создать новую тему<<


'.$er_autontif.'
'; } ?>
 
 
 
'.$zapros1; } ?>