Page 1 of 1

PHP and Javascript Timer

Posted: Tue Mar 09, 2010 10:34 am
by Tralalah
Good sirs, I am requesting for help about this project that I am making: a timer. This timer will be lodged into a server computer and users will login with their names and choose from available computer terminals in a room.

I have set up the forms and database in PHP/mySQL for the name and terminal listing, but I have not yet put the timer in. I would like to ask if it's possible to have a timer in JScript, where upon clicking a Login button will start timing a user who wants to login, and have the beginning time (upon clicking Login button) and ending time (Logout button) be saved onto the database I have set in mySQL.

An aid in haste is much appreciated. :)

Re: PHP and Javascript Timer

Posted: Tue Mar 09, 2010 2:02 pm
by VladSun
It's not JavaScript related - you need to record the login time into the DB and then record the logout time when user logs out. It's servers side, not client side.

Re: PHP and Javascript Timer

Posted: Wed Mar 10, 2010 7:14 am
by Tralalah
@VladSun: Thanks. That means that PHP - Java Script - mySQL will work just fine? :)

Re: PHP and Javascript Timer

Posted: Fri Mar 12, 2010 12:07 pm
by Tralalah
Okay. So here's my dilemma now.

I will set up a login button and a logout button. Basically, the login button starts the timer and the logout button stops it. Can I save the time data (total time elapsed) for example: (ASSUMING having set up the necessary functions and etc.)

Code: Select all

<form action="sample.php" method="post" align="left">
<input type="submit" name="time" value="Session ended." onClick="stopCount()">
</form>
 
Is this possible to link to the mySQL database?