New answers tagged ajax
Do not do this Sleeps are unpredictable. You never know when your test environment happens to be downloading Windows Updates when the virusscanner runs and the timeout happens to be a second too short. Your tests will become brittle and useless because you'll have to run every failed scenario multiple times to make sure it was an actual failure. And sleeps ...
I would avoid doing this in PHP. You are going to hit a number of fundamental problems: the limit on concurrent requests on your clients browsers won't let them have 21 simultaneous requests open the connection limit in your web sever won't handle the incoming requests very well if you have more than a handful of concurrent users multithreading at the ...
If you are not familiar with threading, you could also use php to start a number of individual copies of the same program on the backend such as a linux box. Each of these would execute and could write their contents to uniquely names files in a directory. You could then collect the files as they were completed counting until you got all 21 files or you ...
The technique your boss has told you to use is one of the common ways of preventing cross site request forgery. I think you're probably getting confused by the multiple meanings of "hash" which in this case probably refers to a secure hash (eg SHA256) rather than a hash that you might use for a hash table.
Your best bet for this if your intended clients have sufficiently modern web browsers is Web Sockets. There are plenty of libraries out there that you can use and can look into. The one I have used most recently for PHP projects is Pusher, but searching for 'PHP websockets' turns up plenty of libraries and code samples you could use.
Top 50 recent answers are included