Send gold coins to users during the activity

Source: Internet
Author: User
How does php determine to give a user a gold coin once a day ?? How does php determine to give a user a gold coin once a day ??

Reply content:

How does php determine to give a user a gold coin once a day ??

Session (user identification) + database (whether the current time falls within the time range of the day determined by the last gold coin sending time => whether the current time exceeds the upper limit of the time range of the day determined by the last gold coin sending time, use timestamp for addition, subtraction, and so on)

If it is not very strict, use cookies. If it is necessary to strictly create a database field value for the day

On the server side, record the time stamp for sending gold coins. If the time stamp is the same day, it indicates that the gold coins have been sent.

$ Today = new DateTime ('today'); if (is_null ($ user-> givedtime )) {// never sent at a time} else if (strtotime ($ user-> givedtime) >=$ today-> getTimestamp ()) {// sent on the same day} else {// never sent on the same day}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.