Anti Cheating System

Started on the old forum in July 2009 · view the original in the archive · old links redirect here

4 replies · 589 views · started 17 years ago · 1 min read

3 participants
Dj-marc Developer · 164 posts #1

How can I add codes to a toplist script to prevent users from cheating by refreshing the page and getting hits for their site to be on top? something like on surfwap here is the code on the index.php page

if($sid>0)
{
	$sites=mysql_fetch_array(mysql_query("SELECT * FROM sites where id='".$sid."' and banned='0';"));
	$hin=$sites[6]+1;
	mysql_query("UPDATE sites SET hin='".$hin."' WHERE id='".$sid."'");	
}
Jose Junior · 10 posts #2

What are you really trying to achieve? hehe... Please elaborate man

And BTW: What does the above do? Remove that code from your script, maybe everything will be just fine:)

Jose Junior · 10 posts #5

Dj-marc wrote: bro if u aint helping dont reply ok?

Sorry dawg... Let me try to help then..

I suppose you have a table like this below

CREATE TABLE `hits_table` (
    `id` int(11) AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `referer` int(11) NOT NULL,
    `user_ip` varchar(100) NOT NULL,
    `user_agent` varchar(250) NOT NULL,
    `datetime` datetime NOT NULL
)

referer = The website owner's ID supplying the hit user_ip = The user who is directed's ip user_agent = The user who is directed's browser datetime = The datetime in which he/she directed to your site and a hit IS saved

WATCH CLOSELY now (i am about to pull a rabbit out of the hat ):

Before you save a click(hit) you MUST query to the database to check whether the user browsing has been saved as a hit. That can be achieved with an SQL stement like the one below: SELECT * FROM hits_table WHERE referer='$referer' AND user_ip='$user_ip' AND datetime > '$datetime_in_30_minutes_back_or_less';

$datetime_in_30_minutes_back_or_less can be found by using the [datetime using the current datetime MINUS (-) 30 minutes or whatever time captcha you want to use]

dont allow a user to execute a DETELE statement (unless your not serious)

Try the suggestion and ask if your still stuck. 8)

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close