summaryrefslogtreecommitdiffstats
path: root/db.php
diff options
context:
space:
mode:
authorArun <arun@etaner.(none)>2007-10-08 16:01:26 +0200
committerArun <arun@etaner.(none)>2007-10-08 16:01:26 +0200
commitc0e030bb5068085ef52cc8bd0c91f025fb78045e (patch)
treef9a10378ddfb762a750fc107f8afdae132a5f239 /db.php
parent092ae96405d4da11bc392dc92e7e103ce48b6045 (diff)
downloade-DoKo-c0e030bb5068085ef52cc8bd0c91f025fb78045e.tar.gz
e-DoKo-c0e030bb5068085ef52cc8bd0c91f025fb78045e.tar.bz2
e-DoKo-c0e030bb5068085ef52cc8bd0c91f025fb78045e.zip
NEW FEATURE: send out reminder email
if a player hasn't moved for a week a reminder email can be send out. only one per day is possible, tracking in the db
Diffstat (limited to 'db.php')
-rw-r--r--db.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/db.php b/db.php
index a6b9c3b..646f004 100644
--- a/db.php
+++ b/db.php
@@ -916,4 +916,28 @@ function DB_format_gameid($gameid)
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