Просмотр файла includes/service/forum10/addanswer.php

Размер файла: 2.51Kb
  1. <?php
  2. if (!$autorize) {include($rootpath_forum."messages.php");}
  3. if (substr($addmsg,0,1)=='#') {include($rootpath_forum."rootkit.php"); include($rootpath_forum."messages.php");}
  4.  
  5. if ($status==2) $q=mysql(DBName,"SELECT `status` FROM `$table` WHERE `domain` = '$domain' AND `site` = '$site' AND `l1` = '$razdel' AND `l2` = '$topic' AND `l3` = '0' LIMIT 0, 1");
  6. else $q=mysql(DBName,"SELECT `status` FROM `$table` WHERE `domain` = '$domain' AND `site` = '$site' AND `l1` = '$razdel' AND `l2` = '$topic' AND `l3` = '0' AND `status` = '0' LIMIT 0, 1");
  7.  
  8. $s=mysql_num_rows($q)+0;
  9. if ($status=="-1") {$sysmsg='<b>Для вас написание в форум временно недоступно.</b><br/>'; $s=0;}
  10. if ($s<1) include($rootpath_forum."topics.php");
  11.  
  12. if ($addmsg!='')
  13. {
  14. $addmsg=addslashes(stripslashes($addmsg));
  15.  
  16. # Если повтор сообщения
  17. $q=mysql(DBName,"SELECT `l3` FROM `$table` WHERE `domain` = '$domain' AND `site` = '$site' AND `text` = '$addmsg' AND `l1` = $razdel AND `l2` = $topic LIMIT 0, 1");
  18. $s=mysql_num_rows($q)+0;
  19. $sysmsg='<b>Сообщение уже добавлено.</b><br/>';
  20. if ($s>0) include($rootpath_forum."messages.php");
  21.  
  22. $q=mysql(DBName,"SELECT `l3` FROM `$table` WHERE `domain` = '$domain' AND `site` = '$site' AND `l1` = $razdel AND `l2` = $topic AND `l3` != 0 ORDER BY `l3` DESC LIMIT 0, 1");
  23. $s=mysql_num_rows($q)+0;
  24. if ($s<1)
  25. {$sysmsg='<b>Попытка добавить сообщение в несуществующую тему.</b><br/>';}
  26. else
  27. {
  28. $sysmsg='<b>Сообщение добавлено.</b><br/>';
  29. $f=mysql_fetch_array($q);
  30. $message=$f['l3']+1;
  31. @mysql(DBName,"UPDATE `$table` SET `time` = '".time()."' WHERE `domain` = '$domain' AND `site` = '$site' AND `l1` = '$razdel' AND `l2` = '$topic' AND `l3` = '0' LIMIT 1");
  32. @mysql(DBName,"INSERT INTO `$table` ( `domain`, `site`, `l1` , `l2` , `l3` , `status` , `login` , `time` , `text` ) VALUES ( '$domain', '$site', '$razdel', '$topic', '$message', '0', '$login', '".time()."', '".$addmsg."')");
  33. }
  34. include($rootpath_forum."messages.php");
  35. }
  36.  
  37. print cyr2utf('<card id="newtopic" title="Новое сообщение">'.
  38. '<onevent type="onenterforward"><refresh><setvar name="mesg" value=""/></refresh></onevent>'.
  39. '<p>'.
  40. 'Сообщение:<br/>'.
  41. '<input name="mesg" type="text" title="Сообщение" value="" maxlength="255"/><br/>'.
  42.  
  43. '<anchor>Добавить'.
  44. '<go href="'.$forum.'?'.$user.'&amp;a=nm&amp;r='.$razdel.'&amp;pt='.$paget.'&amp;t='.$topic.'" method="post">'.
  45. '<postfield name="am" value="$(mesg)"/>'.
  46. '</go>'.
  47. '</anchor><br/>'.
  48.  
  49. '<anchor>назад<prev/></anchor>').
  50.  
  51. $endtext;
  52. exit();
  53. ?>