Queef
Some people...
- Jul 27, 2012
- 645
- 289
Every so often when a user posts a comment on any news article it adds random characters on the end, mostly just "rn" but sometimes some other weird stuff. Anyone know whats going on here?
And the next thing is, when a user inputs a comment it says thanks for your reply, like below, but when you reload the page the comment duplicates. Same as above, anyone know whats going on here?
Heres the comments part of my news.php
And the next thing is, when a user inputs a comment it says thanks for your reply, like below, but when you reload the page the comment duplicates. Same as above, anyone know whats going on here?
Heres the comments part of my news.php
PHP:
<?php
if(isset($_POST['post_comment']))
$posted_on = date("M j, Y g:i A");
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 />");
//$error_message = 'You have to type in a reply!<br /><br />';
}else{
if (isLogged)
{
$queef_query = "INSERT INTO site_news_comments (article, userid, comment, posted_on, author) VALUES ('".htmlentities($_GET['id'])."', '".$_SESSION['user']['id']."', '".filter($comment)."', '".$posted_on."', '" . $_SESSION['user']['username']. "');";
mysql_query($queef_query) 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 id="container">
<div id="page-content-left-large">
<div id="page-content-text">
<center>
<div id="contentHeader" class="green">
<p>Post a Comment</p>
</div>
</center>
<div id="box-content" style="
border-top: 1px dashed #999;
margin: 7px 10px 7px 10px;">
<?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: 543px;
height: 70px;
font-family: verdana;
font-size: 10px;
color: #666666;
margin: 7px 0 0 0;
}
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 id="page-content-left-large">
<div id="page-content-text">
<center>
<div id="contentHeader" class="green">
<p>Comments (<?php echo mysql_num_rows($getComments); ?>)</p>
</div>
</center>
<div id="box-content">
<?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.fr/habbo-imaging/avatarimage?figure='.$userInfo['look'].'&size=b&direction=2&head_direction=3&gesture=sml&size=2"></div>
';
if($userInfo['rank'] >= 5) {
echo '<div style="position: absolute; z-index:1"><img src="{url}/r63/c_images/album1584/OWNR.gif"></div>';
}
if($userInfo['rank'] == 3) {
echo '<div style="position: absolute; z-index:1"><img src="{url}/r63/c_images/album1584/NWB.gif"></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="http://hablitehotel.com/r63/c_images/album1584/VIP.gif"></div>';
}
echo '
</td>
<td width="427px" valign="top">
<i><strong>'.$userInfo['username'].'</strong></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>