News comments (HELP)

calmabro

Member
Jun 21, 2014
46
2
Hi,

I have a RevCMS for my upcoming hotel, and i only want users to make 1 comment per news, so that my database not will be spammed.
Right now users can just spam the news, can you anyone help me fixing it?

I got a script for fixing it, but i keep getting a blank screen?
 

Zodiak

recovering crack addict
Nov 18, 2011
450
411
Assuming you're using MySQL.
Code:
<?php

$checkc = mysql_query("SELECT * FROM `cms_news_comments` WHERE `news_id` = '".mysql_real_escape_string($_GET['id'])."' AND `user_id` = '".$_SESSION['user']['id']."'");

if(mysql_num_rows($checkc) >= 1)
{
die("You can only comment once.");
}

?>
 

calmabro

Member
Jun 21, 2014
46
2
Assuming you're using MySQL.
Code:
<?php

$checkc = mysql_query("SELECT * FROM `cms_news_comments` WHERE `news_id` = '".mysql_real_escape_string($_GET['id'])."' AND `user_id` = '".$_SESSION['user']['id']."'");

if(mysql_num_rows($checkc) >= 1)
{
die("You can only comment once.");
}

?>
I've tried that, doesn't work.. Idk if its because i do it wrong?
 

MrGreen

Member
Oct 3, 2013
66
4
We need a RevCMS fix, the issue is that the mysql is being if defined as error or success but in order for it to work we need to get the error line to work cus even with it showing the error, they can still reply and even refresh to post again. Basically it has to have a better mysql connection to grab things and stuff since it reading comments won't work since comments are words aka varchar. We need it to grab from the ID of that comment e.g. 6 5
 

Zodiak

recovering crack addict
Nov 18, 2011
450
411
We need a RevCMS fix, the issue is that the mysql is being if defined as error or success but in order for it to work we need to get the error line to work cus even with it showing the error, they can still reply and even refresh to post again. Basically it has to have a better mysql connection to grab things and stuff since it reading comments won't work since comments are words aka varchar. We need it to grab from the ID of that comment e.g. 6 5

All that needs doing is on the post make a query select the news id and user id from news comments, if there's one or more rows then stop the query from posting a new comment. Pretty simple.
 

Users who are viewing this thread

Top