Solved

Timimg in php

Posted on 2003-11-19
5
268 Views
Last Modified: 2008-03-06
I want to write the script that allow user to playing the simple puzzle game but the amount of time. For example the game start at 10:30 and support to be finished 2 hours later i.e 12:30 after that time the score will not be calculate. Could anyone tell me how to implement such a thing. Thank you
P/s i already wrote the game i just need to do the calculating score system.
0
Comment
Question by:jany2222
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
spearman123 earned 25 total points
ID: 9784133
0
 
LVL 1

Expert Comment

by:spearman123
ID: 9784151
look through there.. figure out how to find time and :

startTime = ....;
endTime = startTime + 120;
do {
/* game code */
nowTime = ....;
} while (nowTime < endTime);
0
 
LVL 1

Assisted Solution

by:show_source
show_source earned 25 total points
ID: 9786461
Or use time() and sessions
<?php
session_start();

do{
$_SESSION["startSec"] = time();
/* game code */
}
if($_SESSION["startSec"] < (60*60*2) {
ok
}

Instead af sessions, you could set a cookie

And with some Javascript you could show the  time there's left to play
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now