Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
News comment error.
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="HabboRetroHelper1" data-source="post: 371743" data-attributes="member: 27792"><p>This is my Post Comment PHP CODE</p><p>[CODE]<?php</p><p></p><p></p><p>if(isset($_POST['post_comment']))</p><p> $posted_on = date("M j, Y g:i A");</p><p></p><p>if (empty($_POST['comment']))</p><p>$_POST['comment'] = '';</p><p></p><p>$comment = strip_tags (filter($_POST['comment']));</p><p>if($comment == NULL){</p><p> //define("ERROR", "You have to type in a reply!<br /><br />");</p><p> //$error_message = 'You have to type in a reply!<br /><br />';</p><p> }else{</p><p>if (isLogged)</p><p>{</p><p> mysql_query("INSERT INTO cms_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());</p><p> define('SUCCESS', 'You have successfully posted a comment on this news article!');</p><p></p><p></p><p> define("ERROR", "<br>Thanks for your reply!<br />");</p><p></p><p> //$error_message = 'Thanks for your reply!<br /><br />';</p><p> }</p><p>}</p><p>?></p><p></p><p><div class="habblet-container "></p><p><div class="cbb clearfix notitle "></p><p><div id="article-wrapper"><h2>Place Comment</h2></p><p><div class="article-meta"></div></p><p><div class="article-body"></p><p><?php</p><p>if($userPosts >= 1)</p><p>{</p><p> define('ERROR', 'Sorry, you are only allowed one comment per article.');</p><p>}</p><p>if(defined("SUCCESS")){</p><p>?></p><p><div class="rounded rounded-green" width="20%"></p><p> <?php echo SUCCESS; ?><br /></p><p> </div></p><p> <div>&nbsp;</div></p><p><?php</p><p>}</p><p>if(defined("ERROR")) {</p><p>?></p><p><div class="rounded rounded-red" width="20%"></p><p> <?php echo ERROR; ?><br /></p><p> </div></p><p> <div>&nbsp;</div></p><p><?php</p><p>}</p><p>else</p><p>{</p><p>?></p><p><form action="" method="post"></p><p><textarea name="comment" maxlength="500"></textarea><br /><br /></p><p><input type="submit" name="post_comment" value="Place Comment" /></p><p></form></p><p><?php</p><p>}</p><p>?></p><p></div></p><p></div></p><p></div></p><p></div></p><p></p><p><style type="text/css"></p><p>input[type="text"], input[type="password"] {</p><p>background-color: #F1F1F1;</p><p>border: 1px solid #999999;</p><p>width: 175px;</p><p>padding: 5px;</p><p>font-family: verdana;</p><p>font-size: 10px;</p><p>color: #666666;</p><p>}</p><p>input[type="submit"] {</p><p>background-color: #F1F1F1;</p><p>border: 1px solid #999999;</p><p>padding: 5px;</p><p>font-family: verdana;</p><p>font-size: 10px;</p><p>color: #666666;</p><p>}</p><p>textarea {</p><p>background-color: #F1F1F1;</p><p>border: 1px solid #999999;</p><p>padding: 5px;</p><p>width: 517px;</p><p>height: 70px;</p><p>font-family: verdana;</p><p>font-size: 10px;</p><p>color: #666666;</p><p>}</p><p>select {</p><p>background-color: #F1F1F1;</p><p>border: 1px solid #999999;</p><p>padding: 5px;</p><p>font-family: verdana;</p><p>font-size: 10px;</p><p>color: #666666;</p><p>}</p><p></style></p><p><?php</p><p>$getComments = mysql_query("SELECT * FROM cms_comments WHERE article = '".filter($_GET['id'])."' ORDER by id DESC");</p><p>?></p><p><div class="habblet-container "></p><p><div class="cbb clearfix notitle "></p><p><div id="article-wrapper"><h2>Comments <?php echo mysql_num_rows($getComments); ?></h2></p><p><div class="article-meta"></div></p><p><div class="article-body"></p><p><?php</p><p> if(mysql_num_rows($getComments) == 0) {</p><p> echo "No comments for this article!";</p><p> } else {</p><p> echo '<table width="528px">';</p><p> while($Comments = mysql_fetch_array($getComments)){</p><p> $getUserInfo = mysql_query("SELECT * FROM users WHERE username = '".$Comments['author']."'");</p><p> $userInfo = mysql_fetch_array($getUserInfo);</p><p> echo '</p><p> <tr></p><p> <td width="90px" valign="top"></div></p><p> <div style="</p><p>height: 65px;</p><p>width: 50px;</p><p>float: left;</p><p>overflow: hidden;</p><p>"></p><p> <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></p><p> ';</p><p> if($userInfo['rank'] >= 4) {</p><p> echo '<div style="position: absolute; z-index:1"><img src="{url}/r63/c_images/album1584/ADM.gif"></div>';</p><p> }</p><p> if($userInfo['rank'] == 2) {</p><p> echo '<div style="position: absolute; z-index:1"><img src="{url}/r63/c_images/album1584/VIP.gif"></div>';</p><p> }</p><p> if($userInfo['rank'] == 1) {</p><p> echo '<div style="position: absolute; z-index:1"><img src=""></div>';</p><p> }</p><p> </p><p></p><p> echo '</p><p></p><p> </td></p><p> <td width="427px" valign="top"></p><p> <i><a href="/me">'.$userInfo['username'].' </a></i></p><p> <br /><br />'.$Comments['comment'].'</p><p> </p><p></p><p> </td></p><p> </tr></p><p> <tr></p><p> <td width="80px" valign="top"></p><p> </p><p> </td></p><p> <td width="400px" align="right"></p><p></p><p> </p><p> </p><p></p><p> </p><p></p><p></div></div></div></div></p><p><br></p><p><div style="width:125%; height:1px; background-color:#ccc; margin-top:-17px;"></div></p><p></p><p></p><p> </td></p><p> </tr>';</p><p> }</p><p> echo '</table>';</p><p> }</p><p> ?></div> </div> </div> </div></p><p></div></p><p></div></p><p></div></p><p></div>[/CODE]</p><p>Run this SQL [CODE]</p><p>DROP TABLE IF EXISTS `cms_comments`;</p><p>CREATE TABLE `cms_comments` (</p><p> `id` int(6) NOT NULL AUTO_INCREMENT,</p><p> `story` int(6) DEFAULT NULL,</p><p> `comment` text NOT NULL,</p><p> `date` int(10) DEFAULT NULL,</p><p> `author` varchar(999) NOT NULL,</p><p> `article` int(9) NOT NULL,</p><p> `userid` int(11) NOT NULL,</p><p> `posted_on` varchar(50) NOT NULL,</p><p> PRIMARY KEY (`id`)</p><p>) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8;</p><p>[/CODE]</p><p>You may need to deleted cms_comments..... For other uses if i said anything wrong just correct me <img src="/styles/default/xenforo/smilies/emojione/smile.png" class="smilie" loading="lazy" alt=":)" title="Smile :)" data-shortname=":)" /></p></blockquote><p></p>
[QUOTE="HabboRetroHelper1, post: 371743, member: 27792"] This is my Post Comment PHP CODE [CODE]<?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 cms_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', 'You have successfully posted a comment on this news article!'); define("ERROR", "<br>Thanks for your reply!<br />"); //$error_message = 'Thanks for your reply!<br /><br />'; } } ?> <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 cms_comments WHERE article = '".filter($_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.nl/habbo-imaging/avatarimage?figure='.$userInfo['look'].'&size=b&direction=2&head_direction=3&gesture=sml&size=2"></div> '; if($userInfo['rank'] >= 4) { echo '<div style="position: absolute; z-index:1"><img src="{url}/r63/c_images/album1584/ADM.gif"></div>'; } if($userInfo['rank'] == 2) { echo '<div style="position: absolute; z-index:1"><img src="{url}/r63/c_images/album1584/VIP.gif"></div>'; } if($userInfo['rank'] == 1) { echo '<div style="position: absolute; z-index:1"><img src=""></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>[/CODE] Run this SQL [CODE] DROP TABLE IF EXISTS `cms_comments`; CREATE TABLE `cms_comments` ( `id` int(6) NOT NULL AUTO_INCREMENT, `story` int(6) DEFAULT NULL, `comment` text NOT NULL, `date` int(10) DEFAULT NULL, `author` varchar(999) NOT NULL, `article` int(9) NOT NULL, `userid` int(11) NOT NULL, `posted_on` varchar(50) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8; [/CODE] You may need to deleted cms_comments..... For other uses if i said anything wrong just correct me :) [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
News comment error.
Top