![]() |
Limit clicks/day to 10, for each pet?
I want to do this a) to stop Yarolds people buying 100pets and lvling them all to max that day and b) to add a sense of realism (so they dont grow old in a day).
My idea was to add two columns to the "owned_adoptables" table: "date" and "clickstoday" or to that effect.Then I would edit the levelup.php script so that each click would check to see if "$date" is the current date and what "$clickstoday" is. If the date is wrong it will update the date (to the current date) and set "$clickstoday" back to naught. If the date is right and "$clickstoday" is under 11 I will have it run the normal procedure and add 1 to the field. I just wanted to run this by you guys to see if you see any immediate problems? Such as, is the date variable going to be the same for everyone? Or can someone in Australia click the pet, then an American (thus resetting the $date, since it's probably different) and the Australian being able to click it again...? Or otherwise, do you have a better system? It doesn't seam that hard to code. :\ |
RE: Limit clicks/day to 10, for each pet?
The date would go by the server's date, so whatever time zone the server your site is on will determine the date that is used for all users. I don't see why this wouldn't work. :)
|
RE: Limit clicks/day to 10, for each pet?
Code:
if ($clickdate != date('Y-m-d')) { $newdate = date('Y-m-d'); $newctd= $ctd + 1; $addclicks = 1; } $newctd (which stands for "clicks today") is working fine, but for some reason $newdate keeps returning "1". Thanks, if anyone can help me. :) |
RE: Limit clicks/day to 10, for each pet?
You haven't set your date vaiable to begin with.
Sea |
RE: Limit clicks/day to 10, for each pet?
Hmm but it's used earlier to write to the "voters" table? (I mean $date, which doesn't work if I replace all the date('Y-m-d') with it. $date = date('Y-m-d') as it is)
Did you guys want to peer at the whole php file? It's pretty unorganised since I cut out the commentation (trying to cut down on bandwidth :\ ) but it's readable. P.S. I purposely made the comments so they wouldn't affect my script while I asked for help. ;) |
RE: Limit clicks/day to 10, for each pet?
Another idea, why not just use the vote-voters table? It tracks the date and adoptable ID each time someone votes for a pet. Just run a query on that table that selects all records for the current date and the adoptable ID and if the number of records returned is greater than 10 then prevent leveling. :)
|
RE: Limit clicks/day to 10, for each pet?
:o
Lol. Trust me to pick the abstract, complex way right off the bat. I'll definitely do that Brandon, thanks for suggesting it. :D EDIT: It's really hard to see if it's working, but does this look functionable to you guys? Code:
$query = "SELECT * FROM ".$prefix."vote_voters WHERE adoptableid='$id' and date = '$date'"; |
RE: Limit clicks/day to 10, for each pet?
Quote:
You'll be able to tell if it is working too that way. :) |
RE: Limit clicks/day to 10, for each pet?
I thought I needed the query to check the number of rows in the votes table? Sorry Brandon, but could you show me an example..? :S
EDIT: Is this what you meant? Code:
$query = "SELECT * FROM ".$prefix."vote_voters WHERE adoptableid='$id' and date = '$date'"; |
RE: Limit clicks/day to 10, for each pet?
Yeah, something like your last post is what I meant, so you're not running the level up procedure if the pet can't be leveled anyway. :)
|
All times are GMT -5. The time now is 08:12 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.