Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Revcms news comments 1 comment per user

Initiate Mage
Joined
Jan 11, 2015
Messages
2
Reaction score
0
Hello Ragezone,

A few days ago i added the plugin news comments but there are a lot of spammers in the comments. So does anybody know how to limit the post count to 1 for eacht article?

This is my news.php with news comments.
PHP:
<?php    if(!isset($_SESSION['user']['username'])){        header('Location: index');        exit();    }?><html lang="en"><script>window.alert = function() {};
// or simplyalert = function() {};</script><?php
if(isset($_GET['id'])) {$id = mysql_real_escape_string($_GET['id']);$query = mysql_query( "SELECT * FROM `cms_news` WHERE id = '{$id}'" );$array = mysql_fetch_array($query);
if ($array == null){$getMax = mysql_fetch_array(mysql_query("SELECT MAX(id) FROM cms_news LIMIT 1"));header("Location: ".$_CONFIG['hotel']['url']."/index.php?url=news&id=". $getMax['MAX(id)'] ."");exit();}}?><!DOCTYPE html><html lang="en">    <head>        <meta http-equiv="content-type" content="text/html; charset=utf-8">        <title>{hotelName} Hotel - Nieuws</title>        <div id="fb-root"></div>
        <link rel="stylesheet" href="/web-gallery/static/styles/common.css" type="text/css">        <script type="text/javascript" src="/web-gallery/static/js/libs2.js"></script>        <script type="text/javascript" src="/web-gallery/static/js/visual.js"></script>        <script type="text/javascript" src="/web-gallery/static/js/libs.js"></script>        <script type="text/javascript" src="/web-gallery/static/js/common.js"></script>        <script type="text/javascript" src="/web-gallery/static/js/fullcontent.js"></script>               <script type="text/javascript">            document.habboLoggedIn = true;            var habboName = "{username}";            var habboId = "{userid}";            var habboReqPath = "";            var habboStaticFilePath = "/web-gallery/static";            var habboImagerUrl = "http://www.habbo.com/habbo-imaging/";            var habboPartner = "";            var habboDefaultClientPopupUrl = "{url}/client";            window.name = "habboMain";            if (typeof HabboClient != "undefined") {                HabboClient.windowName = "eac955c8dbc88172421193892a3e98fc7402021a";                HabboClient.maximizeWindow = true;            }        </script>               <!--[if IE 8]>            <link rel="stylesheet" href="/web-gallery/static/styles/ie8.css" type="text/css">        <![endif]-->        <!--[if lt IE 8]>            <link rel="stylesheet" href="/web-gallery/static/styles/ie.css" type="text/css" />        <![endif]-->        <!--[if lt IE 7]>            <link rel="stylesheet" href="/web-gallery/static/styles/ie6.css" type="text/css" />            <script type="text/javascript" src="/web-gallery/static/js/pngfix.js"></script>            <script type="text/javascript">                try { document.execCommand('BackgroundImageCache', false, true); } catch(e) {}            </script>            <style type="text/css">                body { behavior: url(/web-gallery/static/js/csshover.htc); }            </style>        <![endif]-->    </head>       <body id="news">   <body id="home">            <div id="overlay"></div>        <div id="header-container">            <div id="header" class="clearfix">                <h1><a href="{url}/"></a></h1>                <div id="subnavi">                    <div id="subnavi-user">					                   <div style="margin-top:7px"><b>{hotelname} Hotel:</b> Lees hier het laatste nieuws en blijf up to date!

</div>                                            </div>                    <div id="subnavi-search">                        <div id="subnavi-search-upper">                            <ul id="subnavi-search-links">                                <li><a href="{url}/logout" style="color:#000">Log uit</a></li> 								                            </ul>        </div>    </div>    <div id="to-hotel">                <a href="/client" class="new-button green-button" target="d954311fd8d9ce16fc0fd512dff02d550ddc667b" onclick="HabboClient.openOrFocus(this); return false;"><b>Naar hotel</b><i></i></a>     	</div></div><ul id="navi">        <li>			<a href="http://speelflix.nl/me">{username} ( <img src="{url}/app/tpl/skins/habbo/images/icon-naam.gif" style="vertical-align: middle;"> ) </a><span></span></li>
                                                      <li id="tab-gemeenschap" class="tab-gemeenschap selected"><a href="{url}/community">Community <img src="{url}/app/tpl/skins/habbo/images/forum_2.gif" style="vertical-align: middle;"></a><span></span></li>										<li id="tab-winkel-now" class="tab-winkel"><a href="{url}/gold">Gold kopen <img src="{url}/app/tpl/skins/habbo/images/star.png" style="vertical-align: middle;"></a><span></span></li>
					 					 <li id="tab-winkel-now" class="tab-winkel-now"><a href="{url}/winkel">Belcredits ({vip_points}) <img src="{url}/app/tpl/skins/habbo/images/veelwerk3.png" style="vertical-align: middle;"></a><span></span></li>							


