Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PsNews] baaaaad words :P, zakrywanie bluzgoff :D
Mamber
post
Post #1





Grupa: Zarejestrowani
Postów: 40
Pomógł: 0
Dołączył: 25.10.2004

Ostrzeżenie: (0%)
-----


Witam!
Mam problem a zarazem prośbę. Prowadzę dość często odwiedzany serwis, newsy są komentowane w dużej liczbie. Niestety ponieważ nie siedze przed monitorem 24h na dobe, jest dużo bluźnierstw, a nie moge zbanować wiekszości adresów ip, ponieważ użytkownicy korzystają z tej samej sieci i skrypt odczytuje wspólne ip, w przeciwieństwie do innych skróptów. Czy istenieje możliwość zrobienia uaktualnienia z możliwością blokady słów i lepszym "czytnikiem" ip?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Mamber
post
Post #2





Grupa: Zarejestrowani
Postów: 40
Pomógł: 0
Dołączył: 25.10.2004

Ostrzeżenie: (0%)
-----


OK, wiec pokazuje "wycinek" kodu odpowiedzialny za wyswietlanie komentarzy w pliku show.php:

  1. <?php
  2. //...reszta kodu
  3. /* cały news + komments :) */
  4. case show_all:
  5. $newsfile = file(&#092;"$newspath/news.txt\");
  6. reset($newsfile);
  7. foreach($newsfile as $news){
  8. $news = explode(&#092;"||\", $news);
  9. if($news[0] == $_GET[&#092;"no\"]){
  10. $news[2] = pscode($news[2]);
  11. if($config[&#092;"emoty_news\"] == \"tak\"){
  12. $news[2] = emots($news[2], $newspath);
  13. }
  14. $news[2] = stripslashes($news[2]);
  15. $news[2] = preg_replace(&#092;"'||'s\", \"||\", $news[2]);
  16.  
  17. $news[1] = stripslashes($news[1]);
  18. $news[1] = preg_replace(&#092;"'||'s\", \"||\", $news[1]);
  19.  
  20. //$news[1] = wordwrap($news[1], 50, \" \", 1);
  21. //$news[2] = wordwrap($news[2], 50, \" \", 1);
  22.  
  23. $data = date(&#092;"d.m.Y, H:i\", $news[3]);
  24.  
  25. if($config[&#092;"nimgs\"]==\"tak\"){
  26. $img_path = &#092;"$newspath/nimgs/$news[5]\";
  27. if((file_exists($img_path))&&($news[5]!=&#092;"brak\")&&($news[5]!=\"\")){
  28. $news[2] = &#092;"<img src=\"$img_path\" align=\"\".$config[\"nimgs_align\"].\"\" border=0> \".$news[2];
  29. }
  30. }
  31.  
  32. if(file_exists(&#092;"$newspath/komentarze/$news[0]\")){
  33. $komfile = file(&#092;"$newspath/komentarze/$news[0]\");
  34. $ilekomentarzy = count($komfile);
  35. }
  36. else{ $ilekomentarzy = 0; }
  37.  
  38. $print_center.= tplparse(array('{TYTUL}','{NEWS}','{AUTOR}','{EMAIL}','{DATA}','{KOMENTARZE}','{ILEKOMENTARZY}','{ZRODLO}','{SKOMENTUJ}'),array($news[1],$news[2],$userlist[$news[4]][3],$userlist[$news[4]][4],$data,$config[&#092;"adres\"].\"function=show_all&no=$news[0]\",$ilekomentarzy,$news[6],$config [\"adres\"].\"function=add_kom&no=$news[4]\",),$config[\"template\"],$newspath,\"news.html\");
  39. }
  40. }
  41. $print_center.= &#092;"<center>[<a href=\"\". $config[\"adres\"] .\"function=add_kom&no=\". $_GET[\"no\"] .\"\">Komentuj</a>] [<a href=\"\". $config[\"adres\"] .\"\">Wróć do newsów</a>]</center><br>\";
  42.  
  43. if($ilekomentarzy<1){ $print_center.= news_wiadomosc(&#092;"Do tego newsa nie dodano jeszcze żadnego komentarza.<br>[<a href=\"\".$config[\"adres\"].\"function=add_kom&no=\".$_GET[\"no\"].\"\">Skomentuj</a>]\"); }
  44. else{
  45. reset($komfile);
  46. foreach($komfile as $kom){
  47. $kom = explode(&#092;"||\", $kom);
  48. if($config[&#092;"emoty_kom\"] == \"tak\"){
  49. $kom[1] = emots($kom[1], $newspath);
  50. }
  51. $kom[2] = stripslashes($kom[2]);
  52. $kom[2] = preg_replace(&#092;"'||'s\", \"||\", $kom[2]);
  53.  
  54.  
  55. $kom[1] = stripslashes($kom[1]);
  56. $kom[1] = preg_replace(&#092;"'||'s\", \"||\", $kom[1]);
  57.  
  58. $kom[1] = wordwrap($kom[1], 50, &#092;" \", 1);
  59. $kom[2] = wordwrap($kom[2], 50, &#092;" \", 1);
  60.  
  61. $data = date(&#092;"d.m.Y, H:i\", $kom[4]);
  62.  
  63. $print_center.= tplparse(array('{KOMENTARZ}','{AUTOR}','{EMAIL}','{DATA}'),array($kom[1],$kom[2],$kom[3],$data),$config[&#092;"template\"],$newspath,\"komentarz.html\");
  64. }
  65. }
  66.  
  67. break;
  68.  
  69. /* dodawanie komentarza */
  70. case add_kom:
  71. $banfile = file(&#092;"$newspath/ban.txt\");
  72. $ip = $_SERVER[&#092;"REMOTE_ADDR\"];
  73. $ban = &#092;"false\";
  74. foreach($banfile as $linia){
  75. $linia = explode(&#092;"||\", $linia);
  76. if($linia[0] == $ip){ $ban = &#092;"true\"; }
  77. }
  78. if($ban == &#092;"true\"){
  79. $print_center = news_wiadomosc(&#092;"Przepraszamy, ale nie masz zezwolenia na dodanie komentarza, ponieważ twoje
     
  80. P: ($ip) zostało zablokowane przez administratora.<br>[<a href=\"\".$config[\"adres\"].\"\">Wróć do newsów</a>]\");
  81. }
  82. else{
  83. if($_GET[\"do\"] == \"save\"){
  84. $filename = \"$newspath/komentarze/\".$_GET[\"no\"];
  85. if(file_exists($filename)){
  86. $kom_autor = $_POST[\"kom_autor\"];
  87. $kom_email = $_POST[\"kom_email\"];
  88. $komentarz = $_POST[\"komentarz\"];
  89. $kom_autor = strip_tags($kom_autor);
  90. $kom_email = strip_tags($kom_email);
  91. $komentarz = strip_tags($komentarz);
  92. $kom_autor = str_replace(\"|\", \"|\", $kom_autor);
  93. $kom_email = str_replace(\"|\", \"|\", $kom_email);
  94. $komentarz = str_replace(\"|\", \"|\", $komentarz);
  95. $kom_autor = preg_replace(\"'n|rn|r'si\", \"\", $kom_autor);
  96. $kom_email = preg_replace(\"'n|rn|r'si\", \"\", $kom_email);
  97. $komentarz = preg_replace(\"'n|rn|r'si\", \"<br>\", $komentarz);
  98. $numer = max_l_plik(0, \"||\", $filename)+1;
  99.  
  100. $file = fopen($filename, \"a+\");
  101. flock($file, 2);
  102. $puts = \"$numer||$komentarz||$kom_autor||$kom_email||\".time().\"||$ip||n\";
  103. fputs($file, $puts);
  104. flock($file, 3);
  105. fclose($file);
  106. $print_center = '<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL='.$config[\"adres\"].'\">';
  107. }
  108. else{
  109. $print_center = news_wiadomosc(\"Nie można dodać komentarza - brak pliku z bazą danych do tego newsa.<br>[<a href=\".$config[\"adres\"].\">Wróć do newsów</a>]\");
  110. }
  111. }
  112. else{
  113. $print_center.= \"
  114. <form action=&#092;"\". $config[\"adres\"].\"function=add_kom&no=\".$_GET[\"no\"].\"&do=save\" method=post name=formularz>
  115. Autor:<br><input type=text name=&#092;"kom_autor\"><br>
  116. Email:<br><input type=text name=&#092;"kom_email\"><br>
  117. Komentarz:<br>&#092;";
  118. if($config[&#092;"emoty_kom\"] == \"tak\"){ $print_center.= list_emots($newspath,\"komentarz\").\"<br>\"; }
  119. $print_center.= &#092;"<textarea style=\"width:300; height:150\" name=\"komentarz\"></textarea><br>
  120. <input type=submit value=&#092;"dodaj\">
  121. <br><a href=&#092;"\".$config[\"adres\"].\"\">[Rezygnuj]</a>
  122. </form>
  123. &#092;";
  124. }
  125. }
  126. break;
  127. }
  128.  
  129.  
  130.  
  131. /* wyświetlanie */
  132. eval(&#092;"?>\".$print_center.\"<?\");
  133. ?>


Ten post edytował DeyV 20.11.2004, 18:13:33
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 4.10.2025 - 17:24