Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 02-04-2010, 01:24 AM
Quillink Quillink is offline
Member
 
Join Date: Dec 2008
Posts: 93
Credits: 11,289
Quillink
Default 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. :\
Reply With Quote
  #2  
Old 02-04-2010, 04:12 PM
BMR777 BMR777 is offline
Member
 
Join Date: Jan 2011
Posts: 1,122
Gender: Male
Credits: 10,712
BMR777 is on a distinguished road
Default 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. :)
Reply With Quote
  #3  
Old 02-05-2010, 02:24 AM
Quillink Quillink is offline
Member
 
Join Date: Dec 2008
Posts: 93
Credits: 11,289
Quillink
Default 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; } 
if	 	 ($clickdate = date('Y-m-d') && $ctd > 9 )	{ $newdate = $clickdate; $newctd = $ctd + 0; }
else if 	($clickdate = date('Y-m-d') && $ctd < 10)	{ $newdate = $clickdate; $newctd = $ctd + 1; $addclicks = 1; }


$query = "UPDATE ".$prefix."owned_adoptables SET ctd='".$newctd."' WHERE aid='".$id."'";
mysql_query($query);
$query = "UPDATE ".$prefix."owned_adoptables SET clickdate='".$newdate."' WHERE aid='".$id."'";
mysql_query($query);

$newclicks = $totalclicks + $addclicks;
This is the code I've flung together based on what I thought would work. Does anyone who actually know php see what's wrong with it..?
$newctd (which stands for "clicks today") is working fine, but for some reason $newdate keeps returning "1". Thanks, if anyone can help me. :)
Reply With Quote
  #4  
Old 02-05-2010, 08:36 AM
Seapyramid Seapyramid is offline
Premium Member
 
Join Date: Feb 2009
Posts: 373
Gender: Female
Credits: 15,579
Seapyramid
Default RE: Limit clicks/day to 10, for each pet?

You haven't set your date vaiable to begin with.

Sea
Reply With Quote
  #5  
Old 02-05-2010, 01:13 PM
Quillink Quillink is offline
Member
 
Join Date: Dec 2008
Posts: 93
Credits: 11,289
Quillink
Default 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. ;)
Reply With Quote
  #6  
Old 02-05-2010, 07:14 PM
BMR777 BMR777 is offline
Member
 
Join Date: Jan 2011
Posts: 1,122
Gender: Male
Credits: 10,712
BMR777 is on a distinguished road
Default 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. :)
Reply With Quote
  #7  
Old 02-05-2010, 09:44 PM
Quillink Quillink is offline
Member
 
Join Date: Dec 2008
Posts: 93
Credits: 11,289
Quillink
Default 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'";
$result = mysql_query($query);
$ctd = mysql_numrows($result);

if ($ctd <= 9) { $addclicks = 1; }
else 		  { $addclicks = 0; }

$newclicks = $totalclicks + $addclicks;
Reply With Quote
  #8  
Old 02-06-2010, 04:10 PM
BMR777 BMR777 is offline
Member
 
Join Date: Jan 2011
Posts: 1,122
Gender: Male
Credits: 10,712
BMR777 is on a distinguished road
Default RE: Limit clicks/day to 10, for each pet?

Quote:
Originally Posted by Quillink
: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'";
$result = mysql_query($query);
$ctd = mysql_numrows($result);

if ($ctd <= 9) { $addclicks = 1; }
else 		  { $addclicks = 0; }

$newclicks = $totalclicks + $addclicks;
It looks like it should work, but why not just check if you should add the click or not and if not just don't do the database queries and instead show the user an error message. On a large site there's no need to run unnecessary queries. :)

You'll be able to tell if it is working too that way. :)
Reply With Quote
  #9  
Old 02-07-2010, 07:37 PM
Quillink Quillink is offline
Member
 
Join Date: Dec 2008
Posts: 93
Credits: 11,289
Quillink
Default 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'";
$result = mysql_query($query);
$ctd = mysql_numrows($result);
if ($ctd > 99)		 { $article_title = "Error";
						 $article_content = "<font color='#cc1111'>This Pet has recieved the maximum of 100 clicks per day</font>"; }
else   if ($ctd <= 99) {

// Add to clicks, levelup and text return

}
This way it doesn't bother with the other queries if the click limit's already been reached. :)
Reply With Quote
  #10  
Old 02-08-2010, 02:35 PM
BMR777 BMR777 is offline
Member
 
Join Date: Jan 2011
Posts: 1,122
Gender: Male
Credits: 10,712
BMR777 is on a distinguished road
Default 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. :)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Freeze ONLY the evolution, not the clicks dulop Questions and Supports 2 09-28-2012 10:29 AM
Limit amount of clicks per day SilverDragonTears Questions and Supports 15 11-29-2011 11:50 AM
Limit clicks/day to 10 sensacion Questions and Supports 1 07-02-2011 05:15 AM
Days Instead of Clicks alonaria Suggestions and Feature Requests 7 06-25-2011 05:27 AM
No Clicks at all? rosepose Questions and Supports 11 03-07-2009 08:42 AM


All times are GMT -5. The time now is 09:14 AM.

Currently Active Users: 9673 (0 members and 9673 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636