</ul>
        <div id="habbos-online"><div class="rounded"><span>{online} {hotelname}'s in het hotel</span></div></div>	</div></div>
<div id="content-container">
<div id="navi2-container" class="pngbg">    <div id="navi2" class="pngbg clearfix">	<ul>		</li>    		<li class="last">			<li class="last"><a href="{url}/community">Community</a></li>													<li class="selected"><a href="{url}/news">Nieuws</a></li>														<li class="last"><a href="{url}/staff">Flix Staff</a></li>							<li class="last"><a href="{url}/experts">Flix eXperts</a></li>							<li class="last"><a href="{url}/dj">Flix DJ's</a></li>							<li class="last"><a href="{url}/goldleden">Flix Gold's</a></li>							<li class="last"><a href="{url}/rijkste">Rijkste Flix's</a></li>													<li class="last"><a href="{url}/contact">Contact</a></li>                    </ul>                </div>            </div>            <div id="container">                <div id="content" style="position: relative" class="clearfix">                    <div id="column1" class="column">                        <div class="habblet-container ">                            <div class="cbb clearfix red ">                                <h2 class="title">Nieuws</h2>                                <div id="article-archive">
                                    <ul>
                                        {newsList}                                    </ul>                                </div>                            </div>                        </div>                        <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>                    </div>                    <div id="column2" class="column">                        <div class="habblet-container ">                            <div class="cbb clearfix notitle ">                                <div id="article-wrapper">                                    <h2>{newsTitle} </h2>                                    <div class="article-meta">Gepost op {newsDate}</div>
                                    <p class="summary">{newsTitle}</p>                                    <div class="article-body">                              {newsContent}                                                                      <script type="text/javascript" language="Javascript">                                            document.observe("dom:loaded", function() {                                                $$('.article-images a').each(function(a) {                                                    Event.observe(a, 'click', function(e) {                                                        Event.stop(e);                                                        Overlay.lightbox(a.href, "Image is loading");                                                    });                                                });                                                                                  $$('a.article-2729').each(function(a) {                                                    a.replace(a.innerHTML);                                                });                                            });                                        </script>                                    </div>                                </div>                            </div>                        </div>            <?php

