Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need an If/Else Statement
#1
I need an if/else statement. I would like it to check to see if a countdown clock has reached 0. If it reaches 0 I want to cancel a login form and a registration link. The countdown script is an include on the login.php file. The variable that is called is $difference. This will probably be an include as well.
Do you know how to make games? Do you know 3d Modeling? If so then visit
[Image: logo.png]
Reply
#2
I don't really understand you, but is this what you are looking for!

PHP Code:
if($difference != 0) {
    
//cancel
}else{
   
//do things

Reply
#3
Sent you a PM.

Something like
PHP Code:
if($difference != 0) {
//do nothing. Users can login and register all they want.
}else{
//Login and Activation are not allowed. Prints "Sorry, but the round is over. Please stand by while the admin restarts the game."


Or an easier way to do that if there is one.

Or maybe it will display the login if $difference != 0, else login form and registration link are not displayed, but the above message (or a different one if I edit it) is displayed.
Do you know how to make games? Do you know 3d Modeling? If so then visit
[Image: logo.png]
Reply
#4
As I've said in the PM, you should use the GET method.

But you could also do the same check when calling the login form and the register link.
And simply not show them if $diff... is 0.
But the user could then still login.
Reply
#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
#6
I'm going to have to put this bit on hold. The project that I was working on has been placed on hold while I try to promote a different game. Although, I may look into implementing this into the game I have now.
Do you know how to make games? Do you know 3d Modeling? If so then visit
[Image: logo.png]
Reply


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

Forum Jump:


Users browsing this thread: 1 Guest(s)