comments should be working again. not tested though
[e-DoKo.git] / db.php
diff --git a/db.php b/db.php
index 10c5de2ae3e62deecd928bb32cea868767fd1a9c..7f47c66e3068936fe0ad3b04c94f34994478cd0e 100644 (file)
--- a/db.php
+++ b/db.php
@@ -301,7 +301,9 @@ function DB_play_card($trickid,$handcardid,$sequence)
 {
   mysql_query("INSERT INTO Play VALUES(NULL,NULL,NULL,".DB_quote_smart($trickid).
              ",".DB_quote_smart($handcardid).",".DB_quote_smart($sequence).")");
-  return;
+      
+  $playid = mysql_insert_id();
+  return $playid;
 }
 
 function DB_get_all_names_by_gameid($id)
@@ -349,4 +351,37 @@ function DB_get_all_names()
 
   return $names;
 }
+
+function DB_update_user_timestamp($userid)
+{
+  mysql_query("UPDATE User SET last_login = CURRENT_TIMESTAMP WHERE id=".DB_quote_smart($userid));
+  return;
+}
+
+function DB_get_user_timestamp($userid)
+{
+  $result = mysql_query("SELECT last_login FROM User WHERE id=".DB_quote_smart($userid));
+  $r      = mysql_fetch_array($result,MYSQL_NUM);
+  
+  if($r)
+    return $r[0];
+  else
+    return NULL;
+}
+function DB_get_user_timezone($userid)
+{
+  $result = mysql_query("SELECT timezone FROM User WHERE id=".DB_quote_smart($userid));
+  $r      = mysql_fetch_array($result,MYSQL_NUM);
+  
+  if($r)
+    return $r[0];
+  else
+    return 0;
+}
+
+function DB_insert_comment($comment,$playid,$userid)
+{
+  mysql_query("INSERT INTO Comment VALUES (NULL,NULL,NULL,$userid,$playid, ".DB_quote_smart($comment).")");
+  return;
+}
 ?>
\ No newline at end of file