47148bfd62b1eec749653801039c4c4737159a35
[atutor.git] / mods / disclaimer / common.inc.php
1 <?php\r
2 /***********************************************************************/\r
3 /* ATutor                                                                                                                          */\r
4 /***********************************************************************/\r
5 /* Copyright (c) 2002-2010                                             */\r
6 /* Inclusive Design Institute                                          */\r
7 /* http://atutor.ca                                                                                                        */\r
8 /*                                                                                                                                         */\r
9 /* This program is free software. You can redistribute it and/or           */\r
10 /* modify it under the terms of the GNU General Public License             */\r
11 /* as published by the Free Software Foundation.                                           */\r
12 /***********************************************************************/\r
13 \r
14 // check whether user needs to or have already agreed with legal disclaimer\r
15 function agreed_legal_disclaimer() {\r
16         global $_config, $db;\r
17         \r
18         // users are not required to agree with legal disclaimer\r
19         if (!isset($_config['enable_terms_and_conditions']) || $_config['enable_terms_and_conditions'] <> 1) {\r
20                 return true;\r
21         } else {\r
22                 // check whether the user has agreed with legal disclaimer\r
23                 $sql = "SELECT * FROM ".TABLE_PREFIX."DS_agreed_logins\r
24                          WHERE login = '".$_SESSION['login']."' ";\r
25                 $result = mysql_query($sql, $db);\r
26                 if (mysql_num_rows($result) > 0) {\r
27                         return true;\r
28                 } else {\r
29                         return false;\r
30                 }\r
31         }\r
32 }\r
33 \r
34 function save_agreed_login($login) {\r
35         global $db;\r
36 \r
37         if ($login == '') return;\r
38         \r
39         $sql = "INSERT INTO ".TABLE_PREFIX."DS_agreed_logins (login)\r
40                 VALUES ('".$login."')";\r
41         $result = mysql_query($sql, $db);\r
42 }\r
43 ?>