PDA

View Full Version : Limit amount of clicks per day


SilverDragonTears
11-24-2011, 08:28 PM
I need to put a limit on the amount of times an adopt's level up link can be clicked. This is because some of my members are using Yarolds and leveling up their pets in a ridiculous amount of time ie: 5 minutes after catching an egg, their adopt becomes an adult. I don't want to increase the amount of clicks it takes to level up because most of my users do not use Yarolds.

Can anyone help me out with this? :)

Slix
11-24-2011, 11:47 PM
You could do what I did and simply block incoming traffic from Yarold's.

SilverDragonTears
11-24-2011, 11:58 PM
Oh please tell me how!! i'm not sure I'll go that route... but if I have to...

Csar
11-25-2011, 07:58 AM
Oh please tell me how!! i'm not sure I'll go that route... but if I have to...

Well, you wouldn't need to "block" the users but simply not count if they're eing referred, If I'm right you could use something like this:


<?php
$blacklist = Aray(/*Terms that identify banned sites for example:*/ 'yarolds', 'google');
$click_allowed = true;
foreach ($blacklist as $disallowedpage)
if (strpos($_SERVER['HTTP_REFERRER'], $disallowedpage) !== false) $click_allowed=false;
?>


Later you can just check against your prohibited pages, something like this

<?php
if ($click_allowed) echo 'This is a normal user';
else echo 'You should not use any click services';
?>


If you would like to limit the number of clicks everyday you would need to add an extra table to your MySQL.

Hope it helped

C#

SilverDragonTears
11-25-2011, 10:29 AM
I'm not sure exactly where to put these?

Nemesis
11-25-2011, 01:51 PM
lol wow so i wonder if people would be willing to pay for clicks. $0.10 cpm lol that i can actually provide. Though this doesn't help SDT's situation lol.

Hall of Famer
11-27-2011, 10:38 PM
Well, you wouldn't need to "block" the users but simply not count if they're eing referred, If I'm right you could use something like this:


<?php
$blacklist = Aray(/*Terms that identify banned sites for example:*/ 'yarolds', 'google');
$click_allowed = true;
foreach ($blacklist as $disallowedpage)
if (strpos($_SERVER['HTTP_REFERRER'], $disallowedpage) !== false) $click_allowed=false;
?>
Later you can just check against your prohibited pages, something like this

<?php
if ($click_allowed) echo 'This is a normal user';
else echo 'You should not use any click services';
?>
If you would like to limit the number of clicks everyday you would need to add an extra table to your MySQL.

Hope it helped

C#

This looks cool, but seems that you made a typo here:


$blacklist = Aray(/*Terms that identify banned sites for example:*/ 'yarolds', 'google');
It should be this if I am correct:


$blacklist = Array(/*Terms that identify banned sites for example:*/ 'yarolds', 'google');
But anyway I do not recommend the approach to block incoming traffic, since even without Yarold they can still find other ways to level up quickly. A better approach is to write a code that count how many clicks this very adoptable has received during the day and generates an error message if the number is above 10.

SilverDragonTears
11-28-2011, 03:22 PM
How can I do this HoF?

Hall of Famer
11-28-2011, 11:14 PM
Well this can be achieved by adding these lines somewhere in levelup.php:


$result = runquery("SELECT * FROM {$prefix}vote_voters WHERE adoptableid='{$id}' and date = '{$date}'");
$num = mysql_num_rows($result);
if($num >= 10){
$article_content .= "An error has occurred, this adoptable has been leveled up 10 times already today. "
}
else{
// codes to execute if the adoptable can be leveled up
}

SilverDragonTears
11-28-2011, 11:17 PM
HoF... have I mentioned how awesome you are? Will this still allow them to get money for clicking on it? I'd want them to be able to.

Hall of Famer
11-28-2011, 11:42 PM
umm I see, this can be done easily but is a bit difficult to explain. Send me your levelup.php file and I will try to get back to you by Thursday or Friday.

SilverDragonTears
11-28-2011, 11:51 PM
Ok :) Also, I thought with the item shop you could trade items with other users?

Hall of Famer
11-29-2011, 12:07 AM
Well the current itemshop is not integrated with trade system, even though this will happen with Mys v1.3.0 official release.

SilverDragonTears
11-29-2011, 10:49 AM
Allowing 10 clicks sort of enraged a few of my members :/ So we won't be using this right now and are trying to come up with a new solution. Hooray for being an admin O.o

Could you look at my post in the sort thing? I need help with that quite badly. When you have time of course!

Hall of Famer
11-29-2011, 11:39 AM
I see, you've got some very interesting members on your site I'd say. XD

And, well, I dont think I can help you with the sort adoptables Mod. My programming skills cover C, Ruby, PHP and Mysql, but AJAX is too much for me at least at this very moment.

SilverDragonTears
11-29-2011, 11:50 AM
Oh man this is driving me insane. I can't understand why it won't work :(



EDIT.... Huh. I think I fixed it. I have no idea how... but I think I did.