X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=index.php;h=8acb8715b28289a76a7daf1b048db88c7b85026e;hb=05a61952fc743ea388c10eff29e50adabf4593aa;hp=6d43ddb828f56e3485292d3089bfa4b2619a91fa;hpb=60a2eca84c04fa112e9c80b0c285136517ba9d34;p=e-DoKo.git
diff --git a/index.php b/index.php
index 6d43ddb..8acb871 100644
--- a/index.php
+++ b/index.php
@@ -1,37 +1,54 @@
You are now logged out!
\n".
+ "(This will take you back to the home-page)";
+ }
+else if(myisset("new"))
{
- $names = DB_get_all_names();
- output_form_for_new_game($names);
+ if( isset($_SESSION["name"]) )
+ {
+ $names = DB_get_all_names();
+ echo "
Game $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")) { - /* handle request from one specific player, - * the hash is set on a per game base - */ - $me = $_REQUEST["me"]; - + /* test for valid ID */ $myid = DB_get_userid_by_hash($me); if(!$myid) @@ -207,34 +303,50 @@ else if(myisset("me")) echo "Can't find you in the database, please check the url.these are the games you are playing in:
\n";
- $result = mysql_query("SELECT Hand.hash,Hand.game_id,Game.mod_date from Hand".
- " LEFT JOIN Game On Hand.game_id=Game.id".
- " WHERE Hand.user_id='$uid' AND Game.status<>'gameover'" );
- while( $r = mysql_fetch_array($result,MYSQL_NUM))
- {
- echo "game #".$r[1]." ";
- 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 "
and these are your games that are already done:
Game: \n";
- $result = mysql_query("SELECT hash,game_id from Hand WHERE user_id='$uid' AND status='gameover'" );
- while( $r = mysql_fetch_array($result,MYSQL_NUM))
- echo "#".$r[1]." , ";
- echo "
registered players:
\n";
- foreach ($names as $name)
- echo "$name, \n";
- echo "
Want to start a new game? Visit this page.
"; + $email = $_REQUEST["email"]; + $password = $_REQUEST["password"]; } else { - echo "sorry email and password don't matchSession:
\n";
+ echo " p = pre-game phase ";
+ echo "P = game in progess ";
+ echo "F = game finished
";
+ 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; + } + 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 implode(", ",$names)."\n"; + echo "
\n