Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-26-2012, 12:41 AM   PM User | #1
manupathak
New to the CF scene

 
Join Date: Oct 2012
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
manupathak is an unknown quantity at this point
Unhappy automatically logout after given time and submit selected to database simutaneously

i need help..i am beginner in php and trying to build a online exam system site.
i have used cookie for login, now i wish that my content page(after login) having a start button and after clicking on that my "test.php" gets loaded and countdown stat..and after a given time page gets automatically logged out and answers stored in database simultaneously.
anyone please help me..

Thanks in advance..
manupathak is offline   Reply With Quote
Old 10-26-2012, 05:01 AM   PM User | #2
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,387
Thanks: 18
Thanked 350 Times in 349 Posts
sunfighter is on a distinguished road
I suggest you look into the Ajax Push Engine. http://www.ape-project.org/ Because you have to control things, but not in the browser so HTML or javascript is out of the picture. Doing the timing and closing the page needs to be done server side. You are also going to need good ajax understanding to do this.

Maybe someone knows a simpler way to do this or you don't think the test takers know how to look at the html of their page or knows someone that does.
sunfighter is offline   Reply With Quote
Users who have thanked sunfighter for this post:
manupathak (10-26-2012)
Old 10-26-2012, 05:26 AM   PM User | #3
manupathak
New to the CF scene

 
Join Date: Oct 2012
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
manupathak is an unknown quantity at this point
thanks sunfighter..ok is that possible to store the time using time() in a variable when user click on "start test" and then just using "if condition" when difference of current time and that variable equal to my duration then go to logged out??
manupathak is offline   Reply With Quote
Old 10-26-2012, 03:32 PM   PM User | #4
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,387
Thanks: 18
Thanked 350 Times in 349 Posts
sunfighter is on a distinguished road
Yes, your method will work, but you will need a trigger to run the second part, getting the new time.
I know little about APE, never used it, but the server side language is javascript. Js has two functions setInterval() - will execute another function, over and over again, at specified time intervals AND setTimeout() - executes a function, once.
The variables sent to the about functions are the time of the interval in millisecs and the name of the function to execute.
In other words, once started, say by the start button, no further input [trigger] is needed.
sunfighter is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:20 AM.


Advertisement
Log in to turn off these ads.