Jump to content

ricvail

New Members
  • Posts

    1
  • Joined

  • Last visited

ricvail's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Imagine a turn-based 1 vs 1 browsergame. I need to be able to detect when a user goes offline (exits the browser, shuts down the PC, disables JS), and perform some actions. Since I already have to costantly poll the server with AJAX to get the data, I thought that maybe I could add a line to my code that records in the DB the current time, and check if the other user's last connection time is < than (current time - 3 seconds), in wich case I consider him offline and declare the first user winner (add exp and money etc.) But, what if one user exits, and after 1 second, the other does the same? Then he does not have time to detect the other user's logout. Nobody gets the Exp, but, most important, the entry in the "active fights" database does not get deleted. Any ideas? EDIT: Cron-jobs are a no-go, since Altervista, my PHP hosting website, requires me to pay for them and I can execute them every 60 minutes at best, while I would need them to run max every 5 seconds or so
  2. Hi everyone, I'm a 17 years old amatorial programmer from Italy. I owe most of my PHP (and general programming) skills to the Head First series by O'Reilly. So far, I have worked with Java (my "mother toungue"), ActionScript and Flash, Javascript, and of course PHP. My only finished projects are two games, Snake (JS) and Tetris (Flash). I am currently working on a browsergame, which involves intensive PHP (and JS) coding, that's why I'm here.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.