global.inc.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. <?php
  2. /**
  3. ==============================================================================
  4. * It is recommended that ALL dokeos scripts include this important file.
  5. * This script manages
  6. * - http get, post, post_files, session, server-vars extraction into global namespace;
  7. * (which doesn't occur anymore when servertype config setting is set to test,
  8. * and which will disappear completely in Dokeos 1.6.1)
  9. * - include of /conf/configuration.php;
  10. * - include of several libraries: main_api, database, display, text, security;
  11. * - selecting the main database;
  12. * - include of language files.
  13. *
  14. * @package dokeos.include
  15. * @todo isn't configuration.php renamed to configuration.inc.php yet?
  16. * @todo use the $_configuration array for all the needed variables
  17. * @todo remove the code that displays the button that links to the install page
  18. * but use a redirect immediately. By doing so the $already_installed variable can be removed.
  19. * @todo make it possible to enable / disable the tracking through the Dokeos config page.
  20. *
  21. ==============================================================================
  22. */
  23. // PHP version check
  24. if ( !function_exists('version_compare') || version_compare( phpversion(), '5', '<' ) )
  25. {
  26. $error_message_php_version = <<<EOM
  27. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  28. <html>
  29. <head>
  30. <title>Wrong PHP version!</title>
  31. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  32. <style type="text/css" media="screen, projection">
  33. /*<![CDATA[*/
  34. @import "main/css/public_admin/default.css";
  35. /*]]>*/
  36. </style>
  37. </head>
  38. <body>
  39. <div id="header">
  40. <div id="header1"><a href="http://www.dokeos.com" target="_blank">Dokeos Homepage</a></div>
  41. <div class="clear"></div>
  42. <div id="header2">&nbsp;</div>
  43. <div id="header3">&nbsp;</div>
  44. </div>
  45. <div style="text-align: center;"><br /><br />
  46. The version of scripting language on your server is wrong. Your server has to support PHP 5.x.x .<br />
  47. <a href="documentation/installation_guide.html" target="_blank">Read the installation guide.</a><br /><br />
  48. </div>
  49. <div id="footer">
  50. <div class="copyright">Platform <a href="http://www.dokeos.com" target="_blank"> Dokeos </a> &copy; 2009 </div>
  51. &nbsp;
  52. </div>
  53. </body>
  54. </html>
  55. EOM;
  56. header('Content-Type: text/html; charset=UTF-8');
  57. die($error_message_php_version);
  58. }
  59. if (!function_exists('mb_strlen'))
  60. {
  61. $error_message_mbstring = <<<EOM
  62. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  63. <html>
  64. <head>
  65. <title>PHP extension "mbstring" has not been installed!</title>
  66. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  67. <style type="text/css" media="screen, projection">
  68. /*<![CDATA[*/
  69. @import "main/css/public_admin/default.css";
  70. /*]]>*/
  71. </style>
  72. </head>
  73. <body>
  74. <div id="header">
  75. <div id="header1"><a href="http://www.dokeos.com" target="_blank">Dokeos Homepage</a></div>
  76. <div class="clear"></div>
  77. <div id="header2">&nbsp;</div>
  78. <div id="header3">&nbsp;</div>
  79. </div>
  80. <div style="text-align: center;"><br /><br />
  81. The Dokeos system needs PHP extension <strong>mbstring</strong> to be installed.<br />
  82. See <a href="http://php.net/manual/en/mbstring.installation.php" target="_blank">http://php.net/manual/en/book.mbstring.php</a> for more information<br /><br />
  83. </div>
  84. <div id="footer">
  85. <div class="copyright">Platform <a href="http://www.dokeos.com" target="_blank"> Dokeos </a> &copy; 2009 </div>
  86. &nbsp;
  87. </div>
  88. </body>
  89. </html>
  90. EOM;
  91. header('Content-Type: text/html; charset=UTF-8');
  92. die($error_message_mbstring);
  93. }
  94. // Determine the directory path where this current file lies
  95. // This path will be useful to include the other intialisation files
  96. $includePath = dirname(__FILE__);
  97. // @todo isn't this file renamed to configuration.inc.php yet?
  98. // include the main Dokeos platform configuration file
  99. $main_configuration_file_path = $includePath . "/conf/configuration.php";
  100. $already_installed = false;
  101. if(file_exists($main_configuration_file_path))
  102. {
  103. require_once($main_configuration_file_path);
  104. $already_installed = true;
  105. }
  106. else
  107. {
  108. $_configuration = array();
  109. }
  110. // include the main Dokeos platform library file
  111. require_once($includePath.'/lib/main_api.lib.php');
  112. //fix bug in IIS that doesn't fill the $_SERVER['REQUEST_URI']
  113. api_request_uri();
  114. // Start session
  115. api_session_start($already_installed);
  116. $error_message_not_installed = <<<EOM
  117. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  118. <html>
  119. <head>
  120. <title>Dokeos has been not installed!</title>
  121. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  122. <style type="text/css" media="screen, projection">
  123. /*<![CDATA[*/
  124. @import "main/css/public_admin/default.css";
  125. /*]]>*/
  126. </style>
  127. </head>
  128. <body>
  129. <div id="header">
  130. <div id="header1"><a href="http://www.dokeos.com" target="_blank">Dokeos Homepage</a></div>
  131. <div class="clear"></div>
  132. <div id="header2">&nbsp;</div>
  133. <div id="header3">&nbsp;</div>
  134. </div>
  135. <div style="text-align: center;"><br /><br />
  136. <form action="main/install/index.php" method="get"><button class="save" type="submit" value="&nbsp;&nbsp; Click to INSTALL DOKEOS &nbsp;&nbsp;" >Click to INSTALL DOKEOS</button></form><br />
  137. or <a href="documentation/installation_guide.html" target="_blank">read the installation guide</a><br /><br />
  138. </div>
  139. <div id="footer">
  140. <div class="copyright">Platform <a href="http://www.dokeos.com" target="_blank"> Dokeos </a> &copy; 2009 </div>
  141. &nbsp;
  142. </div>
  143. </body>
  144. </html>
  145. EOM;
  146. $error_message_db_problem = <<<EOM
  147. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  148. <html>
  149. <head>
  150. <title>Dokeos database unavailable!</title>
  151. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  152. <style type="text/css" media="screen, projection">
  153. /*<![CDATA[*/
  154. @import "main/css/public_admin/default.css";
  155. /*]]>*/
  156. </style>
  157. </head>
  158. <body>
  159. <div id="header">
  160. <div id="header1"><a href="http://www.dokeos.com" target="_blank">Dokeos Homepage</a></div>
  161. <div class="clear"></div>
  162. <div id="header2">&nbsp;</div>
  163. <div id="header3">&nbsp;</div>
  164. </div>
  165. EOM;
  166. $error_message_db_problem .= '
  167. <div style="text-align: center; font-size: large; margin-bottom: 2em;"><br /><br />
  168. This portal is currently experiencing database issues. Please report this to the portal administrator. Thank you for your help.</a>
  169. </div>
  170. <div id="footer">
  171. <div class="copyright">Platform <a href="http://www.dokeos.com" target="_blank"> Dokeos </a> &copy; 2009 </div>
  172. &nbsp;
  173. </div>
  174. </body>
  175. </html>';
  176. if (!$already_installed)
  177. {
  178. header('Content-Type: text/html; charset=UTF-8');
  179. //require('installedVersion.inc.php');
  180. die($error_message_not_installed);
  181. }
  182. //Assigning a variable to avoid several useless calls to the database setting.
  183. // Do not over-user. This is only for this script's local use.
  184. $lib_path = api_get_path(LIBRARY_PATH);
  185. // Add the path to the pear packages to the include path
  186. //ini_set('include_path',ini_get('include_path').PATH_SEPARATOR.$lib_path.'pear');
  187. ini_set('include_path', api_create_include_path_setting());
  188. // This is for compatibility with MAC computers.
  189. ini_set('auto_detect_line_endings', '1');
  190. // Include the libraries that are necessary everywhere
  191. require_once($lib_path.'database.lib.php');
  192. require_once($lib_path.'display.lib.php');
  193. require_once($lib_path.'text.lib.php');
  194. require_once($lib_path.'security.lib.php');
  195. // @todo: this shouldn't be done here. It should be stored correctly during installation
  196. if(empty($_configuration['statistics_database']) && $already_installed)
  197. {
  198. $_configuration['statistics_database'] = $_configuration['main_database'];
  199. }
  200. // connect to the server database and select the main dokeos database
  201. $dokeos_database_connection = @mysql_connect($_configuration['db_host'], $_configuration['db_user'], $_configuration['db_password']) or die ($error_message_db_problem);
  202. if (! $_configuration['db_host'])
  203. {
  204. die($error_message_db_problem);
  205. }
  206. unset($error_message_db_problem);
  207. unset($error_message_not_installed);
  208. // The Dokeos system has not been designed to use special SQL modes that were introduced since MySQL 5
  209. api_sql_query("set session sql_mode='';", __FILE__, __LINE__);
  210. $selectResult = mysql_select_db($_configuration['main_database'],$dokeos_database_connection) or die ('<center>WARNING ! SYSTEM UNABLE TO SELECT THE MAIN DOKEOS DATABASE</center>');
  211. /*
  212. --------------------------------------------
  213. Initialization of the default encodings
  214. --------------------------------------------
  215. */
  216. // The platform's character set must be retrieved at this early moment.
  217. $sql = "SELECT selected_value FROM settings_current WHERE variable = 'platform_charset';";
  218. $result = api_sql_query($sql, __FILE__, __LINE__);
  219. while ($row = @mysql_fetch_array($result)) {
  220. $charset = $row[0];
  221. }
  222. if (empty($charset)) {
  223. $charset = "ISO-8859-15";
  224. }
  225. // Preserving the value of the global variable $charset.
  226. $charset_initial_value = $charset;
  227. // Initialization of the default encoding that will be used by the string routines.
  228. api_set_default_encoding($charset);
  229. /*
  230. --------------------------------------------
  231. RETRIEVING ALL THE DOKEOS CONFIG SETTINGS
  232. --------------------------------------------
  233. */
  234. if(!empty($_configuration['multiple_access_urls']))
  235. {
  236. $_configuration['access_url'] = 1;
  237. $access_urls = api_get_access_urls();
  238. $protocol = ((!empty($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS'])!='OFF')?'https':'http').'://';
  239. $request_url1 = $protocol.$_SERVER['SERVER_NAME'].'/';
  240. $request_url2 = $protocol.$_SERVER['HTTP_HOST'].'/';
  241. foreach($access_urls as $details)
  242. {
  243. if($request_url1 == $details['url'] or $request_url2 == $details['url'])
  244. {
  245. $_configuration['access_url'] = $details['id'];
  246. }
  247. }
  248. }
  249. else
  250. {
  251. $_configuration['access_url'] = 1;
  252. }
  253. //$sql="SELECT * FROM settings_current";
  254. //$result=mysql_query($sql) or die(mysql_error());
  255. // access_url == 1 is the default dokeos location
  256. if ($_configuration['access_url']!=1)
  257. {
  258. $url_info = api_get_access_url($_configuration['access_url']);
  259. if ($url_info['active']==1)
  260. {
  261. $settings_by_access = api_get_settings(null,'list',$_configuration['access_url'],1);
  262. foreach($settings_by_access as $row)
  263. {
  264. if (empty($row['variable']))
  265. $row['variable']=0;
  266. if (empty($row['subkey']))
  267. $row['subkey']=0;
  268. if (empty($row['category']))
  269. $row['category']=0;
  270. $settings_by_access_list[ $row['variable'] ] [ $row['subkey'] ] [ $row['category'] ] = $row;
  271. }
  272. }
  273. }
  274. //echo '<pre>';print_r($result_other_site);
  275. $result = api_get_settings(null,'list',1);
  276. //while ($row=mysql_fetch_array($result))
  277. foreach($result as $row)
  278. {
  279. if ($_configuration['access_url']!=1)
  280. {
  281. if ($url_info['active']==1)
  282. {
  283. if (empty($row['variable']))
  284. $var=0;
  285. else
  286. $var=$row['variable'];
  287. if (empty($row['subkey']))
  288. $subkey=0;
  289. else
  290. $subkey=$row['subkey'];
  291. if (empty($row['category']))
  292. $category=0;
  293. else
  294. $category=$row['category'];
  295. }
  296. if ($row['access_url_changeable']==1 && $url_info['active']==1)
  297. {
  298. if ($settings_by_access_list[ $var ] [ $subkey ] [$category ]['selected_value'] !='')
  299. {
  300. if ($row['subkey']==NULL)
  301. {
  302. $_setting[$row['variable']]= $settings_by_access_list[ $var ] [ $subkey ] [$category ]['selected_value'];
  303. }
  304. else
  305. {
  306. $_setting[$row['variable']][$row['subkey']]=$settings_by_access_list[ $var ] [ $subkey ] [$category ]['selected_value'];
  307. }
  308. }
  309. else
  310. {
  311. if ($row['subkey']==NULL)
  312. {
  313. $_setting[$row['variable']]=$row['selected_value'];
  314. }
  315. else
  316. {
  317. $_setting[$row['variable']][$row['subkey']]=$row['selected_value'];
  318. }
  319. }
  320. }
  321. else
  322. {
  323. if ($row['subkey']==NULL)
  324. {
  325. $_setting[$row['variable']]=$row['selected_value'];
  326. }
  327. else
  328. {
  329. $_setting[$row['variable']][$row['subkey']]=$row['selected_value'];
  330. }
  331. }
  332. }
  333. else
  334. {
  335. if ($row['subkey']==NULL)
  336. {
  337. $_setting[$row['variable']]=$row['selected_value'];
  338. }
  339. else
  340. {
  341. $_setting[$row['variable']][$row['subkey']]=$row['selected_value'];
  342. }
  343. }
  344. }
  345. //echo '<pre>';print_r($_setting);echo '</pre>';
  346. // we have to store the settings for the plugins differently because it expects an array
  347. //$sql="SELECT * FROM settings_current WHERE category='plugins'";
  348. //$result=mysql_query($sql) or die(mysql_error());
  349. $result = api_get_settings('Plugins','list',$_configuration['access_url']);
  350. $_plugins=array();
  351. //while ($row=mysql_fetch_array($result))
  352. foreach($result as $row)
  353. {
  354. $key= $row['variable'];
  355. if (is_string($_setting[$key]))
  356. {
  357. $_setting[$key]=array();
  358. }
  359. $_setting[$key][]=$row['selected_value'];
  360. $_plugins[$key][]=$row['selected_value'];
  361. }
  362. //load array Kses for Htmlpurifier
  363. require_once $includePath."/lib/formvalidator/Rule/allowed_tags.inc.php";
  364. //load htmpurifier
  365. require_once $includePath."/lib/htmlpurifier/library/HTMLPurifier.auto.php";
  366. // include the local (contextual) parameters of this course or section
  367. require($includePath."/local.inc.php");
  368. // ===== "who is logged in?" module section =====
  369. require_once($includePath."/lib/online.inc.php");
  370. // check and modify the date of user in the track.e.online table
  371. if (!$x=strpos($_SERVER['PHP_SELF'],'whoisonline.php'))
  372. {
  373. LoginCheck(isset($_user['user_id']) ? $_user['user_id'] : '',$_configuration['statistics_database']);
  374. }
  375. // ===== end "who is logged in?" module section =====
  376. if(api_get_setting('server_type') == 'test')
  377. {
  378. /*
  379. --------------------------------------------
  380. Server type is test
  381. - high error reporting level
  382. - only do addslashes on $_GET and $_POST
  383. --------------------------------------------
  384. */
  385. error_reporting(E_ALL & ~E_NOTICE);
  386. //error_reporting(E_ALL);
  387. //Addslashes to all $_GET variables
  388. foreach($_GET as $key=>$val)
  389. {
  390. if(!ini_get('magic_quotes_gpc'))
  391. {
  392. if(is_string($val))
  393. {
  394. $_GET[$key]=addslashes($val);
  395. }
  396. }
  397. }
  398. //Addslashes to all $_POST variables
  399. foreach($_POST as $key=>$val)
  400. {
  401. if(!ini_get('magic_quotes_gpc'))
  402. {
  403. if(is_string($val))
  404. {
  405. $_POST[$key]=addslashes($val);
  406. }
  407. }
  408. }
  409. }
  410. else
  411. {
  412. /*
  413. --------------------------------------------
  414. Server type is not test
  415. - normal error reporting level
  416. - full fake register globals block
  417. --------------------------------------------
  418. */
  419. error_reporting(E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR);
  420. if(!isset($HTTP_GET_VARS)) { $HTTP_GET_VARS=$_GET; }
  421. if(!isset($HTTP_POST_VARS)) { $HTTP_POST_VARS=$_POST; }
  422. if(!isset($HTTP_POST_FILES)) { $HTTP_POST_FILES=$_FILES; }
  423. if(!isset($HTTP_SESSION_VARS)) { $HTTP_SESSION_VARS=$_SESSION; }
  424. if(!isset($HTTP_SERVER_VARS)) { $HTTP_SERVER_VARS=$_SERVER; }
  425. // Register SESSION variables into $GLOBALS
  426. if(sizeof($HTTP_SESSION_VARS))
  427. {
  428. if(!is_array($_SESSION))
  429. {
  430. $_SESSION=array();
  431. }
  432. foreach($HTTP_SESSION_VARS as $key=>$val)
  433. {
  434. $_SESSION[$key]=$HTTP_SESSION_VARS[$key];
  435. $GLOBALS[$key]=$HTTP_SESSION_VARS[$key];
  436. }
  437. }
  438. // Register SERVER variables into $GLOBALS
  439. if(sizeof($HTTP_SERVER_VARS))
  440. {
  441. $_SERVER=array();
  442. foreach($HTTP_SERVER_VARS as $key=>$val)
  443. {
  444. $_SERVER[$key]=$HTTP_SERVER_VARS[$key];
  445. if(!isset($_SESSION[$key]) && $key != 'includePath' && $key != 'rootSys' && $key!= 'clarolineRepositorySys' && $key!= 'lang_path' && $key!= 'extAuthSource' && $key!= 'thisAuthSource' && $key!= 'main_configuration_file_path' && $key!= 'phpDigIncCn' && $key!= 'drs')
  446. {
  447. $GLOBALS[$key]=$HTTP_SERVER_VARS[$key];
  448. }
  449. }
  450. }
  451. }
  452. /*
  453. -----------------------------------------------------------
  454. LOAD LANGUAGE FILES SECTION
  455. -----------------------------------------------------------
  456. */
  457. // if we use the javascript version (without go button) we receive a get
  458. // if we use the non-javascript version (with the go button) we receive a post
  459. $user_language = '';
  460. if(!empty($_GET['language']))
  461. {
  462. $user_language = $_GET["language"];
  463. }
  464. if (!empty($_POST["language_list"]))
  465. {
  466. $user_language = str_replace("index.php?language=","",$_POST["language_list"]);
  467. }
  468. // Checking if we have a valid language. If not we set it to the platform language.
  469. $valid_languages=api_get_languages();
  470. if (!in_array($user_language,$valid_languages['folder']))
  471. {
  472. $user_language=api_get_setting('platformLanguage');
  473. }
  474. if (in_array($user_language,$valid_languages['folder']) and (isset($_GET['language']) OR isset($_POST['language_list'])))
  475. {
  476. $user_selected_language = $user_language; // $_GET["language"];
  477. $_SESSION["user_language_choice"] = $user_selected_language;
  478. $platformLanguage = $user_selected_language;
  479. }else{
  480. $platformLanguage = api_get_setting('platformLanguage');
  481. }
  482. if (isset($_SESSION["user_language_choice"]))
  483. {
  484. $language_interface = $_SESSION["user_language_choice"];
  485. }
  486. else
  487. {
  488. $language_interface = api_get_setting('platformLanguage');
  489. }
  490. if (isset($_user['language']))
  491. {
  492. $language_interface = $_user['language'];
  493. }
  494. if ($_course['language'])
  495. {
  496. $language_interface = $_course['language'];
  497. }
  498. // Sometimes the variable $language_interface is changed
  499. // temporarily for achieving translation in different language.
  500. // We need to save the genuine value of this variable and
  501. // to use it within the function get_lang(...).
  502. $language_interface_initial_value = $language_interface;
  503. // Initialization the default ICU locale id based in the current interface language.
  504. api_set_default_locale(api_get_locale_from_language($language_interface));
  505. /*
  506. * Include all necessary language files
  507. * - trad4all
  508. * - notification
  509. * - custom tool language files
  510. */
  511. $language_files = array();
  512. $language_files[] = 'trad4all';
  513. $language_files[] = 'notification';
  514. $language_files[] = 'accessibility';
  515. if( isset($language_file) )
  516. {
  517. if( !is_array($language_file))
  518. {
  519. $language_files[] = $language_file;
  520. }
  521. else
  522. {
  523. $language_files = array_merge($language_files,$language_file);
  524. }
  525. }
  526. // Include all files (first english and then current interface language)
  527. $langpath = api_get_path(SYS_CODE_PATH).'lang/';
  528. if (is_array($language_files)) {
  529. foreach($language_files as $index => $language_file) {
  530. include($langpath.'english/'.$language_file.'.inc.php');
  531. $langfile = $langpath.$language_interface.'/'.$language_file.'.inc.php';
  532. if (file_exists($langfile)) {
  533. include($langfile);
  534. }
  535. }
  536. }
  537. // The global variable $charset has been defined in a language file too (trad4all.inc.php), this is legacy situation.
  538. // So, we have to reassign this variable again in order to keep its value right.
  539. $charset = $charset_initial_value;
  540. //Update of the logout_date field in the table track_e_login (needed for the calculation of the total connection time)
  541. if($_configuration['tracking_enabled'] && !isset($_SESSION['login_as']) && isset($_user))
  542. { // if $_SESSION['login_as'] is set, then the user is an admin logged as the user
  543. $tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);
  544. $sql_last_connection="SELECT login_id, login_date FROM $tbl_track_login WHERE login_user_id='".$_user["user_id"]."' ORDER BY login_date DESC LIMIT 0,1";
  545. $q_last_connection=api_sql_query($sql_last_connection);
  546. if(Database::num_rows($q_last_connection) > 0)
  547. {
  548. $i_id_last_connection=Database::result($q_last_connection,0,"login_id");
  549. $s_sql_update_logout_date="UPDATE $tbl_track_login SET logout_date=NOW() WHERE login_id='$i_id_last_connection'";
  550. api_sql_query($s_sql_update_logout_date);
  551. }
  552. }
  553. ?>