summaryrefslogtreecommitdiffstats
path: root/testfav.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2013-08-17 08:24:36 -0700
committerArun Persaud <arun@nubati.net>2013-08-17 08:24:36 -0700
commitef0fd1178c4f9e5bea92dac7d02a12ce0d523547 (patch)
tree5e74f742a029170c8cfb82f151cbe67d2b7c0943 /testfav.php
parent7abff39352cfc8b29ab309e98ecf8b011db98039 (diff)
downloade-DoKo-ef0fd1178c4f9e5bea92dac7d02a12ce0d523547.tar.gz
e-DoKo-ef0fd1178c4f9e5bea92dac7d02a12ce0d523547.tar.bz2
e-DoKo-ef0fd1178c4f9e5bea92dac7d02a12ce0d523547.zip
update favicon if it's your turn.
Added a simple php script that returns via json if it's your turn and then check this every 10s using javascript.
Diffstat (limited to 'testfav.php')
-rw-r--r--testfav.php56
1 files changed, 56 insertions, 0 deletions
diff --git a/testfav.php b/testfav.php
new file mode 100644
index 0000000..7d29897
--- /dev/null
+++ b/testfav.php
@@ -0,0 +1,56 @@
+<?php
+/* Copyright 2013 Arun Persaud <arun@nubati.net>
+ *
+ * This file is part of e-DoKo.
+ *
+ * e-DoKo is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * e-DoKo is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with e-DoKo. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+error_reporting(E_ALL);
+
+session_start();
+
+include_once("config.php"); /* needs to be first in list, since other includes use this */
+include_once("./include/db.php"); /* database only */
+
+/* open the database */
+$DBopen = DB_open();
+if($DBopen<0)
+ exit();
+
+if(isset($_SESSION['id']))
+ {
+ $myid = $_SESSION['id'];
+
+ $result = DB_query_array("SELECT count(player) from Game ".
+ " WHERE player=".DB_quote_smart($myid).
+ " AND ( status='pre' OR status='play' ) ");
+ if($result[0])
+ $ret=array('turn'=>'yes');
+ else
+ $ret=array('turn'=>'no');
+
+ echo json_encode($ret);
+ };
+
+DB_close();
+
+/*
+ *Local Variables:
+ *mode: php
+ *mode: hs-minor
+ *End:
+ */
+?>