[RP] news comments spam fix! [SLEDMORE]

Results 1 to 22 of 22
  1. #1
    Account Upgraded | Title Enabled! Sledmore is offline
    MemberRank
    Jun 2009 Join Date
    1,133Posts

    [RP] news comments spam fix! [SLEDMORE]

    Hey guys,

    Well i have had fun using this little bug my self on hotels to spam the news constantly, but it get s a little boring seeing the same comments over and over...

    So i decided to whip up a quick fix!

    All this requires is putting my PHP Code onto your page, then it will be fixed :').

    CREDITS:
    RastaLulz - Making the page.
    Sledmore - Fixing the spam glitch.

    PHP:
    Overright your articles.php page with this code:
    PHP Code:
    <?php
    /*================================================================+\
    || # PHPRetro - An extendable virtual hotel site and management
    |+==================================================================
    || # Copyright (C) 2009 Yifan Lu. All rights reserved.
    || # http://www.yifanlu.com
    || # Parts Copyright (C) 2009 Meth0d. All rights reserved.
    || # http://www.meth0d.org
    || # All images, scripts, and layouts
    || # Copyright (C) 2009 Sulake Ltd. All rights reserved.
    |+==================================================================
    || # PHPRetro is provided "as is" and comes without
    || # warrenty of any kind. PHPRetro is free software!
    || # License: GNU Public License 3.0
    || # http://opensource.org/licenses/gpl-license.php
    \+================================================================*/

    $page['allow_guests'] = true;
    require_once(
    './includes/core.php');
    require_once(
    './includes/session.php');
    $data = new community_sql;
    $lang->addLocale("community.news");

    $id $input->FilterText($_GET['id']);
    $category $input->stringToURL($input->HoloText($_GET['category'],true),true,false);
    $archive $_GET['archive'];
    $pagenum $_GET['pageNumber'];
    if(!isset(
    $_GET['pageNumber'])){ $pagenum 1; }

    if(!isset(
    $id) || $id == ""){ $id $db->result($db->query("SELECT MAX(id) AS count FROM ".PREFIX."news LIMIT 1")); }

    $news_row $db->fetch_assoc($db->query("SELECT * FROM ".PREFIX."news WHERE id = '".$id."' LIMIT 1"));
    foreach (
    $news_row as &$value) {
        
    $value $input->HoloText($valuetrue);
    }
    $page['id'] = "news";
    $page['name'] = $lang->loc['pagename.news']." - ".$news_row['title'];
    $page['bodyid'] = "news";
    $page['cat'] = "community";

    require_once(
    './templates/community_header.php');
    ?>
    <div id="container">
        <div id="content" style="position: relative" class="clearfix">
        <div id="column1" class="column">

                    <div class="habblet-container ">
                            <div class="cbb clearfix default ">


                                <h2 class="title"><?php echo $lang->loc['pagename.news']; ?>
                                </h2>
                            <div id="article-archive">
    <?php if(isset($_GET['archive']) && $archive "true"){
    $count $db->result($db->query("SELECT COUNT(*) FROM ".PREFIX."news"));
    $pages ceil($count 20); ?>
    <div id="article-paging" class="clearfix">
            <?php if(($pagenum 1) <= $pages){ ?><a href="<?php echo PATH?>/articles/archive?pageNumber=<?php echo $pagenum 1?>" class="older">&lt;&lt; <?php echo $lang->loc['older']; ?></a><?php ?>
            <?php if(($pagenum 1) > 0){ ?><a href="<?php echo PATH?>/articles/archive?pageNumber=<?php echo $pagenum 1?>" class="newer"><?php echo $lang->loc['newer']; ?> &gt;&gt;</a><?php ?>
    </div>
    <?php ?>
    <?php
    if((!isset($archive) || $archive == "false") && (!isset($_GET['category']) || $_GET['category'] = "")){
    $time['stop'] = time() - 60*60*24;
    $sql $db->query("SELECT * FROM ".PREFIX."news WHERE time > ".$time['stop']." ORDER BY id DESC");
    if(
    $db->num_rows($sql) > 0){ ?>
    <h2><?php echo $lang->loc['today']; ?></h2>
    <ul>

    <?php while($row $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?>
        <li>
            <a href="<?php echo PATH?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?>&nbsp;&raquo;</a>
        </li>

    <?php ?>

    </ul>
    <?php }
    $time['start'] = time() - 60*60*24$time['stop'] = time() - 60*60*24*2;
    $sql $db->query("SELECT * FROM ".PREFIX."news WHERE time < ".$time['start']." AND time > ".$time['stop']." ORDER BY id DESC");
    if(
    $db->num_rows($sql) > 0){ ?>
    <h2><?php echo $lang->loc['yesterday']; ?></h2>
    <ul>

    <?php while($row $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?>
        <li>
            <a href="<?php echo PATH?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?>&nbsp;&raquo;</a>
        </li>

    <?php ?>

    </ul>
    <?php }
    $time['start'] = time() - 60*60*24*2$time['stop'] = time() - 60*60*24*7;
    $sql $db->query("SELECT * FROM ".PREFIX."news WHERE time < ".$time['start']." AND time > ".$time['stop']." ORDER BY id DESC");
    if(
    $db->num_rows($sql) > 0){ ?>
    <h2><?php echo $lang->loc['this.week']; ?></h2>
    <ul>

    <?php while($row $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?>
        <li>
            <a href="<?php echo PATH?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?>&nbsp;&raquo;</a>
        </li>

    <?php ?>

    </ul>
    <?php }
    $time['start'] = time() - 60*60*24*7$time['stop'] = time() - 60*60*24*14;
    $sql $db->query("SELECT * FROM ".PREFIX."news WHERE time < ".$time['start']." AND time > ".$time['stop']." ORDER BY id DESC");
    if(
    $db->num_rows($sql) > 0){ ?>
    <h2><?php echo $lang->loc['last.week']; ?></h2>
    <ul>

    <?php while($row $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?>
        <li>
            <a href="<?php echo PATH?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?>&nbsp;&raquo;</a>
        </li>

    <?php ?>

    </ul>
    <?php }
    $time['start'] = time() - 60*60*24*14$time['stop'] = time() - 60*60*24*30;
    $sql $db->query("SELECT * FROM ".PREFIX."news WHERE time < ".$time['start']." AND time > ".$time['stop']." ORDER BY id DESC");
    if(
    $db->num_rows($sql) > 0){ ?>
    <h2><?php echo $lang->loc['this.month']; ?></h2>
    <ul>

    <?php while($row $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?>
        <li>
            <a href="<?php echo PATH?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?>&nbsp;&raquo;</a>
        </li>

    <?php ?>

    </ul>
    <?php }
    }elseif(isset(
    $_GET['archive']) && $archive "true"){ ?>
    <h2><?php echo $lang->loc['pagename.news']; ?></h2>
    <ul>

    <?php
    $sql 
    "SELECT * FROM ".PREFIX."news ORDER BY time DESC LIMIT 20";
    if(
    $pagenum 1){ $sql $sql." OFFSET ".($pagenum 1) * 20; }
    $sql $db->query($sql);
    while(
    $row $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?>
        <li>
            <a href="<?php echo PATH?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>/in/archive<?php if($pagenum 1){ echo $pagenum; } ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?>&nbsp;&raquo;</a>
        </li>

    <?php ?>

    </ul>
    <?php }elseif(isset($_GET['category'])){ ?>
    <h2><?php echo $lang->loc['pagename.news']; ?></h2>
    <ul>

    <?php
    $sql 
    $db->query("SELECT * FROM ".PREFIX."news WHERE categories LIKE '%".$category."%'");
    while(
    $row $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?>
        <li>
            <a href="<?php echo PATH?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>/in/category/<?php echo $category?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?>&nbsp;&raquo;</a>
        </li>

    <?php ?>

    </ul>
    <?php ?>

    <a href="<?php echo PATH?>/articles/archive"><?php echo $lang->loc['more.news']; ?> &raquo;</a>
    </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><?php echo $news_row['title']; ?></h2>
        <div class="article-meta"><?php echo $lang->loc['posted']." ".date('M j, Y',$news_row['time']); ?>
        <?php $categories explode(",",$news_row['categories']); $output ""; foreach($categories as &$value){ $output $output."<a href=\"".PATH."/articles/category/".$input->stringToURL($input->HoloText($value,true),true,true)."\">".$value."</a>, "; } $output substr_replace($output,"",-2); ?>
            <?php echo $output?></div>

        <?php $images explode(",",$news_row['images']); if(!empty($images[0])){ ?>
                <img src="<?php echo $images[0]; ?>" class="article-image"/>
        <?php ?>
        <p class="summary"><?php echo nl2br($news_row['summary']); ?></p>

        <div class="article-body">
    <p><?php echo nl2br($news_row['story']); ?></p>
    <div class="article-author">- <?php echo $news_row['author']; ?></div>

    <?php if(count($images) > 1){ unset($images[0]); $output ""; foreach($images as &$value){ $output $output."<a href=\"".$value."\" style=\"background-image: url(".$value."); background-position: -0px -0px\"></a>\n"; } ?>
        <div class="article-images clearfix">

            <?php echo $output?>

        </div>
    <?php ?>

        <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, "<?php echo $lang->loc['image.loading']; ?>");
                    });
                });

                $$('a.article-<?php echo $news_row['id']; ?>').each(function(a) {
                    a.replace(a.innerHTML);
                });
            });
        </script>
        </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
    if(isset($_POST['post_comment']) && $user->name != 'Guest'){
      
    $posted_on date("M j, Y g:i A");
      
    $comment strip_tags($input->FilterText($_POST['comment']));
      if(
    $comment == NULL){
        
    $error_message 'You have left a field empty.<br /><br />';
        }else{
                    
    $GetInfo mysql_query("SELECT * FROM cms_news_comments WHERE article = '".$news_row['id']."' ORDER BY id DESC LIMIT 1");
                    
    $myID mysql_fetch_array($GetInfo);
                    if(
    $myID['userid'] == $user->id){
                    
    $error_message 'Please wait untill somebody else have placed a comment!<br /><br />';

      }else{
        
    mysql_query("INSERT INTO cms_news_comments (article, userid, comment, posted_on) VALUES ('".$news_row['id']."', '".$user->id."', '".$comment."', '".$posted_on."');");
        
    $error_message 'You have successfully left a comment.<br /><br />';
      }
     }
    }
    ?>

    <div class="habblet-container ">
      <div class="cbb clearfix notitle ">
        <div id="article-wrapper"><h2>Post Comment</h2>
          <div class="article-meta"></div>
          <div class="article-body">
            <?php
            
    if($user->name != 'Guest'){
            echo 
    $error_message?>
            <form action="" method="post">
            <textarea name="comment" maxlength="500"></textarea><br /><br />
            <input type="submit" name="post_comment" value="Post Comment" />
            </form>
            <?php
            
    }else{
              echo 
    'You must login to post a comment.';
            }
            
    ?>
          </div>
        </div>
      </div>
    </div>

    <?php
    $getComments 
    mysql_query("SELECT * FROM cms_news_comments WHERE article = '".$news_row['id']."' ORDER by id DESC");
    ?>
    <div class="habblet-container ">
      <div class="cbb clearfix notitle ">
        <div id="article-wrapper"><h2>Comments (<?php echo mysql_num_rows($getComments); ?>)</h2>
          <div class="article-meta"></div>
          <div class="article-body">
            <?php
            
    if(mysql_num_rows($getComments) == 0){
              echo 
    'Sorry, but no one has posted a comment yet.';
            }else{
              echo 
    '<table width="528px">';
              while(
    $Comments mysql_fetch_array($getComments)){
              
    $getUserInfo mysql_query("SELECT * FROM users WHERE id = '".$Comments['userid']."'");
              
    $userInfo mysql_fetch_array($getUserInfo);
                      echo 
    '
                      <tr>
                        <td width="90px" valign="top">
                          <div style="float:left"><img src="http://www.habbo.co.uk/habbo-imaging/avatarimage?figure='
    .$userInfo['figure'].'&size=b&direction=2&head_direction=3&gesture=sml&size=m"></div>
                          '
    ;
    if(
    $userInfo['rank'] > 5){
    echo 
    '<div style="position: absolute; z-index:1"><img src="http://92.232.205.192/dcrs/c_images/ADM.gif"></div>';
    }
    if(
    $userInfo['rank'] == 3){
    echo 
    '<div style="position: absolute; z-index:1"><img src="http://92.232.205.192/dcrs/c_images/VIP.gif"></div>';
    }

                     echo 

                    </td>
                        <td width="427px" valign="top">
                          <strong>RE: '
    .$news_row['title'].'</strong><br /><br />'.$Comments['comment'].'
                        </td>
                      </tr>
              <tr>
                        <td width="90px" valign="top">
                        </td>
                <td width="427px" align="right">
                  <i>Posted by <strong><a href="#">'
    .$userInfo['name'].'</a></strong> on '.$Comments['posted_on'].'</i><br /><br />
                </td>
              </tr>'
    ;
              }
              echo 
    '</table>';
            }
            
    ?>
          </div>
        </div>
      </div>
    </div>

                    <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>


    </div>
    <script type="text/javascript">
    HabboView.run();
    </script>
    <?php require_once('./templates/community_footer.php'); ?>
    Screenshots:
    See attachments!

    Thanks, hope you like it ;'D!

    - Also people don't forgot to thanks button ;').
    Attached Thumbnails Attached Thumbnails blank.png   comment.png   please-wait...png   new-user.png   allowed-again.png  

    Last edited by Sledmore; 15-07-10 at 01:40 AM.


  2. #2
    yerro Adde is offline
    MemberRank
    Feb 2010 Join Date
    none ur bizzLocation
    2,731Posts

    Re: [RP] news comments spam fix! [SLEDMORE]

    Im very grateful for this release!

    Thanks Sledmore!

  3. #3
    Account Upgraded | Title Enabled! Sledmore is offline
    MemberRank
    Jun 2009 Join Date
    1,133Posts

    Re: [RP] news comments spam fix! [SLEDMORE]

    Quote Originally Posted by What? View Post
    Im very grateful for this release!

    Thanks Sledmore!
    Thanks, glad ya like it ;')

    - Also people don't forgot to thanks button ;').

  4. #4
    Account Upgraded | Title Enabled! Ðavid is offline
    MemberRank
    Mar 2009 Join Date
    AntarcticaLocation
    233Posts

    Re: [RP] news comments spam fix! [SLEDMORE]

    You should add a delete button for staff. So they can delete comments.
    Tired of going to the database and looking for the comment to delete.

    And good release!

  5. #5
    Account Upgraded | Title Enabled! Sledmore is offline
    MemberRank
    Jun 2009 Join Date
    1,133Posts

    Re: [RP] news comments spam fix! [SLEDMORE]

    Quote Originally Posted by David207 View Post
    You should add a delete button for staff. So they can delete comments.
    Tired of going to the database and looking for the comment to delete.

    And good release!
    Pretty good idea, may think of it :').

  6. #6
    Account Upgraded | Title Enabled! Ðavid is offline
    MemberRank
    Mar 2009 Join Date
    AntarcticaLocation
    233Posts

    Re: [RP] news comments spam fix! [SLEDMORE]

    Quote Originally Posted by Sledmore View Post
    Pretty good idea, may think of it :').
    People would love it. (:
    Trust me. A reason why some hotels didn't add news comments, cause of the spam and etc.

  7. #7

    Re: [RP] news comments spam fix! [SLEDMORE]

    Nice fix, if/when we reopen our RP we'll be sure to add this.

  8. #8
    Account Upgraded | Title Enabled! Sledmore is offline
    MemberRank
    Jun 2009 Join Date
    1,133Posts

    Re: [RP] news comments spam fix! [SLEDMORE]

    Quote Originally Posted by Habbo_Retros View Post
    Nice fix, if/when we reopen our RP we'll be sure to add this.
    Glad ya like it dude :').

  9. #9
    En Français? Bjork is offline
    MemberRank
    Apr 2007 Join Date
    854Posts

    Re: [RP] news comments spam fix! [SLEDMORE]

    Nice :)

  10. #10

    Re: [RP] news comments spam fix! [SLEDMORE]

    Quote Originally Posted by Sledmore View Post
    Glad ya like it dude :').
    I always appreciate good quality work. :P

  11. #11

    me ridez bykes

    Sean is offline

    LegendRank
    Jun 2007 Join Date
    JerseyLocation
    4,098Posts

    Re: [RP] news comments spam fix! [SLEDMORE]

    Good release Craig, its nice :)

  12. #12
    Account Upgraded | Title Enabled! Sledmore is offline
    MemberRank
    Jun 2009 Join Date
    1,133Posts

    Re: [RP] news comments spam fix! [SLEDMORE]

    Quote Originally Posted by Habbo_Retros View Post
    I always appreciate good quality work. :P
    Thanks for comment appreciated :').

    Quote Originally Posted by sean111 View Post
    Good release Craig, its nice :)
    Cheers sean ;'D!

  13. #13

    me ridez bykes

    Sean is offline

    LegendRank
    Jun 2007 Join Date
    JerseyLocation
    4,098Posts

    Re: [RP] news comments spam fix! [SLEDMORE]

    Quote Originally Posted by Sledmore View Post
    Thanks for comment appreciated :').



    Cheers sean ;'D!
    Haha, anytime Craig, glad your releasing good stuff :P

  14. #14
    Proficient Member swimoTheBig is offline
    MemberRank
    Aug 2008 Join Date
    Essex, UKLocation
    194Posts

    Re: [RP] news comments spam fix! [SLEDMORE]

    Well done craig.

  15. #15
    Account Upgraded | Title Enabled! Sledmore is offline
    MemberRank
    Jun 2009 Join Date
    1,133Posts

    Re: [RP] news comments spam fix! [SLEDMORE]

    Quote Originally Posted by sean111 View Post
    Haha, anytime Craig, glad your releasing good stuff :P
    Quote Originally Posted by swimoTheBig View Post
    Well done craig.
    Ahah cheers guys :') - Ran out of thanks at the moment xD.

  16. #16
    Valued Member Expliot is offline
    MemberRank
    Jun 2010 Join Date
    AustraliaLocation
    103Posts

    Re: [RP] news comments spam fix! [SLEDMORE]

    Thanks for this.

  17. #17
    Account Upgraded | Title Enabled! Sledmore is offline
    MemberRank
    Jun 2009 Join Date
    1,133Posts

    Re: [RP] news comments spam fix! [SLEDMORE]

    Quote Originally Posted by Expliot View Post
    Thanks for this.
    Your welcomes :').

  18. #18
    Apprentice xixclan is offline
    MemberRank
    Jul 2010 Join Date
    24Posts

    Re: [RP] news comments spam fix! [SLEDMORE]

    Thanks :) been looking for the fix

  19. #19
    Infraction Banned HabMoon is offline
    MemberRank
    Jun 2007 Join Date
    HM OfficesLocation
    3,068Posts

    Re: [RP] news comments spam fix! [SLEDMORE]

    Don't need it but thanks for sharing to the community :)

    Thanked' haha
    HabMoon

  20. #20
    Account Upgraded | Title Enabled! Sledmore is offline
    MemberRank
    Jun 2009 Join Date
    1,133Posts

    Re: [RP] news comments spam fix! [SLEDMORE]

    Quote Originally Posted by xixclan View Post
    Thanks :) been looking for the fix
    Well, now you have it ;').

    Quote Originally Posted by habmoon View Post
    Don't need it but thanks for sharing to the community :)

    Thanked' haha
    HabMoon
    Aha, Cheers for the thanks :').

  21. #21
    Account Upgraded | Title Enabled! SlimHotel is offline
    MemberRank
    Mar 2011 Join Date
    c:\xampp\htdocsLocation
    390Posts

    Re: [RP] news comments spam fix! [SLEDMORE]

    10/10 great release

  22. #22
    Proficient Member Cool Aid is offline
    MemberRank
    Jun 2011 Join Date
    XamppLocation
    197Posts

    Re: [RP] news comments spam fix! [SLEDMORE]

    This is amazing!!



Advertisement