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!

News Page Not Working

Junior Spellweaver
Joined
Nov 25, 2011
Messages
150
Reaction score
18
PHP:
<!DOCTYPE html>
<html lang="en">
    <head>
		<link rel="shortcut icon" href="{url}/app/tpl/skins/{skin}/images/favicon.ico" type="image/vnd.microsoft.icon"/>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        <title>{hotelName} Hotel - News Articles</title>
        
        <link rel="stylesheet" href="{url}/app/tpl/skins/Habbo/styles/common.css" type="text/css">
        <script type="text/javascript" src="{url}/app/tpl/skins/Habbo/js/libs2.js"></script>
        <script type="text/javascript" src="{url}/app/tpl/skins/Habbo/js/visual.js"></script>
        <script type="text/javascript" src="{url}/app/tpl/skins/Habbo/js/libs.js"></script>
        <script type="text/javascript" src="{url}/app/tpl/skins/Habbo/js/common.js"></script>
        <script type="text/javascript" src="{url}/app/tpl/skins/Habbo/js/fullcontent.js"></script>
        
        <script type="text/javascript">
            document.habboLoggedIn = true;
            var habboName = "{username}";
            var habboId = {userid};
            var habboReqPath = "";
            var habboStaticFilePath = "{url}/app/tpl/skins/Habbo";
            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="{url}/app/tpl/skins/Habbo/styles/ie8.css" type="text/css">
        <![endif]-->
        <!--[if lt IE 8]>
            <link rel="stylesheet" href="{url}/app/tpl/skins/Habbo/styles/ie.css" type="text/css" />
        <![endif]-->
        <!--[if lt IE 7]>
            <link rel="stylesheet" href="{url}/app/tpl/skins/Habbo/styles/ie6.css" type="text/css" />
            <script type="text/javascript" src="{url}/app/tpl/skins/Habbo/js/pngfix.js"></script>
            <script type="text/javascript">
                try { document.execCommand('BackgroundImageCache', false, true); } catch(e) {}
            </script>
            <style type="text/css">
                body { behavior: url({url}/app/tpl/skins/Habbo/js/csshover.htc); }
            </style>
        <![endif]-->
    </head>
    
    <body id="news">
    
        <div id="overlay"></div>
             <?php include ("includes/header.php"); ?>
                <ul id="navi">
                    <li class="metab"><a href="{url}/me">{username}</a><span></span></li>
                    <li class="selected"><strong>Community</strong><span></span></li>
					<?php
                    if(isset($_SESSION['user']['id']))
                    if(mysql_result(mysql_query("SELECT rank FROM users WHERE id = '" . $_SESSION['user']['id'] . "'"), 0) >= 2)                    { 
                    echo '<li id="tab-register-now"><a href="{url}/ase/login" target="_blank">Staff Panel</a><span></span></li>';
                    }
                    ?>
                </ul>
                <div id="habbos-online"><div id="content"><div class="cbb "><span><b>{online}</b><br>User(s)<br>online</span></div></div></div>
            </div>
        </div>
        <div id="content-container">
            <div id="navi2-container" class="pngbg">
                <div id="navi2" class="pngbg clearfix">
                    <ul>
                        <li class=""><a href="{url}/community">Community</a></li>
                        <li class="selected">News Articles</li>
                        <li class=""><a href="{url}/staff">{hotelname} Staff</a></li>
						<li class=""><a href="{url}/topstats">Leaderboard</a></li>
						<li class="last"><a href="{url}/statistics">Statistics</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 default ">
                                <h2 class="title">News</h2>
                                <div id="article-archive">
                                    <ul>
                                        <?php
    {
    for ($i = 0; $i < 6; $i++)
        {
            $sectionName = "";
            $sectionCutoffMax = 0;
            $sectionCutoffMin = 0;
        
            switch ($i)
            {
                    case 0:
                
                            $sectionName = 'Today';
                            $sectionCutoffMax = time();
                            $sectionCutoffMin = time() - 86400;
                            break;
                        
                    case 1:
                
                            $sectionName = 'Yesterday';
                            $sectionCutoffMax = time() - 86400;
                            $sectionCutoffMin = time() - 172800;
                            break;
                        
                    case 2:
                
                            $sectionName = 'This week';
                            $sectionCutoffMax = time() - 172800;
                            $sectionCutoffMin = time() - 604800;
                            break;
                        
                    case 3:
                
                            $sectionName = 'Last week';
                            $sectionCutoffMax = time() - 604800;
                            $sectionCutoffMin = time() - 1209600;
                            break;
                        
                    case 4:
                
                            $sectionName = 'This month';
                            $sectionCutoffMax = time() - 1209600;
                            $sectionCutoffMin = time() - 2592000;
                            break;
                        
                    case 5:
                
                            $sectionName = 'Last month';
                            $sectionCutoffMax = time() - 2592000;
                            $sectionCutoffMin = time() - 5184000;
                            break;
            }
        
            $q = "SELECT * FROM cms_news WHERE published >= " . $sectionCutoffMin . " AND published <= " . $sectionCutoffMax .  " ORDER BY published DESC";
            $getArticles = mysql_query($q);
            if (mysql_num_rows($getArticles) > 0)
            {
				    echo '<br>';
                    echo '<h2>' . $sectionName . '</h2>';
                
                    while ($a = mysql_fetch_assoc($getArticles))
                    {
                        if($a['id'] == $_GET['id'])
                        {
                        echo '' . $a['title'] . ' »';
                        }
                        else
                        {
                        echo '<li><a href="/index.php?url=news&id=' . $a['id'] . '">' . $a['title'] . ' »</a></li>';
                        }
                    }
            }
        }
    }
