coinshow.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. require_once "meekrodb.php";
  3. include "connect.php";
  4. //setlocale(LC_MONETARY, 'en_US');
  5. date_default_timezone_set('America/New_York');
  6. ini_set('display_errors', '0');
  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. $update_s = $_GET["stotal"];
  11. $update_c = $_GET["slug"];
  12. DB::$error_handler = "noshow";
  13. function noshow($params) {
  14. echo "<font color=\"orange\">Reloading .. Please wait ..</font>";
  15. }
  16. $sql = "SELECT * FROM coinlist where crawl=1";//desc LIMIT 1
  17. $result = $conn->query($sql);
  18. echo "<div id=\"pricetable\"><table class=\"table table-hover\">";
  19. if ($result->num_rows > 0) {
  20. echo "<tr class=\"active\"><th>Coin</th><th>Exchange</th><th>Shares</th><th>Cash</th><th>Symbol</th>";
  21. echo "</tr><tr>";
  22. // output data of each row
  23. while($row = $result->fetch_assoc()) {
  24. $coinn = $row['name'];
  25. $coini = $row['slug'];
  26. $coins = $row['symbol'];
  27. $coinx = $row["exchange"];
  28. $coinc = $row["crawl"];
  29. $coino = number_format($row["owned"], 20);
  30. $coinf = number_format($row["cash"], 2);
  31. // is this coin to be displayed?
  32. if ($coinc == 0) {
  33. // ...
  34. } else {
  35. //echo "<form action=\"\" method=\"get\"> Shares: <input type=\"text\" name=\"stotal\"> <input type=\"hidden\" name=\"slug\" value=\"$coini\"><input type=\"submit\"> </form>";
  36. echo "<td><font color=\"orange\">$coinn</font> [<a href=\"?remove=$coini\">r</a>] [<a href=\"history.php?c=$coini\">h</a>]</td>";
  37. echo "<td><font color=\"gray\">$coinx</font></td>";
  38. echo "<td><font color=\"green\">$coino</font><form action=\"\" method=\"get\"> <input type=\"text\" name=\"sell\" size=\"4\"> <input type=\"hidden\" name=\"sellslug\" value=\"$coini\"><input type=\"submit\" value=\"Sell\"></form> <form action=\"\" method=\"get\"> <input type=\"text\" name=\"buy\" size=\"4\"> <input type=\"hidden\" name=\"buyslug\" value=\"$coini\"><input type=\"submit\" value=\"Buy\"> </form></td>";
  39. echo "<td><font color=\"orange\">$$coinf</font></td>";
  40. echo "<td><font color=\"green\">$coins</font></td>";
  41. echo "</tr>";
  42. }
  43. }
  44. echo "</table></div>";
  45. } else {
  46. echo "NULL";
  47. }
  48. $conn->close();
  49. ?>