LAYOUT: moved more text during the setup into the middle
[e-DoKo.git] / db.php
diff --git a/db.php b/db.php
index 41e4479840c474155a6bc9b71e9a87af03f647bb..646f0043a27b66c7facf5cc57d59ce9e2b896fa2 100644 (file)
--- a/db.php
+++ b/db.php
@@ -902,4 +902,42 @@ function DB_get_partner_hash_by_hash($hash)
   return NULL;
 }
 
+function DB_format_gameid($gameid)
+{
+  $session = DB_get_session_by_gameid($gameid);
+  
+  /* get number of game */
+  $result = mysql_query("SELECT COUNT(*),create_date FROM Game".
+                       " WHERE session='$session' ".
+                       " AND TIMEDIFF(create_date, (SELECT create_date FROM Game WHERE id='$gameid'))<=0 ".
+                       " GROUP by session");
+  $r = mysql_fetch_array($result,MYSQL_NUM);
+  
+  return $session.".".$r[0];
+}
+
+function DB_get_reminder($user,$gameid)
+{
+  $queryresult = mysql_query("SELECT COUNT(*) FROM Reminder ".
+                            "  WHERE user_id=$user ".
+                            "  AND game_id=$gameid ".
+                            "  AND DATE_SUB(CURDATE(),INTERVAL 1 DAY) <= create_date".
+                            "  GROUP BY user_id " );
+  
+  $r = mysql_fetch_array($queryresult,MYSQL_NUM);
+  if($r)
+    return $r[0];
+  else
+    return 0;
+}
+
+function DB_set_reminder($user,$gameid)
+{
+  mysql_query("INSERT INTO Reminder ".
+             "  VALUES(NULL, ".DB_quote_smart($user).", ".DB_quote_smart($gameid).
+              ", NULL) ");
+  return 0;
+}
+
+
 ?>
\ No newline at end of file