Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>STOCKPILER - Stockpile Listing</title>
- <style type="text/css">
- .tg {border-collapse:collapse;border-color:#ccc;border-spacing:0;margin:0px auto;}
- .tg td{background-color:#fff;border-color:#ccc;border-style:solid;border-width:1px;color:#333;
- font-family:Arial, sans-serif;font-size:14px;overflow:hidden;padding:5px 5px;word-break:normal;}
- .tg th{background-color:#f0f0f0;border-color:#ccc;border-style:solid;border-width:1px;color:#333;
- font-family:Arial, sans-serif;font-size:14px;font-weight:normal;overflow:hidden;padding:5px 5px;word-break:normal;}
- .tg .tg-baqh{text-align:center;vertical-align:middle;font-size:10px;}
- .tg .tg-dzk6{background-color:#f9f9f9;text-align:center;vertical-align:middle}
- .tl {border-color:inherit;font-size:14px;text-align:center;vertical-align:middle;font-family:Arial, sans-serif}
- </style>
- </head>
- <body>
- <center>
- <h1>
- STOCKPILER - a Foxhole Stockpile Tracker
- </h1>
- </center>
- <center>
- <?php
- $servername = "redacted";
- $username = "redacted";
- $password = "redacted";
- $dbname = "redacted";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- echo "Connected successfully to DB !<br><br>";
- $table_info = "SELECT serial, map_hex, location, access_code, name, creator, date_created, date_refreshed, date_expire, comments FROM redacted";
- //$sql = "SELECT * FROM redacted";
- $result = $conn->query($table_info);
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- /* echo "<tr>";
- echo "<td>".$row["serial"]."</td>";
- echo "<td>".$row["map_hex"]."</td>";
- echo "<td>".$row["location"]."</td>";
- echo "<td>".$row["access_code"]."</td>";
- echo "<td>".$row["name"]."</td>";
- echo "<td>".$row["creator"]."</td>";
- echo "<td>".$row["date_created"]."</td>";
- echo "<td>".$row["date_refreshed"]."</td>";
- echo "<td>".$row["date_expire"]."</td>";
- echo "<td>".$row["comments"]."</td>";
- echo "</tr>"; */
- $d_c = $row["date_created"];
- $d_r = $row["date_refreshed"];
- $d_e = $row["date_expire"];
- $countdown = date("M j, Y G:i:s", $d_e);
- $serial = $row["serial"];
- echo "<table class='tg' width='1000 px'>";
- echo "<tbody>";
- echo "<tr>";
- echo "<td class='tg-baqh' width='200 px'>Creator :</td>";
- echo "<td class='tg-baqh' width='200 px'>Date Created: </td>";
- echo "<td class='tg-baqh' width='200 px'>Date Last Refreshed: </td>";
- echo "<td class='tg-baqh' width='200 px'>Date of Expiry: </td>";
- echo "<td class='tg-baqh' width='200 px'>Comments: </td>";
- echo "</tr>";
- echo "<tr>";
- echo "<td class='tg-dzk6' width='200 px'>".$row["creator"]."</td>";
- echo "<td class='tg-dzk6' width='200 px'>";
- echo date("H:i D d M Y e", $d_c);
- echo "</td>";
- echo "<td class='tg-dzk6' width='200 px'>";
- echo date("H:i D d M Y e", $d_r);
- echo "</td>";
- echo "<td class='tg-dzk6' width='200 px'>";
- echo date("H:i D d M Y e", $d_e);
- echo "</td>";
- echo "<td class='tg-dzk6' width='200 px'>".$row["comments"]."</td>";
- echo "</tr>";
- echo "<tr>";
- echo "<td class='tg-baqh' width='200 px'>Serial No. :</td>";
- echo "<td class='tg-baqh' width='200 px'>Map Hex: </td>";
- echo "<td class='tg-baqh' width='200 px'>Location: </td>";
- echo "<td class='tg-baqh' width='200 px'>Access Code: </td>";
- echo "<td class='tg-baqh' width='200 px'>Name: </td>";
- echo "</tr>";
- echo "<tr>";
- echo "<td class='tg-dzk6' width='200 px'>".$row["serial"]."</td>";
- echo "<td class='tg-dzk6' width='200 px'>".$row["map_hex"]."</td>";
- echo "<td class='tg-dzk6' width='200 px'>".$row["location"]."</td>";
- echo "<td class='tg-dzk6' width='200 px'>".$row["access_code"]."</td>";
- echo "<td class='tg-dzk6' width='200 px'>".$row["name"]."</td>";
- echo "</tr>";
- echo "</tbody>";
- echo "</table>";
- echo "<table class='tl' width='1000 px'>";
- echo "<tbody>";
- echo "<tr>";
- echo "<td width='200 px'><input type='submit' name='submit' value='DELETE'></td>";
- echo "<td width='600 px'>Time Remaining: <BR><timer id='demo'></timer></td>";
- echo "<td width='200 px'><input type='submit' name='submit' value='REFRESH'></td>";
- echo "</tr>";
- echo "</tbody>";
- echo "</table>";
- echo "<HR NOSHADE width='15%'>";
- }
- } else {
- echo "0 results";
- }
- $conn->close();
- ?>
- </center>
- </body>
- <script>
- var countDownDate = <?php echo strtotime($countdown) ?> * 1000;
- var now = <?php echo time() ?> * 1000;
- var x = setInterval(function() {
- now = now + 1000;
- var distance = countDownDate - now;
- var days = Math.floor(distance / (1000 * 60 * 60 * 24));
- var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
- var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
- var seconds = Math.floor((distance % (1000 * 60)) / 1000);
- document.getElementById("demo").innerHTML = days + "d " + hours + "h " +
- minutes + "m " + seconds + "s ";
- if (days == 2) {document.getElementById("demo").style.color = 'blue' ;}
- else if (days == 1) {document.getElementById("demo").style.color = 'green' ;}
- else if (days == 0 && hours <= 23 && hours >= 12) {document.getElementById("demo").style.color = 'yellow' ;}
- else if (days == 0 && hours <= 11 && hours >= 6) {document.getElementById("demo").style.color = 'orange' ;}
- else if (days == 0 && hours <= 5) {document.getElementById("demo").style.color = 'red' ;}
- // If the count down is over, write some text
- if (distance < 0) {
- clearInterval(x);
- document.getElementById("demo").innerHTML = "EXPIRED";
- }
- }, 1000);
- </script>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement