show.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. require_once "meekrodb.php";
  3. include "connect.php";
  4. ini_set('display_errors', '0');
  5. //setlocale(LC_MONETARY, 'en_US');
  6. date_default_timezone_set('America/New_York');
  7. header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
  8. header("Cache-Control: post-check=0, pre-check=0", false);
  9. header("Pragma: no-cache");
  10. DB::$error_handler = "noshow";
  11. function noshow($params) {
  12. echo "<font color=\"orange\">Reloading .. Please wait ..</font>";
  13. }
  14. $sql = "SELECT * FROM coinlist";//desc LIMIT 1
  15. $result = $conn->query($sql);
  16. echo "<div id=\"pricetable\"><table class=\"table table-hover\">";
  17. if ($result->num_rows > 0) {
  18. echo "<tr class=\"active\"><th>Coin</th><th>Pair</th><th>Shares</th><th>Share Total</th><th>Cash</th><th>Price</th><th>24h Volume</th><th>Indexed</th>";
  19. echo "</tr><tr>";
  20. // output data of each row
  21. while($row = $result->fetch_assoc()) {
  22. $coinn = $row['name'];
  23. $coini = $row['slug'];
  24. $coins = $row['symbol'];
  25. $coinx = $row["exchange"];
  26. $coinc = $row["crawl"];
  27. $coino = number_format($row["owned"], 3);
  28. $coinf = number_format($row["cash"], 2);
  29. $coinl = $row["infoimage"];
  30. // is this coin to be displayed?
  31. if ($coinc == 0) {
  32. // echo "$coinn ($coini $coinx) skipped\n";
  33. } else {
  34. // coins that are 1
  35. $dbcoin = str_ireplace("-", "_", $coini); // replace -s with _s.
  36. $mysqli_result = DB::queryRaw("SELECT * FROM exchange_$dbcoin order by id desc limit 1", "stuff");
  37. $showdata = $mysqli_result->fetch_assoc();
  38. $showdata_exchange = $showdata['exchange'];
  39. $showdata_coinpair = $showdata['coinpair'];
  40. $showdata_vol24 = number_format($showdata['vol24usd']);
  41. $showdata_usd = $showdata['priceusd'];
  42. $showdata_humantime_r = new Datetime($showdata['humantime']);
  43. $showdata_humantime = $showdata_humantime_r->format('h:i:s A');
  44. $coino_total_a = $coino * $showdata_usd;
  45. $coino_total = $coino_total_a;
  46. echo "<td><img src=\"mdie/images/coins/$coinl\" width=\"25px\"> <a href=\"history.php?c=$coini\"><span class=\"badge badge-pill badge-secondary\">history</span></a> <font color=\"orange\">$coinn</font></td>";
  47. echo "<td><font color=\"gray\">$showdata_coinpair</font></td>";
  48. echo "<td><font color=\"purple\"><a href=\"?buy=1&buyslug=$coini\"><span class=\"badge badge-pill badge-light\">Buy</span></a> $coino <a href=\"?sell=1&sellslug=$coini\"><span class=\"badge badge-pill badge-light\">Sell</span></a></td>";
  49. echo "<td><font color=\"green\">$$coino_total</font></td>";
  50. echo "<td><font color=\"orange\">$$coinf</font></td>";
  51. echo "<td><font color=\"green\">$$showdata_usd</font></td>";
  52. echo "<td><font color=\"orange\">$$showdata_vol24</font>/daily</td>";
  53. echo "<td><font color=\"white\">$showdata_humantime</font></td>";
  54. echo "</tr>";
  55. }
  56. }
  57. echo "</table></div>";
  58. } else {
  59. echo "NULL";
  60. }
  61. $conn->close();
  62. ?>