update favicon if it's your turn.
[e-DoKo.git] / testfav.php
1 <?php
2 /* Copyright 2013 Arun Persaud <arun@nubati.net>
3  *
4  *   This file is part of e-DoKo.
5  *
6  *   e-DoKo is free software: you can redistribute it and/or modify
7  *   it under the terms of the GNU General Public License as published by
8  *   the Free Software Foundation, either version 3 of the License, or
9  *   (at your option) any later version.
10  *
11  *   e-DoKo is distributed in the hope that it will be useful,
12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *   GNU General Public License for more details.
15  *
16  *   You should have received a copy of the GNU General Public License
17  *   along with e-DoKo.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20
21 error_reporting(E_ALL);
22
23 session_start();
24
25 include_once("config.php");                /* needs to be first in list, since other includes use this */
26 include_once("./include/db.php");          /* database only */
27
28 /* open the database */
29 $DBopen = DB_open();
30 if($DBopen<0)
31   exit();
32
33 if(isset($_SESSION['id']))
34   {
35     $myid = $_SESSION['id'];
36
37     $result = DB_query_array("SELECT count(player) from Game ".
38                              " WHERE player=".DB_quote_smart($myid).
39                              " AND ( status='pre' OR  status='play' ) ");
40     if($result[0])
41       $ret=array('turn'=>'yes');
42     else
43       $ret=array('turn'=>'no');
44
45     echo json_encode($ret);
46   };
47
48 DB_close();
49
50 /*
51  *Local Variables:
52  *mode: php
53  *mode: hs-minor
54  *End:
55  */
56 ?>