HEX
Server: Apache
System: Linux msm5694.mjhst.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: camjab_ssh (1000)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: /home/httpd/html/nyloncams.com/public_html/admin/login_log.php
<?
require "header.php";

$page = (isset($_GET['page']) && is_numeric($_GET['page'])) ? (int) $_GET['page'] : 1;
$max_results = (isset($_GET['setmax']) && $_GET['setmax'] > 0) ? (int) $_GET['setmax'] : 100;
$from = ($page * $max_results) - $max_results;
?>

<div class="content-page">
    
    <div class="header-area">
        <div class="breadcrumbs">  
            <a href="index.php">Admin Home</a>
            <a href="users.php">Users List</a>
            <span><a href="login_log.php">Login History</a></span>
        </div>
    </div>
    
    <div class="content-outer">

        <h2>Login<strong>History</strong></h2>
        
        <div class="notification info">To find the user you are looking for faster, you can enter either a whole or partial username into the search box below.</div>
        
        <div class="content-inner">            

            <form method="GET" action="" class="form" novalidate autocomplete="off">
                <table class="pagetable">
                    <thead>
                        <tr>
                            <th colspan="2">Search Login History</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>Username</td>
                            <td><input type="text" name="q" /></td>
                        </tr>
                        <tr class="item submit">
                            <td colspan="2">
                                <button type="submit" class="btn action-search">Search</button>
                            </td>
                        </tr>
                    </tbody>
                </table>
                
                <table class="pagetable">
                    <thead>
                        <tr>
                            <th>Time</th>
                            <th>Username</th>
                            <th>IP</th>
                            <th>Status</th>
                        </tr>
                    </thead>
                    <?
                    if ($_REQUEST['q']) {
                        $q = mysqli_real_escape_string($dbconn, $_REQUEST['q']);
                        $query = "AND (user LIKE '%$q%')";
                    }
                    $result = dbQuery("SELECT * FROM `user_logins` WHERE 1=1 $query ORDER BY `time` DESC LIMIT $from,$max_results",false);
                    $total_results = dbValue("SELECT COUNT(*) AS `count` FROM `user_logins` WHERE 1=1 $query ", 'count');
                    $total_pages = ceil($total_results / $max_results);
                    ?>
                    <tbody>
                        <? if (count($result) == 0) { ?>
                            <tr><td colspan="4"><div class="notification alert">No entries found</div></td></tr>
                        <? } else { ?>
                            <? foreach($result as $row) { ?>
                                <tr>
                                    <td><? echo $row['time']; ?></td>
                                    <td><? echo htmlentities($row['user']); ?></td>
                                    <td><? echo $row['ip']; ?></td>
                                    <td><? echo $row['status']; ?></td>
                                </tr>
                            <? } ?>
                        <? } ?>
                    </tbody>
                </table>
            </form>
            <div id="adminPagination"><? echo showAdminPagination($total_pages); ?></div>
        </div>
    </div>

</div>
<? require "footer.php"; ?>