?>
                                    </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">Posted {newsDate}</div>
                                    <p class="summary">{newsTitle}</p>
                                    <div class="article-body">
                                        {newsContent}
                                        <br><br>
                                        <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 (filter(! isset($_POST['comment']))) 
					{
                      $_POST['comment'] = '';
                    }
                     
                    $comment = strip_tags (filter($_POST['comment']));
                    if($comment == NULL)
					{
                            //define("ERROR", "You have to type in a reply!<br /><br />");
                    }
					elseif (preg_match("|habbi|", $comment) | preg_match("|habsay|", $comment) | preg_match("|habbihotel|", $comment) | preg_match("|lime|", $comment) | preg_match("|l i m e|", $comment) | preg_match("|h a b b i|", $comment) | preg_match("|h a b s a y|", $comment) | preg_match("|section|", $comment) | preg_match("|s e c t i o n|", $comment) | preg_match("|static|", $comment) | preg_match("|s t a t i c|", $comment) | preg_match("|.com|", $comment) | preg_match("|.côm|", $comment) | preg_match("|.c0m|", $comment) | preg_match("|. c 0 m|", $comment) | preg_match("|.net|", $comment) | preg_match("|.n e t|", $comment) | preg_match("|.org|", $comment) | preg_match("|.0rg|", $comment) | preg_match("|.o r g|", $comment) | preg_match("|.0 r g|", $comment) | preg_match("|.us|", $comment) | preg_match("|.u s|", $comment))
					define('ERROR', 'Sorry but you can\'t advertise here buddy!');
					else
					{
                    if (isLogged)
                    {
                        mysql_query("INSERT INTO site_news_comments (article, userid, comment, posted_on, author) VALUES ('".htmlentities($_GET['id'])."', '".$_SESSION['userid']."', '".filter($comment)."', '".$posted_on."', '" . $_SESSION['user']['username']. "');");
                        define('SUCCESS', 'You have successfully posted a comment on this news article!');
                    }
                    }
                    ?>
                     
                    <div class="habblet-container ">
                    <div class="cbb clearfix notitle ">
                    <div id="article-wrapper"><h2>Place Comment</h2>
                    <div class="article-meta"></div>
                    <div class="article-body">
                    <?php
                    if($userPosts >= 1)
                    {
                        define('ERROR', 'Sorry, you are only allowed one comment per article.');
                    }
                    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
                    {
                    ?>
                    <form action="" method="post">
                    <textarea name="comment" maxlength="500"></textarea><br /><br />
                    <input type="submit" name="post_comment" value="Place Comment" />
                    </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 = '".htmlentities($_GET['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 "No comments for this article!";
                          } 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.com/habbo-imaging/avatarimage?figure='.$userInfo['look'].'&size=b&direction=2&head_direction=3&gesture=sml&size=2"></div>
                                          ';
										  if($userInfo['rank'] == 9) {
                                                echo '<div style="position: absolute; z-index:1"><img src="{url}/swfs/c_images/album1584/ADM90.gif"></div>';
                                            }
										  if($userInfo['rank'] == 8) {
                                                echo '<div style="position: absolute; z-index:1"><img src="{url}/swfs/c_images/album1584/ADM90.gif"></div>';
                                            }
										  if($userInfo['rank'] == 7) {
                                                echo '<div style="position: absolute; z-index:1"><img src="{url}/swfs/c_images/album1584/ADM90.gif"></div>';
                                            }
										    if($userInfo['rank'] == 6) {
                                                echo '<div style="position: absolute; z-index:1"><img src="{url}/swfs/c_images/album1584/ADM90.gif"></div>';
                                            }
                                            if($userInfo['rank'] == 5) {
                                                echo '<div style="position: absolute; z-index:1"><img src="{url}/swfs/c_images/album1584/ADM90.gif"></div>';
                                            }
                                            if($userInfo['rank'] == 3) {
                                                echo '<div style="position: absolute; z-index:1"><img src="{url}/swfs/c_images/album1584/ADM90.gif"></div>';
                                            }
                                            if($userInfo['rank'] == 4) {
                                                echo '<div style="position: absolute; z-index:1"><img src="{url}/swfs/c_images/album1584/ADM90.gif"></div>';
                                            }
                                            if($userInfo['rank'] == 2) {
                                                echo '<div style="position: absolute; z-index:1"><img src="{url}/swfs/c_images/album1584/ADM90.gif"></div>';
                                            }
											if($userInfo['rank_vip'] == 3) {
                                                echo '<div style="position: absolute; z-index:1"><img src="{url}/swfs/c_images/album1584/PVIP.gif"></div>';
                                            }
                                        

                                     echo ' 

                                    </td>
                                        <td width="427px" valign="top">
                                        <i><a href="/home/'.$userInfo['username'].'">'.$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:100%; height:1px; background-color:#ccc; margin-top:-17px;"></div>


                                </td>
                              </tr>';
                              }
                              echo '</table>';
                            }
                            ?></div> </div> </div> </div>
                        <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
						</div>
                    </div>
            <script type="text/javascript">
                document.observe('dom:loaded', function() {
                    CurrentRoomEvents.init();
                });
            </script>
        </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]-->
        
 
            <?php include('includes/footer.php'); ?>
			<?php include('includes/checktheban.php'); ?>

    
    </body>
</html>
This is all I get, any idea why?

 
Last edited:
Joined
Jan 23, 2011
Messages
446
Reaction score
99
You either don't have the correct columns in the table, or you have unnecessary columns.
You can fix that by changing the query that is selecting the news to SELECT * FROM cms_news
or just find the query and add the correct columns.
The query can be found in class.forms.php
 
Upvote 0
Back
Top