Index du Forum » » Sécurité

Auteur

[Résolu] - Correctif AntiSpamBots
xgonin
709      
 

  Posté : 07-07-2006 01:21

Et la fin du code :


      global $subscribe;
      if ($subscribe) {
         if (subscribe_query($userdata[uid],"forum",$forum)) {
            $sauf =$userdata[uid];
         }
         subscribe_mail("forum", $topic,$forum,"",$sauf);
      }
      if ($upload) {
         !include!("modules/uplo ad/upload_forum.php");
         win_upload("forum_npds" ,$IdPost,$forum,$topic,"win");
      }
      redirect_!url(!"viewtopicH.php?forum=$for um&topic=$topic");
   } else {
      OpenTable();
      echo "<p align=\"center\">".translate("You must type a message to post.")."<br /><br />";
      echo "[ <a href=\"!javascript!:history.go(-1)\" class=\"NOIR\">".translate("Go Back")."</a> ]</p>";
      CloseTable();
   }
} else {
   !include!('header.php');
   if ($allow_bbcode==1) {
      !include!("lib/formhelp.java.php");
   }

   list($topic_title, $stopic_status) = mysql_fetch_array(mysql_query("select topic_title, topic_status from forumtopics where topic_id='$topic'"));
   $userX = base_64_decode($user);
   $userdata = explode(":", $userX);
   $moderator = get_moderator($mod);
   $moderator=explode(" ",$moderator);
   $Mmod=false;
   echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"HEADER\">\n";
   echo "<b>".translate("Moderated By: ")."</b>";
   for ($i = 0; $i < count($moderator); $i++) {
      echo "<a href=user.php?op=userinfo&amp;uname=$moderator[$i] class=\"BOX\">$moderator[$i]</a> ";
     if (($userdata[1]==$moderator[$i])) { $Mmod=true;}
   }
   echo "</td></tr></table><br />";
   echo "<b>".translate("Post Reply in Topic:")."</b>";
   echo "&nbsp;<a href=\"viewforum.php?forum=$forum\" class=\"NOIR\">".stripslashes($forum_name)."</a>&nbsp;&nbsp;|& amp;nbsp;&nbsp;";
   echo "<a href=\"forum.php\" class=\"NOIR\">".translate("Forum Index")."</a>\n";
   echo "<br />";
   echo "<form action=\"replyH.php\" method=\"post\" name=\"coolsus\">";
   echo "<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" width=\"100%\">";
   echo "<tr><td class=\"HEADER\" colspan=\"2\" class=\"ONGL\">".translate("About Posting:")."</td></tr><tr>";
   if ($forum_access == 0) {
      echo "<td colspan=\"2\">".translate("Anonymous users can post new topics and replies in this forum.")."</td>";
   } else if($forum_access == 1) {
      echo "<td colspan=\"2\">".translate("All registered users can post new topics and replies to this forum.")."</td>";
   } else if($forum_access == 2) {
      echo "<td colspan=\"2\">".translate("Only Moderators can post new topics and replies in this forum.")."</td>";
   }
   echo "</tr>";
   $allow_to_reply=false;
   if ($forum_access==0) {
      $allow_to_reply=true;
   } elseif ($forum_access==1) {
      if (isset($user)) {
         $allow_to_reply=true; < br />      }
   } elseif ($forum_access==2) {
      if (user_is_moderator($userdata[0],$userdata[2],$forum_access)) {
         $allow_to_reply=true; < br />      }
   }
   if ($topic_status!=0)
      $allow_to_reply=false;

   if ($allow_to_reply) {
      if ($submitP) {
// ##### ==> AntiSpamBots
      global $question, $anti_spam_bots, $redir;
      AntiSpamBots::reponse($question, $anti_spam_bots);
// ##### ==> AntiSpamBots
         $acc = "reply";
         $message=stripslashes($ message);
         echo "<tr><td colspan=\"2\">";
         !include! ("preview.php");
         echo "</td></tr>";
      } else {
         $message='';
      }
      echo "<tr align=\"left\">";
      echo "<td class=\"LIGNB\" width=\"25%\"><b>".translate("Nickname: ")."<b></td>";
      echo "<td class=\"LIGNB\">";
      echo $userdata[1];
      echo "</td></tr>";
      if ($smilies) {
         echo "<tr align=\"left\" valign=\"top\">
         <td class=\"LIGNB\" width=\"25%\"><b>".translate("Message Icon: ")."<b></td>
         <td class=\"LIGNB\">";
         echo emotion_add($image_subject);
         echo "</td></tr>";
      }
      echo "<tr align=\"left\" valign=\"top\">";
      echo "<td class=\"LIGNB\" width=\"25%\"><b>".translate("Message: ")."</b><br /><br />";
      echo "<span style=\"font-size: 10px;\">";
      echo "HTML : ";
      if ($allow_html==1) {
         echo translate("On")."<br />";
         echo HTML_Add($allow_forum_hide);
      } else
         echo translate("Off")."<br />";
      if ($citation && !$submitP) {
         $sql = "SELECT p.post_text, p.post_time, u.uname FROM posts p, users u WHERE post_id = '$post' AND p.poster_id = u.uid";
         if ($r = mysql_query($sql)) {
            $m = mysql_fetch_array($r);
            $text = $m[post_text];
            if (($forum_type!="6") and ($forum_type!="5")) {
              ;  $text = smile($text);
              ;  $text = str_replace("<br />", "\n", $text);
            } else {
              ;  $text = htmlspecialchars($text);
            }
            $text = stripslashes($text);
            if ($m[post_time]!="" && $m[uname]!="") {
              ;  $reply = "<div class=\"QUOTE\">".translate("Quote")." : <b>$m[uname]</b>&nbsp;\n\n$text&nbsp;\n</div>";
            } else {
              ;  $reply = "$text\n";
            }
            $reply = preg_replace("#\[hide\](.*?)\[\/hide\]#si","",$reply);
         } else {
            $reply = translate("Error Connecting to DB")."\n";
         }
         $message = $reply;
      }
      echo "</span></td>";
      if ($allow_bbcode==1)
         $xJava = 'name="message" onSelect="storeCaret(this);" !onclick!="storeCaret(this);" !onkey!up="storeCaret(this);" !onfocus!="storeForm(this)"';
      echo "<td class=\"LIGNB\"><textarea class=\"textbox\" $xJava name=\"message\" rows=\"10\" cols=\"80\" wrap=\"virtual\">$message</textarea><br />";
      if ($allow_bbcode == 1)
         putitems();
      echo "</td></tr><tr align=\"left\">";
      echo "<td class=\"LIGNB\" width=\"25%\"><b>".translate("Options: ")."</b></td>";
      echo "<td class=\"LIGNB\">";
      if (($allow_html == 1) and ($forum_type!="6") and ($forum_type!="5")) {
         if ($html == "on") {
            $seth tml = "checked";
         }
         echo "<input type=\"checkbox\" name=\"html\" ".$sethtml.">".translate("Disable HTML on this Post")."<br />";
      }
      if ($user) {
         if ($allow_sig == 1) {
            $asig = mysql_query("select attachsig from users_status where uid='$cookie[0]'");
            list( $attachsig) = mysql_fetch_row($asig);
            if ($attachsig == 1||$sig == "on") {
              ;  $s = "checked";
            }
            if (($forum_type!="6") and ($forum_type!="5")) {
              ;  echo "<input type=\"checkbox\" name=\"sig\" $s>".translate("Show signature")." <span style=\"font-size: 10px;\">(".translate("This can be altered or added in your profile").")</span><br />";
            }
         }
         if ($allow_upload_forum) {
            if ($upload == "on") {
              ;  $up = "checked";
            }
            echo "<input type=\"checkbox\" name=\"upload\" $up>".translate("Upload file after send accepted")."<br />";
         }
      }
      echo "</td></tr><tr>";
      echo "<td class=\"LIGNA\" colspan=\"2\" align=\"center\">";
      echo "<input type=\"hidden\" name=\"forum\" value=\"$forum\">";
      echo "<input type=\"hidden\" name=\"topic\" value=\"$topic\">";
      echo "<input type=\"hidden\" name=\"post\" value=\"$post\">";
// ##### ==> AntiSpamBots
     AntiSpamBots::question();
     AntiSpamBots::field();
// ##### ==> AntiSpamBots
      echo "<br /><input class=\"BOUTON_STANDARD\" type=\"submit\" name=\"submitS\" value=\"".translate("Submit")."\">&nbsp;";
      echo "&nbsp;<input class=\"BOUTON_STANDARD\" type=\"submit\" name=\"submitP\" value=\"".translate("Preview")."\">&nbsp;";
      echo "&nbsp;<input class=\"BOUTON_STANDARD\" type=\"reset\" value=\"".translate("Clear")."\">&nbsp;";
      echo "&nbsp;<input class=\"BOUTON_STANDARD\" type=\"submit\" name=\"cancel\" value=\"".translate("Cancel Post")."\"><br /><br />";
      echo "</td></tr>";
   } else {
      echo "<tr>";
      echo "<td class=\"LIGNA\" colspan=\"2\" align=\"center\">".translate("You are not allowed to reply in this forum")."</td>";
      echo "</tr>";
   }
   echo "</table></form>";
}
!include!('footer.php');
?>




Cet article provient de NPDS

http://www.npds.org/viewtopic.php?topic=20840&forum=12