4

I am developing an eemployee management system in CodeIgniter PHP and JavaScript.

I need to find out if the client's computer is not in sleep and lock mode.

Is it possible in PHP and JavaScript or jQuery.

I am waiting for expertise Opinion and solution.

Thanks

Pattle
  • 5,983
  • 8
  • 33
  • 56
  • Using javascript or JQuery, i would say no. And as PHP is server side language, of course not. Now you should find ways to detect if user is active on page using javascript, nothing more i guess. – A. Wolff Mar 28 '14 at 11:18
  • 2
    as stated here: http://stackoverflow.com/questions/14112708/start-calling-js-function-when-pc-wakeup-from-sleep-mode you can detect a break in execution time – visualex Mar 28 '14 at 11:19
  • @visualex that's quite an interesting approach – A. Wolff Mar 28 '14 at 11:21

3 Answers3

4

I think that you chose the wrong tools. You should develop a desktop application for these purposes. (.NET, Java, etc.)

Server can serve as a communication point, which receives data from the desktop application.

So no, you cannot find out if computer is sleeping from a server with PHP. This can be done IF the computer sends it's state to the server through the desktop application.

Mārtiņš Briedis
  • 17,396
  • 5
  • 54
  • 76
0

Not really and every solution with an open browser window and an interval can be tricked. Best way is a native windows app/os x app.

0

In PHP - no. PHP is server side, you cannot reach any informations about client unless client send it to you.

In JavaScript, I don't think so, and even if (like here), it's on client side and can be tricked.

I suggest you to solve this problem with desktop version of your application, or at least some background proccess, which will monitor this informations.

Community
  • 1
  • 1
Pavel Štěrba
  • 2,822
  • 2
  • 28
  • 50