X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=index.php;h=74b4fc129824e849c79db4e92e262fa58b902144;hp=c56560782e144977b467a9fdc3006abc61cf8ff3;hb=a41eca191e497f8821031e99920e0f053a090b1d;hpb=092ae96405d4da11bc392dc92e7e103ce48b6045 diff --git a/index.php b/index.php index c565607..74b4fc1 100644 --- a/index.php +++ b/index.php @@ -85,6 +85,23 @@ else if(myisset("new")) $session = DB_get_session_by_gameid($followup); $ruleset = DB_get_ruleset_by_gameid($followup); /* just copy ruleset from old game, this way no manipulation is possible */ + + /* check if there is a game in pre or play mode, in that case do nothing */ + if( DB_is_session_active($session) > 0 ) + { + echo "
"; + output_footer(); + DB_close(); + exit(); + } + else if ( DB_is_session_active($session) < 0 ) + { + echo " "; + output_footer(); + DB_close(); + exit(); + } + if($session) mysql_query("INSERT INTO Game VALUES (NULL, NULL, '$randomNRstring', 'normal', NULL,NULL,'1',NULL,'pre',". "'$ruleset','$session' ,NULL)"); @@ -197,7 +214,8 @@ else if(myisset("cancle","me")) if(time()-strtotime($r[0]) > 60*60*24*30) /* = 1 month */ { $message = "Hello, \n\n". - "Game ".DB_format_gameid($gameid)." has been cancled since nothing happend for a while and $myname requested it.\n"; + "Game ".DB_format_gameid($gameid). + " has been cancled since nothing happend for a while and $myname requested it.\n"; $userids = DB_get_all_userid_by_gameid($gameid); foreach($userids as $user) @@ -209,11 +227,65 @@ else if(myisset("cancle","me")) /* delete everything from the dB */ DB_cancel_game($me); - echo "Game ".DB_format_gameid($gameid)." has been cancled.
Game ".DB_format_gameid($gameid).
+ " has been cancled.
You need to wait longer before you can cancle a game...
\n"; } +/* send out a reminder */ +else if(myisset("remind","me")) + { + $me = $_REQUEST["me"]; + + /* test for valid ID */ + $myid = DB_get_userid_by_hash($me); + if(!$myid) + { + echo "Can't find you in the database, please check the url.An email has already been sent out.
\n"; + } + else + { + DB_set_reminder($r[1],$gameid); + mymail($To,$EmailName."Reminder: game ".DB_format_gameid($gameid)." it's your turn",$message); + + echo "Game ".DB_format_gameid($gameid).
+ ": an email has been sent out.
You need to wait longer before you can send out a reminder...
\n"; + } /* handle request from one specific player for one game, * (the hash is set on a per game base) */ else if(myisset("me")) @@ -285,69 +357,6 @@ else if(myisset("me")) /* put everyting in a form */ echo "\n"; output_footer(); DB_close(); @@ -1706,14 +1796,15 @@ else if( myisset("email","password") || isset($_SESSION["name"]) ) output_status($_SESSION["name"]); /* display links to settings */ - output_user_settings($email,$password); + output_user_settings(); - echo "Session:
\n";
echo " p = pre-game phase ";
@@ -1761,12 +1852,17 @@ else if( myisset("email","password") || isset($_SESSION["name"]) )
else
{
$name = DB_get_name_by_userid($r[3]);
+ $gameid = $r[1];
+ if(DB_get_reminder($r[3],$gameid)==0)
+ if(time()-strtotime($r[2]) > 60*60*24*7)
+ echo "".
+ "Send a reminder.";
echo "(it's $name's turn)\n";
};
}
if(time()-strtotime($r[2]) > 60*60*24*30)
- echo " The game has been running for over a month.".
- " Do you want to cancel it? yes".
+ echo "".
+ "Cancel?".
" (clicking here is final and can't be restored)";
}
@@ -1775,7 +1871,7 @@ else if( myisset("email","password") || isset($_SESSION["name"]) )
$names = DB_get_all_names();
echo "
\n"; echo implode(", ",$names)."\n"; - echo "
\n"; + echo "\n