XeroXer Posted August 1, 2006 Share Posted August 1, 2006 I have a quiz on my site where people can go through a series of question answearing what they think.Now I want to add a timer so in the end they can see how long time it took for them to answear it all.I use just one file for this and use case 1: break; and so on.Now I want to know the best secure way to store the start time and endtime and also print it into a file.Because in the end of the test they can enter their name and a small message and they end up in the highscore. :-)Is there a way to do this so if the time is stored from the start and then I can store another one in the end and show the start and endtime to the people.If you don't undertsand what I mean say so and maybe I can explain better... Quote Link to comment Share on other sites More sharing options...
onlyican Posted August 1, 2006 Share Posted August 1, 2006 Sessions:Good = If the user has cookies turn off they still work;Bad = They expire when the browser is closed, or after a short while (Set in php_ini);Cookies:Good: They have a longer shell life;Bad: If the user has cookies turned off, tough; Quote Link to comment Share on other sites More sharing options...
XeroXer Posted August 1, 2006 Author Share Posted August 1, 2006 Ok. Can I somehow use them both for the best preformance?Or maybe test with cookies toi see if the user has them turned off and then use session?Then also how would I use them to get the current date and time into a cookie or session and how do I read it out of them the best way? Quote Link to comment Share on other sites More sharing options...
onlyican Posted August 1, 2006 Share Posted August 1, 2006 The thing with cookies is when you set a cookie, you need to reload the page to check the valueIf you just want to store a date/time a session will do the job$_SESSION["start_time"] = date("Y-m-d H:i:s");Or what ever format you want Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.