if(isset($_POST['post_comment']))  $posted_on = date("M j, Y g:i A");
if (empty($_POST['comment']))$_POST['comment'] = '';
$comment = strip_tags (filter($_POST['comment']));if($comment == NULL){        //define("ERROR", "You have to type in a reply!<br /><br />");    //$error_message = 'You have to type in a reply!<br /><br />';  }else{if (isLogged){  mysql_query("INSERT INTO site_news_comments (article, userid, comment, posted_on, author) VALUES ('".filter($_GET['id'])."',  '".$_SESSION['user']['id']."', '".filter($comment)."', '".$posted_on."', '" . $_SESSION['user']['username']. "');") or die(mysql_error());     define('SUCCESS', 'Je reactie is geplaatst!');

    define("ERROR", "<br>Bedankt voor je reactie!<br />");
        //$error_message = 'Thanks for your reply!<br /><br />';  }}?>
<div class="habblet-container "><div class="cbb clearfix notitle "><div id="article-wrapper"><h2>Plaats een reactie</h2><div class="article-meta"></div><div class="article-body"><?phpif($userPosts >= 1){    define('ERROR', 'Sorry, Je kan maar een keer reageren op een nieuws bericht.');}if(defined("SUCCESS")){?><div class="rounded rounded-green" width="20%">                    <?php echo SUCCESS; ?><br />                </div>                <div> </div><?php}if(defined("ERROR")) {?><div class="rounded rounded-red" width="20%">                    <?php echo ERROR; ?><br />                </div>                <div> </div><?php}else{?><?php                     $userPosts = mysql_query("SELECT * FROM site_news_comments WHERE article = '".htmlentities($_GET['id'])."' AND userid = '" . $_SESSON['user']['id']. "'");                     if($userPosts == 1)                     {                         // Submit               }                     else { define('ERROR', 'Sorry, you are only allowed one comment per article.');       }          ?><form action="" method="post"><textarea name="comment" maxlength="500"></textarea><br /><br /><input type="submit" name="post_comment" value="Plaats reactie" /></form><?php}?></div></div></div></div>
<style type="text/css">input[type="text"], input[type="password"] {background-color: #F1F1F1;border: 1px solid #999999;width: 175px;padding: 5px;font-family: verdana;font-size: 10px;color: #666666;}input[type="submit"] {background-color: #F1F1F1;border: 1px solid #999999;padding: 5px;font-family: verdana;font-size: 10px;color: #666666;}textarea {background-color: #F1F1F1;border: 1px solid #999999;padding: 5px;width: 517px;height: 70px;font-family: verdana;font-size: 10px;color: #666666;}select {background-color: #F1F1F1;border: 1px solid #999999;padding: 5px;font-family: verdana;font-size: 10px;color: #666666;}</style><?php$getComments = mysql_query("SELECT * FROM site_news_comments WHERE article = '".filter($_GET['id'])."' ORDER by id DESC");?><div class="habblet-container "><div class="cbb clearfix notitle "><div id="article-wrapper"><h2>Reacties <?php echo mysql_num_rows($getComments); ?></h2><div class="article-meta"></div><div class="article-body"><?php      if(mysql_num_rows($getComments) == 0) {          echo "Er heeft nog niemand gereageerd op dit bericht";      } else {          echo '<table width="528px">';          while($Comments = mysql_fetch_array($getComments)){          $getUserInfo = mysql_query("SELECT * FROM users WHERE username = '".$Comments['author']."'");          $userInfo = mysql_fetch_array($getUserInfo);                  echo '                  <tr>                    <td width="90px" valign="top"></div>                    <div style="height: 65px;width: 50px;float: left;overflow: hidden;">                      <div style="float:left"><img position:absolute; src="http://www.habbo.nl/habbo-imaging/avatarimage?figure='.$userInfo['look'].'&size=b&direction=2&head_direction=3&gesture=sml&size=2"></div>                      ';                        if($userInfo['rank'] >= 6) {                            echo '<div style="position: absolute; z-index:1"><img src="{url}/r63/c_images/album1584/staff.gif"></div>';                        }                        if($userInfo['rank'] == 5) {                            echo '<div style="position: absolute; z-index:1"><img src="{url}/r63/c_images/badges/XXX.gif"></div>';                        }                        if($userInfo['rank'] == 4) {                            echo '<div style="position: absolute; z-index:1"><img src="{url}/r63/c_images/badges/hba.gif"></div>';                        }                        if($userInfo['rank'] == 2) {                            echo '<div style="position: absolute; z-index:1"><img src="{url}/r63/c_images/badges/VIP.gif"></div>';                        }                        if($userInfo['rank'] == 1) {                            echo '<div style="position: absolute; z-index:1"><img src="{url}/r63/c_images/badges/VIP.gif"></div>';                        }        
                echo '
                </td>                    <td width="427px" valign="top">                    <i><a href="/me">'.$userInfo['username'].' </a></i>                                        <br /><br />'.$Comments['comment'].'                            
                    </td>                  </tr>          <tr>                    <td width="80px" valign="top">                            </td>                                <td width="400px" align="right">
                                                                    
            
</div></div></div></div><br><div style="width:125%; height:1px; background-color:#ccc; margin-top:-17px;"></div>

            </td>          </tr>';          }          echo '</table>';        }        ?></div> </div> </div> </div></div></div></div></div>
        <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>        <script type="text/javascript">            HabboView.run();        </script>
        <!--[if lt IE 7]>            <script type="text/javascript">                Pngfix.doPngImageFix();            </script>        <![endif]-->

        <div id="footer" >                 </div>
    </body></html>

Does anybody know and want to help me? :) Btw if you want to use this you can copy it :)
 
Back
Top