Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- ob_start();
- if (!isset($_SESSION['logged'])) {
- header('Location: index.php');
- }
- $staffPerms = $_SESSION['perms'];
- $user = $_SESSION['user'];
- if ($staffPerms['ccmember'] != '1' ) {
- if ($staffPerms['dev'] != '1') {
- header('Location: ../lvlError.php');
- }
- }
- include '../verifyPanel.php';
- masterconnect();
- $page1 = $_GET['page'];
- if ($page1 == '' || $page1 == '1') {
- $page = 0;
- } else {
- $page = ($page1 * 50) - 50;
- }
- $resultQ = 'SELECT uid FROM points';
- $result = mysqli_query($dbcon, $resultQ) or die('Connection could not be established');
- $count = mysqli_num_rows($result);
- $amount = $count / 50;
- $amount = ceil($amount) + 1;
- $currentpage = $page1;
- $minusPage = $currentpage - 1;
- if ($minusPage < 1) {
- $minusPage = 1;
- }
- $addPage = $currentpage + 1;
- if ($addPage > $amount) {
- $addPage = $amount;
- }
- $sqlget = 'SELECT * FROM points ORDER BY uid ASC limit '.$page.',50';
- $search_result = filterTable($dbcon, $sqlget);
- include '../header/convoyheader.php';
- ?>
- <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
- <h1 style = "margin-top: 70px">Convoy Points</h1>
- <p class="page-header">List of points for the current convoy and who the point is assigned to.</p>
- <div id="alert-area"></div>
- <div class="btn-group" role="group" aria-label="...">
- <FORM METHOD="LINK" ACTION="convoydetails">
- <INPUT class='btn btn-primary btn-outline' style="border-color:<?php echo $CCUSTOMCOLOR; ?>" TYPE="submit" VALUE="Back">
- </FORM>
- </div>
- <br>
- <div class="table-responsive">
- <table class="table table-striped" style = "margin-top: 0px">
- <thead>
- <tr>
- <th></th>
- <th style="text-align: center !important;">Assinged To</th>
- <th style="text-align: center !important;">Message</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $pointno = 0;
- while ($row = mysqli_fetch_array($search_result, MYSQLI_ASSOC)) {
- $pointno++;
- echo '<tr>';
- echo '<td style="font-weight: bold;">Point: '.$pointno.'</td>';
- echo '<td>' ?>
- <input style="max-width: 50% !important;" class="form-control" onBlur="dbSave(this.value, '<?php echo $row['uid']; ?>', 'assigned', '<?php echo $row['assigned']; ?>')"; type=text value= "<?php echo $row['assigned']; ?>" >
- <?php
- echo '</td>';
- echo '<td>' ?>
- <input class="form-control" onBlur="dbSave(this.value, '<?php echo $row['uid']; ?>', 'message', '<?php echo $row['message']; ?>')"; type=text value= "<?php echo $row['message']; ?>" >
- <?php
- echo '</td>';
- echo '</tr>';
- }
- echo '</table></div>';
- ?>
- <nav>
- <ul class="pagination">
- <?php if ($currentpage != 1) {
- ?>
- <li>
- <a href="convoypoints.php?search=<?php echo $search; ?>&page=<?php echo $minusPage; ?>" aria-label="Previous">
- <span aria-hidden="true">«</span>
- </a>
- </li>
- <?php
- } else {
- ?>
- <li class = "disabled">
- <a href="convoypoints.php?search=<?php echo $search; ?>&page=<?php echo $minusPage; ?>" aria-label="Previous">
- <span aria-hidden="true">«</span>
- </a>
- </li>
- <?php
- }
- $amountPage = $currentpage + 2;
- $pageBefore = $currentpage - 2;
- if ($pageBefore == 0) {
- $pageBefore = 1;
- $amountPage = $amountPage + 1;
- }
- if ($pageBefore < 1) {
- $pageBefore = 1;
- $amountPage = $amountPage + 2;
- }
- for ($b = $pageBefore; $b <= $amountPage; ++$b) {
- if ($b >= $amount) {
- ?><li class = "disabled"><a href = "convoypoints.php?search=<?php echo $search; ?>&page=<?php echo $b; ?>" style = "text-decoration:none"><?php echo $b.' '; ?></a><li><?php
- } else {
- if ($b == $currentpage) {
- ?><li class = "active"><a href = "convoypoints.php?search=<?php echo $search; ?>&page=<?php echo $b; ?>" style = "text-decoration:none"><?php echo $b.' '; ?></a><li><?php
- } else {
- ?><li><a href = "convoypoints.php?search=<?php echo $search; ?>&page=<?php echo $b; ?>" style = "text-decoration:none"><?php echo $b.' '; ?></a><li><?php
- }
- }
- }
- if ($currentpage != $amount) {
- ?>
- <li>
- <a href="convoypoints.php?search=<?php echo $search; ?>&page=<?php echo $addPage; ?>" aria-label="Next">
- <span aria-hidden="true">»</span>
- </a>
- </li>
- <?php
- } else {
- ?>
- <li class = "disabled">
- <a href='convoypoints.php?search=<?php echo $search; ?>&page=<?php echo $minusPage; ?>' aria-label="Next">
- <span aria-hidden="true">»</span>
- </a>
- </li>
- <?php
- }
- ?>
- </ul>
- </nav>
- <script>
- function newAlert (type, message) {
- $("#alert-area").append($("<div class='alert " + type + " fade in' data-alert><p> " + message + " </p></div>"));
- $(".alert").delay(2000).fadeOut("slow", function () { $(this).remove(); });
- }
- function dbSave(value, uid, column, original){
- if (value != original) {
- newAlert('alert-success', 'Value Updated!');
- $.post('Backend/updatePoints.php',{column:column, editval:value, uid:uid},
- function(){
- //alert("Sent values.");
- });
- };
- }
- </script>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- <script src="dist/js/bootstrap.min.js"></script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment