Skip to content

Commit

Permalink
Merge pull request #6 from snick512/testing
Browse files Browse the repository at this point in the history
Version upgrade
  • Loading branch information
snick512 authored Nov 1, 2019
2 parents 4e29b71 + 2d67814 commit 9f49dc2
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 431 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Thanks to MeekroDB and Coin Gecko.

![alt text](https://urcpu.com/~snick/h.png "CMI")

Version 0.1.6.1011
Version 0.2.7.1050

..._more features on the way, checkout the testing branch when it's available_

Expand All @@ -32,8 +32,11 @@ Before running mdie PHP, curl and MySQL should be installed.

1. Clone/Download all files.
2. Copy to /var/www/html
3. Run prep.php in the web browser.
4. Set a cron to execute every minute. `*/1 * * * * curl "http://127.0.0.1/mdie/crawl.php"`
3. Download coin logo pack: `wget https://urcpu.com/coin_images.tar.gz`
4. Run prep.php in the web browser.
5. Set a cron to execute every minute. `*/1 * * * * curl "http://127.0.0.1/mdie/crawl.php"`

For detailed install visit the [wiki here](https://github.com/snick512/cryptomarketindexer/wiki/Installing-and-Configuring).

***API limits are limited to 100 per minute***

Expand Down
50 changes: 16 additions & 34 deletions coinlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,15 @@
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">
</head>

<body>

<?php

include "header.php";


// update coin shares
$update = $_GET["stotal"];
$slug = $_GET["slug"];
/*
removed for now
if (!$update) {
// nothing to do here... yet.
} else {
$mysqli_crawl = DB::queryRaw("UPDATE coinlist SET owned='$update' WHERE slug='$slug'");
echo "<hr />Shares now: <strong><font color=\"purple\">$update</font></strong> for $slug<hr />";
}// end of updating coin shares
*/

$sell = $_GET["sell"];
$sellslug = $_GET["sellslug"];
Expand All @@ -57,15 +39,15 @@
$sellprice_output = $sellprice["priceusd"];
$sell_now = $sellprice_output * $sell;

$mysqli_owned = DB::queryRaw("SELECT owned,cash from coinlist where slug=%s", $sellslug);
$owned = $mysqli_owned->fetch_assoc();
$cash_output = $owned["cash"];
$owned_now = $owned["owned"];
$owned_final = $owned_now - $sell;
$cash_now = $cash_output + $sell_now;
$mysqli_owned = DB::queryRaw("SELECT owned,cash from coinlist where slug=%s", $sellslug);
$owned = $mysqli_owned->fetch_assoc();
$cash_output = $owned["cash"];
$owned_now = $owned["owned"];
$owned_final = $owned_now - $sell;
$cash_now = $cash_output + $sell_now;

$mysqli_owned_update = DB::query("UPDATE coinlist SET owned=%i WHERE slug=%s", $owned_final, $sellslug);
$mysqli_cash_update = DB::query("UPDATE coinlist SET cash=%i WHERE slug=%s", $cash_now, $sellslug);
$mysqli_owned_update = DB::query("UPDATE coinlist SET owned=%i WHERE slug=%s", $owned_final, $sellslug);
$mysqli_cash_update = DB::query("UPDATE coinlist SET cash=%i WHERE slug=%s", $cash_now, $sellslug);

?>
<br /><center>
Expand Down Expand Up @@ -101,15 +83,15 @@
$buyprice_output = $buyprice["priceusd"];
$buy_now = $buyprice_output * $buy;

$mysqli_owned = DB::queryRaw("SELECT owned,cash from coinlist where slug=%s", $buyslug);
$owned = $mysqli_owned->fetch_assoc();
$owned_now = $owned["owned"];
$cash_output = $owned["cash"];
$cash_now = $cash_output - $buy_now;
$owned_final = $owned_now + $buy;
$mysqli_owned = DB::queryRaw("SELECT owned,cash from coinlist where slug=%s", $buyslug);
$owned = $mysqli_owned->fetch_assoc();
$owned_now = $owned["owned"];
$cash_output = $owned["cash"];
$cash_now = $cash_output - $buy_now;
$owned_final = $owned_now + $buy;

$mysqli_owned_update = DB::query("UPDATE coinlist SET owned=%i WHERE slug=%s", $owned_final, $buyslug);
$mysqli_cash_update = DB::query("UPDATE coinlist SET cash=%i WHERE slug=%s", $cash_now, $buyslug);
$mysqli_owned_update = DB::query("UPDATE coinlist SET owned=%i WHERE slug=%s", $owned_final, $buyslug);
$mysqli_cash_update = DB::query("UPDATE coinlist SET cash=%i WHERE slug=%s", $cash_now, $buyslug);

?>
<br /><center>
Expand Down
25 changes: 19 additions & 6 deletions history.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
$crawl = $showdata['crawl'];
$cash = $showdata['cash'];
$exchange = $showdata['exchange'];
$image = $showdata["infoimage"];

$mysqli_exchange = DB::queryRaw("SELECT * FROM exchanges WHERE exchange=%s", $exchange);
$mysqli_exchange_a = $mysqli_exchange->fetch_assoc();
Expand All @@ -52,10 +53,12 @@
<div class="card border-warning mb-3" style="max-width: 90%;">
<h3 class="card-header"><?php echo "$f_name"; ?></h3>
<div class="card-body">
<h5 class="card-title">$<?php echo number_format($cash); ?></h5>
<h6 class="card-subtitle text-muted"></h6>
<h5 class="card-title"></h5>
<h6 class="card-subtitle text-muted">$<?php echo number_format($cash); ?></h6>
</div>

<img src="mdie/images/coins/<?php echo "$image"; ?>" width="100px"> <br />


<script src="https://widgets.coingecko.com/coingecko-coin-price-chart-widget.js"></script>

Expand Down Expand Up @@ -91,10 +94,20 @@






<div id="output"></div>
<br />
<div align="center" id="output">
<div
class="progress-bar progress-bar-striped progress-bar-animated"
role="progressbar"
aria-valuenow="95"
aria-valuemin="0"
aria-valuemax="100"
style="width: 75%">
Loading ... Please allow a few minutes to populate after any changes.</div>
</div>


<!--<div id="output"></div>-->
<hr />


Expand Down
9 changes: 2 additions & 7 deletions mdie/show.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ function noshow($params) {
$sql = "SELECT * FROM coinlist";//desc LIMIT 1
$result = $conn->query($sql);



echo "<div id=\"pricetable\"><table class=\"table table-hover\">";

if ($result->num_rows > 0) {
Expand All @@ -36,12 +34,12 @@ function noshow($params) {
$coinc = $row["crawl"];
$coino = number_format($row["owned"], 3);
$coinf = number_format($row["cash"], 2);
$coinl = $row["infoimage"];

// is this coin to be displayed?
if ($coinc == 0) {
// echo "$coinn ($coini $coinx) skipped\n";


} else {

// coins that are 1
Expand All @@ -59,7 +57,7 @@ function noshow($params) {
$coino_total_a = $coino * $showdata_usd;
$coino_total = $coino_total_a;

echo "<td><a href=\"history.php?c=$coini\"><span class=\"badge badge-pill badge-secondary\">history</span></a> <font color=\"orange\">$coinn</font></td>";
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>";
echo "<td><font color=\"gray\">$showdata_coinpair</font></td>";
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>";
echo "<td><font color=\"green\">$$coino_total</font></td>";
Expand All @@ -70,9 +68,6 @@ function noshow($params) {

echo "</tr>";




}
}
echo "</table></div>";
Expand Down
5 changes: 3 additions & 2 deletions sql/coinlist.sql

Large diffs are not rendered by default.

Loading

0 comments on commit 9f49dc2

Please sign in to comment.