Limit quantity by time

Asked

Viewed 96 times

0

How can I limit a certain feature in PHP to run after a certain time set by me?

Example: I have a button, I click it and it sends 50 users to a field called count on my table, and also Seto a time in a field called timer in which I would like it to be 20 minutes. And after 20 minutes it resets Count to 0 and the timer also returns to 0!

I’ve had experiences with events in Mysql, but I don’t want to use for obvious reasons.

My table is like this:

  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_str` varchar(255) NOT NULL,
  `screen_name` varchar(255) NOT NULL,
  `oauth_token` varchar(255) NOT NULL,
  `oauth_token_secret` varchar(255) NOT NULL,
  `vip` int(11) NOT NULL DEFAULT '0',
  `days` int(11) NOT NULL DEFAULT '0',
  `count` int(11) NOT NULL DEFAULT '0',
  `timer` int(11) NOT NULL DEFAULT '0',

What is the logic? PHP provides some native function for this? I don’t want to use cookies nor sessions for security reasons I want the PHP and the MySQL work in my favor.

  • 1

    Yes, there are 2 viable ways, the first is the use of socket creating a "mini server" that will always be running and in it you arrow the necessary rules to solve your problem (but not every hosting has the prompt enabled for use so let’s go to the second). This is the most used, create a CROM on the server to call a page every X time, on this page will have the rules that you will do to check and treat this data, the server will run this page every X minutes. (Remembering that CROM only works in hosting)

  • I’ve read about the CROM @Guilhermebiancardi, it’s the best way so far

  • If you don’t need the script to run in real time this is the best way to do it and the easiest way to implement it.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.