Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need an If/Else Statement
#5
It exists differents manner to compare a date with another, i don't know if you already know it !

you can try something like this :

PHP Code:
function game_is_okay($todays_date){
    
$exp_date "2006-01-16"// You can read it from a file, or create it manually, i don't know...
    
$today strtotime($todays_date);
    
$expiration_date strtotime($exp_date);
    if (
$expiration_date $today) {
      return 
1;
    } 
    else { 
      return 
0;
    }
}

$date date("Y-m-d"); 
if (
game_is_okay($date)){
 
// Do the game !
}
else {
 
// echo "error ! please wait ...etc";

Reply


Messages In This Thread
Need an If/Else Statement - by Grizzly - 12-05-2009, 07:03 PM
RE: Need an If/Else Statement - by Gaijin - 12-05-2009, 07:18 PM
RE: Need an If/Else Statement - by Grizzly - 12-05-2009, 07:29 PM
RE: Need an If/Else Statement - by Gaijin - 12-05-2009, 07:48 PM
RE: Need an If/Else Statement - by Spl3en - 12-06-2009, 07:01 AM
RE: Need an If/Else Statement - by Grizzly - 12-10-2009, 06:43 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  PHP: If Statement BreShiE 19 7,270 04-16-2019, 09:38 AM
Last Post: joeywilliams

Forum Jump:


Users browsing this thread: 1 Guest(s)