Is there a way to set up timed donations? I have a garrysmod donation system but Im not quite sure how to make it so that donations are timed. If someone can help then that would be great.
Why would you need donations to be timed?! Doesn't sound very logical.
I think he means subscription based payments.
[QUOTE=kragmars102;39559735]I think he means subscription based payments.[/QUOTE]
Exactly. I have it working without subscriptions.
Store the date when the donation came in (or when he redeemed it), then compare that date with current date. If the difference is greater than something then set expired to 1 in the database or whatever you're storing with. (NEVER remove transaction history!).
Then lets say they re-doante, would I just reset the date, and set expired to 0? Or if they donate for more than 1 month
[QUOTE=LedZepp;39564029]Then lets say they re-doante, would I just reset the date, and set expired to 0?[/QUOTE]
Well essentially, yes. But another way to do that would to simply store the donated_date as a timestamp. To calculate if its expired, you'd do this:
if ($row['donated_date'] < time() - (604800*4*12)) { expired } else { not expired }
If donated_date is older than a year, is that the if statement is working out. When someone donates you just update their donated_date with a new timestamp.
[editline]12th February 2013[/editline]
So by doing that you're saving yourself an extra field, plus all the functionality and checks you'd need to toggle the expired value.
Hm I suppose that's a way. Would it be easier to set the date for whenever the donated( let's say a month from now) and put 3/12/13 then when it becomes that date then expired = 0
Sorry, you need to Log In to post a reply to this thread.