Example #1
0
function session_resume_html(PDO &$connection, Client &$_local_client)
{
    if (!$connection) {
        throw new Exception('Unable to render session resume with invalid PDO connection');
    } else {
        if (!$_local_client->status()) {
            ?>
        <section class="main">
            <header>
                <h1>MW3Guard WebAPI 1.5.0</h1>
                <p>You'r not supposed to be here..!</p>
            </header>
        </section>
        <?php 
        }
    }
    $nbReportAvailable = MAXIMUM_REPORT_PER_CLIENT - $_local_client->get_report_count();
    ?>
        <div id="sResume">
        <section class="main">
        <header>
            <h1><?php 
    echo $_local_client->getSessionName();
    ?>
</h1>
            <p>Welcome <?php 
    echo $_local_client->getName();
    ?>
. <br/>
                <?php 
    if ($_local_client->isSU()) {
        ?>
You are the super user in this session, <br/>you can either report or kick!<?php 
    } else {
        ?>
You can report <?php 
        echo $nbReportAvailable;
        ?>
 time(s) for this session.</p><?php 
    }
    ?>
        </header>
        
        <table>
            <thead>
                <tr>
                    <td>Names</td>
                    <td>Score</td>
                </tr>
            </thead>
            <tbody>
        
        <?php 
    $req = 'SELECT client_id, client_psn, leaderboard_score, acs_level, acs_prestige ' . 'FROM CLIENTS JOIN SESSIONS ON client_session=session_token ' . 'WHERE client_status = true ' . 'AND client_session = ? ' . 'AND session_status = true';
    $stmt = $connection->prepare($req);
    $cSession = $_local_client->getSessionToken();
    $stmt->bindParam(1, $cSession, PDO::PARAM_STR, 64);
    if ($stmt->execute()) {
        while ($data = $stmt->fetch()) {
            ?>
                <tr>
                    <td><?php 
            level_image_associated_html($data['acs_level'], $data['acs_prestige']);
            ?>
<a href="#client<?php 
            echo $data['client_id'];
            ?>
"><?php 
            echo $data['client_psn'];
            ?>
</a></td>
                    <td><?php 
            echo $data['leaderboard_score'];
            ?>
</td>
                </tr>
                <?php 
        }
    }
    ?>
            </tbody>
        </table>
        </section></div>
                <?php 
}