jsolomon Posted April 21, 2007 Share Posted April 21, 2007 Hello, I have a website where users submit anonymous messages, which are automatically posted publically on a rolling list. I am trying to implement a community flagging/voting system so users can eliminate spam messages themselves. I would like a flag icon to pop up next to each submission, and for entries to be deleted from the database (or at least not displayed) after 3 user flags. Here's what I have so far: First, as I loop through all of the past entries and echo them onto the page, I also echo a form for each entry: while(($row2=mysql_fetch_array($result2, MYSQL_ASSOC)) and ($row=mysql_fetch_array($result, MYSQL_ASSOC))) { echo "<p>", htmlspecialchars($row['secret']), "<hr></p>"; //This is the entry echo "<div ID='flag'><form name='spam' method='post'><input type='submit' name='", $row2['time'], "' value='Flag' /></form></div>"; // This is the form for each entry } Every form has the same name (spam), and each form has a single input whose name is the time value of when the entry was first submitted. I just used this to create a unique form input for each entry. This part works fine. Then when someone clicks on the submit for a given entry, it is supposed to add 1 to the "spam" column of the given row. Here is my code: if(isset($_POST[$row2['time']])) { $query3 = "SELECT spam FROM secret WHERE time = {$row2['time']}"; $result3 = mysql_query($query3); $new = $result3++; $update = "Update secret SET spam=$new"; mysql_query($update); } This isn't working properly. When I click one of the submit buttons, the spam column does not increment for any of the rows. I think this is wrong: (isset($_POST[$row2['time']])). I'm really new to PHP and I know my coding is pretty sloppy, but I would appreciate any help. Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/47967-spam-flagging/ Share on other sites More sharing options...
dustinnoe Posted April 21, 2007 Share Posted April 21, 2007 http://akismet.com/ I use this to allow anonymous comments and eliminate spammers. It has worked great so far. Could save you a lot of coding and headaches. You know it's doing something when you have 5000 hits to a web form and only 8-10 actually post. Link to comment https://forums.phpfreaks.com/topic/47967-spam-flagging/#findComment-234379 Share on other sites More sharing options...
jsolomon Posted April 21, 2007 Author Share Posted April 21, 2007 I suppose "spam" was the wrong word to use. I'm not really dealing with a forum...and its not really comments...and so far I'm not getting "spam." I suppose I'll deal with that when I get there. My issue is that each submission is supposed to be a secret (see http://www.jssolomon.com/secretstest.php). Most are, some aren't. Some are attacks, some are jibberish. Those are the ones I want to be able to filter, and I want users to do it instead of me . Sooo.........Look over my code for me? Link to comment https://forums.phpfreaks.com/topic/47967-spam-flagging/#findComment-234407 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.