So I have some session checking to see if it's not stolen using PHP. I set a request count as a value in the session array and send a cookie with same value to the client. If the values don't match then someone has interfered.
The problem is that sometimes the values don't match and I doubt someone stole the session and used it. Is it possible that Firefox is slow in storing the cookies? I'm asking this because I have a broken mouse which click-spams when I click. When I use the touchpad I never disconnect from the app.
Browsers usually have multiple, simultaneous connections open to the same website and download resources in parallel. Trying to count requests is certain to create race conditions.
If you want to reduce the chances of session hijacking, use SSL for your data transfer.