X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=index.php;h=eb52e4e1d2826467f74476a3ade6cd9c10d0ebf2;hp=c2d93d2e8c4fc28a0e8700f27b1370a0d8846fdc;hb=2264646817a59a6e3aefa835c492938dde4f25ee;hpb=c44e3cfcc5f363f001b101a82b1c06bfa7b05e69;ds=sidebyside
diff --git a/index.php b/index.php
index c2d93d2..eb52e4e 100644
--- a/index.php
+++ b/index.php
@@ -1,7 +1,7 @@
You are now logged out!
\n".
+ "(This will take you back to the home-page)";
}
else if(myisset("new"))
{
+ output_status();
if( isset($_SESSION["name"]) )
{
$names = DB_get_all_names();
+ echo "
Game ".DB_format_gameid($gameid)." has been cancled.
Game ".DB_format_gameid($gameid).
+ " has been canceled.
You need to wait longer before you can cancle a game...
\n"; + echo "You need to wait longer before you can cancel a game...
\n"; + } +/* send out a reminder */ +else if(myisset("remind","me")) + { + output_status(); + + $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")) { $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.\n";
- while( $r = mysql_fetch_array($result,MYSQL_NUM))
- {
- echo "game ".DB_format_gameid($r[1])." ";
- if($r[3]==$myid || $r[3]==NULL)
- echo "(it's your turn)\n";
- else
- {
- $name = DB_get_name_by_userid($r[3]);
- 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".
- " (clicking here is final and can't be restored)";
- echo "
";
- }
- echo "
\n";
- while( $r = mysql_fetch_array($result,MYSQL_NUM))
- {
- echo "game ".DB_format_gameid($r[1])." ";
- if($r[3])
- {
- if($r[3]==$myid)
- echo "(it's your turn)\n";
- else
- {
- $name = DB_get_name_by_userid($r[3]);
- 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".
- " (clicking here is final and can't be restored)";
- echo "
";
- }
+ echo "
Session:
\n";
+ echo " p = pre-game phase ";
+ echo "P = game in progess ";
+ echo "F = game finished
";
echo "
Session:\n";
+
$output = array();
- $result = mysql_query("SELECT hash,game_id from Hand".
+ $result = mysql_query("SELECT Hand.hash,Hand.game_id,Game.mod_date,Game.player,Game.status from Hand".
" LEFT JOIN Game ON Game.id=Hand.game_id".
- " WHERE user_id='$myid' AND Game.status='gameover'".
+ " WHERE user_id='$myid'".
" ORDER BY Game.session,Game.create_date" );
- $gamenrold = 0;
- echo "
\n";
+ $gamenrold = -1;
+ echo "
\n"; while( $r = mysql_fetch_array($result,MYSQL_NUM)) { $game = DB_format_gameid($r[1]); $gamenr = (int) $game; if($gamenrold < $gamenr) { + if($gamenrold!=-1) + echo " | |||
$gamenr: | "; + else + echo "$gamenr: | ";
$gamenrold = $gamenr;
- echo " $gamenr: "; } - echo "I "; + if($r[4]=='pre') + { + echo "\n p "; + + } + else if ($r[4]=='gameover') + echo "\n F "; + else + { + echo "\n P "; + } + if($r[4] != 'gameover') + { + echo " | \n "; + if($r[3]) + { + if($r[3]==$myid) + echo "(it's your turn)\n"; + 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 "". + "Cancel?". + " (clicking here is final and can't be restored)"; + + } } - echo "\n"; + echo " |
\n"; echo implode(", ",$names)."\n"; - echo "
\n"; + echo "\n