Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm making a Twitter App and twitter makes it so any application won't run more than 15 times an hour.
I execute a python script when a user presses a button that gets the top 5 trends on twitter.
I am using PHP and MongoDB NoSQL to store my data.
When I searched for an answer I came across --> this but they are using a SQL DB.
My Question,
How can I tell the user has executed the script 15 times within an hour?
Each time the user runs the app, add their clicks to an object including its time.
When they run your script, pull these objects out, look through their dates, and delete everything with a timestamp more than an hour old and count the rest.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
i have a website where you click on a tomato and get points based on how many times you've klicked on it. The problem is that it's all running on php and AJAX requests. Every 10 seconds an request is sent on how many clicks the user has now, and the server updates. So in theory a user could just send requests of them having 30000 clicks and it would register. A friend of mine said that i should use node and register every click individualy with a socket, but everything so far is running on php. Is there a way to open a node server and make it talk with php?
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to run a php function on my server in a certain time without make the script sleep.
I need this in order to update my database in specific time.
For example a chat room that lasts for 5 minutes.
The chat room have a flag in the database for open status.
I want to change the flag in the database to close after 5 minutes.
public function callOnDelay($time, $data)
{
//SOME CODE EXECUTED AFTER SOME TIME IS OVER//
}
There are different ways of doing this depending on your OS.
On Linux you can look for Cron Jobs (http://www.thesitewizard.com/general/set-cron-job.shtml).
On Windows you can look for Task Scheduler (http://technet.microsoft.com/en-us/library/cc766428.aspx).
Also another, not so reliable, method of doing this is adding a conditional/if in your main script (index.php ?) or a "before function" in your controller (if you are using some kind of framework that supports it) and checking for the last status and doing something with it.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
We have a database table with created datetime and status flag. We would like to update the status flag to the next status if the created date time has elapsed by 30 minutes without any user intervention. How can we achieve this in php.
Create a php file that does this status change in the database and program to execute it every 30 minutes with cron (Linux) or Task Scheduler (Windows).
You have to think carefully about how you design and use your database. Sometimes things are made overly complicated when they don't need to. For instance, in this case you could use a 'datetime' in your table indicating the start time. Any PHP script can now check whether or not the start time started 30 minutes ago, only when this information is actually needed. No need for a flag, cron jobs, etc.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I've my application built on Laravel 4.1. In my application I want to get number of authentic users currently watching a particular page, like if the application has page1, page2. I want to know the number of users currently on page 1 vs. on page 2.
How can I implement this feature in laravel?
This is a very unique problem and there is not a straight solution to this anyway.
$users = count(glob(session_save_path() . '/*'));
Note that this just counts session files. It will undoubtedly contain stale/dead sessions that haven't been garbage collected yet.
A better way according to me would be if you create time stamps for each of your page and have every page issue and ajax call to the server every few seconds to update these timestamps.
So if a user is on a particular page, the page will keep sending requests to the server every few seconds and the time stamps will be updated.
You can then calculate the number of users on a particular page by querying the time stamps for the last minute or something.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
i want to know how much time a visitor stays on my website..??? can it be done with any online services ??..Any help would be appreciated..
Use Google analytics http://www.google.com.au/analytics/
A session can only change every time you call set or reset it.
But if you wanted to, you could use jQuery ajax, to run a script every X seconds or mins. Then in the file that you are ajax'ing in. Change your session data.
You will find analytics make a new request every time the user does something. Like moves the mouse, clicks on something, etc. So you would have to set up some js to do that as well.