Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>PS2 Battlefield Intel Presents:</head>
- <style>
- body {background-color : #212224; color : #CFCFCF; font-family : Arial; font-size: 13px;}
- p {color : #CFCFCF;}
- a:link {color: #6ea331; text-decoration: none;}
- a:visited {color : #6ea331; text-decoration: none;}
- a:hover {color : #ffffff; text-decoration: underline;}
- a:active {color : #6ea331;}
- table {width:80%;}
- table, th, td {
- border: 1px solid #CFCFCF;
- border-collapse: collapse;
- }
- </style>
- <body>
- <p>NOQR Members Online</p>
- <div>
- <?php
- //Database Connection
- require ('db.php');
- //Clear old data
- mysql_query("TRUNCATE TABLE `test`.`outfit_member_list`");
- //Grab data from API
- $json = file_get_contents('http://census.soe.com/s:tdavis25/get/ps2:v2/outfit_member/?c:resolve=online_status&c:resolve=character_name&outfit_id=37514290234416173&c:limit=500');
- $array = json_decode($json,true);
- array_pop($array); //removes last row with rowcount
- //insert data into DB
- foreach($array as $table) {
- foreach($table as $row){
- mysql_query("INSERT INTO `test`.`outfit_member_list` (character_id, member_since, member_since_date, outfit_id, rank, rank_ordinal, online_status, char_name)
- VALUES ('".$row['character_id']."',
- '".$row['member_since']."',
- '".$row['member_since_date']."',
- '".$row['outfit_id']."',
- '".$row['rank']."',
- '".$row['rank_ordinal']."',
- '".$row['online_status']."',
- '".$row['character']['name']['first']."')");
- }
- }
- //write table to browser
- echo "<table border='1'>
- <tr>
- <th>Name</th>
- <th>Rank</th>
- </tr>";
- //call data from DB
- $online = mysql_query("select char_name, rank from outfit_member_list where online_status = 1");
- //Check for records returned
- if (count($online) < 1) {
- echo "<tr><td>No members online</td></tr>";
- } else {
- //write values to table
- while($new_row = mysql_fetch_array($online)) {
- echo "<tr>";
- echo "<td>" . $new_row['char_name'] . "</td>";
- echo "<td>" . $new_row['rank'] . "</td>";
- echo "</tr>";
- //echo "";
- }
- }
- echo "</table>";
- //database connection close
- mysql_close($link);
- ?>
- </div>
- <br>
- <footer color : #ffffff; align : center;>Powered by No Quarter Gaming - <a href='http://www.noqr.org'>Join Us</a></footer>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement