detail.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. require_once "meekrodb.php";
  3. include "connect.php";
  4. ini_set('display_errors', '0');
  5. date_default_timezone_set('America/New_York');
  6. header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
  7. header("Cache-Control: post-check=0, pre-check=0", false);
  8. header("Pragma: no-cache");
  9. $coin = $_GET["c"];
  10. $dbcoin = str_ireplace("-", "_", $coin); // replace -s with _s.
  11. DB::$error_handler = "coinnull";
  12. DB::$throw_exception_on_error = true;
  13. function coinnull($params) {
  14. echo "NULL";
  15. }
  16. try {
  17. $mysqli_result = DB::queryRaw("SELECT * FROM coinlist WHERE slug=%s", $coin);
  18. $showdata = $mysqli_result->fetch_assoc();
  19. $f_name = $showdata['name'];
  20. $f_logo = $showdata['infoimage'];
  21. } catch (MeekroDBException $e) {
  22. // code.
  23. }
  24. $sql = "SELECT * FROM exchange_$dbcoin order by id desc limit 60";//desc LIMIT 1
  25. $result = $conn->query($sql);
  26. echo "<div id=\"pricetable\"><table class=\"table table-hover\">";
  27. if ($result->num_rows > 0) {
  28. echo "<tr class=\"active\"><th>Coin</th><th>Pair</th><th>BTC</th><th>ETH</th><th>USD</th><th>Indexed</th>";
  29. echo "</tr><tr>";
  30. // output data of each row
  31. while($row = $result->fetch_assoc()) {
  32. // $name = $row['name'];
  33. $pair = $row['coinpair'];
  34. $pricebtc = $row['pricebtc'];
  35. $priceeth = $row["priceeth"];
  36. $priceusd = $row["priceusd"];
  37. $humantime_r = new Datetime($row['humantime']);
  38. $humantime = $humantime_r->format('h:i A');
  39. echo "<td><img src=\"mdie/images/coins/$f_logo\" width=\"25px\"> <font color=\"orange\">$f_name</font></td>";
  40. echo "<td><font color=\"gray\">$pair</font></td>";
  41. echo "<td><font color=\"green\">$pricebtc</font></td>";
  42. echo "<td><font color=\"orange\">$priceeth</font></td>";
  43. echo "<td><font color=\"green\">$priceusd</font></td>";
  44. echo "<td><font color=\"white\">$humantime</font></td>";
  45. echo "</tr>";
  46. }
  47. echo "</table></div>";
  48. } else {
  49. echo "<p class=\"text-danger\">Coin data does not exist.</a>";
  50. }
  51. $conn->close();
  52. ?>