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

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