1<?php 2/** 3 * Show the session. 4 * 5 * 6 * 7 * This Source Code Form is subject to the terms of the Mozilla Public License, 8 * v. 2.0. If a copy of the MPL was not distributed with this file, You can 9 * obtain one at http://mozilla.org/MPL/2.0/. 10 * 11 * @package phpMyFAQ 12 * @author Thorsten Rinne <thorsten@phpmyfaq.de> 13 * @copyright 2003-2020 phpMyFAQ Team 14 * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 15 * @link https://www.phpmyfaq.de 16 * @since 2003-02-24 17 */ 18 19use phpMyFAQ\Filter; 20use phpMyFAQ\Session; 21use phpMyFAQ\Strings; 22 23if (!defined('IS_VALID_PHPMYFAQ')) { 24 http_response_code(400); 25 exit(); 26} 27 28if ($user->perm->checkRight($user->getUserId(), 'viewlog')) { 29 $sid = Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT); 30 31 printf( 32 '<header><h2 class="page-header"><i aria-hidden="true" class="fa fa-tasks"></i> %s "<span style="color: Red;">%d</span>"</h2></header>', 33 $PMF_LANG['ad_sess_session'], 34 $sid 35 ); 36 37 $session = new Session($faqConfig); 38 $time = $session->getTimeFromSessionId($sid); 39 40 $trackingData = explode("\n", file_get_contents(PMF_ROOT_DIR . '/data/tracking' . date('dmY', $time))); 41 ?> 42 <table class="table table-striped"> 43 <tfoot> 44 <tr> 45 <td colspan="2"><a href="?action=viewsessions"><?= $PMF_LANG['ad_sess_back'] ?></a></td> 46 </tr> 47 </tfoot> 48 <tbody> 49 <?php 50 $num = 0; 51 foreach ($trackingData as $line) { 52 $data = explode(';', $line); 53 if ($data[0] == $sid) { 54 ++$num; 55 ?> 56 <tr> 57 <td><?= date('Y-m-d H:i:s', $data[7]); 58 ?></td> 59 <td><?= $data[1]; 60 ?> (<?= $data[2]; 61 ?>) 62 </td> 63 </tr> 64 <?php 65 if ($num == 1) { 66 ?> 67 <tr> 68 <td><?= $PMF_LANG['ad_sess_referer']; 69 ?></td> 70 <td> 71 <?= Strings::htmlentities(str_replace('?', '? ', $data[5])); 72 ?> 73 </td> 74 </tr> 75 <tr> 76 <td><?= $PMF_LANG['ad_sess_browser']; 77 ?></td> 78 <td><?= Strings::htmlentities($data[6]); 79 ?></td> 80 </tr> 81 <tr> 82 <td><?= $PMF_LANG['ad_sess_ip']; 83 ?>: 84 </td> 85 <td><?= Strings::htmlentities($data[3]); 86 ?></td> 87 </tr> 88 <?php 89 } 90 } 91 } 92 ?> 93 </tbody> 94 </table> 95 <?php 96} else { 97 echo $PMF_LANG['err_NotAuth']; 98} 99