Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions historical-data/all_prices.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"last_updated_at": "27-06-2025 15:18:25 UTC",
"prices_vs_usd": {
"USDBTC": 0.00000938,
"USDETH": 0.00041270,
"USDWBTC": 0.00000939,
"USDWETH": 0.00071410,
"USDBNB": 0.00155100,
"USDXAUT": 0.00030520,
"USDMATIC": 5.7570,
"USDEUR": 0.8540,
"USDBRL": 5.4980
},
"usd_vs_prices": {
"BTCUSD": 106609.8081,
"ETHUSD": 2423.0676035861,
"WBTCUSD": 106496.2726,
"WETHUSD": 1400.3641,
"BNBUSD": 644.7453,
"XAUtUSD": 3276.5400,
"MATICUSD": 0.1737,
"EURUSD": 1.1710,
"BRLUSD": 0.1819
},
"plt_prices": {
"PLTUSD": 0.0000008605,
"PLTBRL": 0.0000047310,
"PLTEUR": 0.0000007349,
"PLTMATIC": 201861.2210,
"MATICPLT": 0.0000049539
},
"plt_marketcap": {
"USD": 9722.7904,
"BRL": 53455.5737,
"EUR": 8303.6358
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"status":"1","message":"OK","result":"1832374440143522"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"status":"1","message":"OK","result":"62220114646"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"status":"1","message":"OK","result":"10299587476998547709"}
58 changes: 58 additions & 0 deletions historical-data/historicaldata.add.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php include $_SERVER['DOCUMENT_ROOT'] . '/plataforma/panel/is_logged.php';?>
<?php include $_SERVER['DOCUMENT_ROOT'] . '/.scr/conexao.php';?>

<?php

// Check if the form was submitted
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$date = $_POST['date'];
$price = $_POST['price'];
$volume = $_POST['volume'];
$market_cap = $_POST['market_cap'];

// Query to insert the new record
$sql = "INSERT INTO granna80_bdlinks.token_historical_data (date, price, volume, market_cap)
VALUES ('$date', $price, $volume, $market_cap)";

if (mysqli_query($conn, $sql)) {
echo "New record added successfully!";
} else {
echo "Error adding the record: " . mysqli_error($conn);
}
}

// Close the database connection
mysqli_close($conn);
?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Add New Record</title>
</head>
<body>

<h2>Add New Record</h2>

<form method="POST" action="add.php">
<label for="date">Date:</label><br>
<input type="datetime-local" id="date" name="date" required><br><br>

<label for="price">Price:</label><br>
<input type="text" id="price" name="price" required><br><br>

<label for="volume">Volume:</label><br>
<input type="text" id="volume" name="volume" required><br><br>

<label for="market_cap">Market Cap:</label><br>
<input type="text" id="market_cap" name="market_cap" required><br><br>

<input type="submit" value="Add">
</form>

<a href="index.php">Back</a> <!-- Return link to the main or listing page -->

</body>
</html>
21 changes: 21 additions & 0 deletions historical-data/historicaldata.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
$(document).ready(function () {
$('#tokenTable').DataTable({
"lengthMenu": [
[50, 100, 150, 250],
[50, 100, 150, 250]
],
"columnDefs": [{
"width": "20px",
"targets": 0
},
{
"width": "20px",
"targets": 5
}
],

"order": [
[0, "asc"]
]
});
});
83 changes: 83 additions & 0 deletions historical-data/historicaldata.edit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php include $_SERVER['DOCUMENT_ROOT'] . '/plataforma/panel/is_logged.php';?>
<?php include $_SERVER['DOCUMENT_ROOT'] . '/.scr/conexao.php';?>

<?php

// Check if the ID was passed via URL
if (isset($_GET['id'])) {
$id = intval($_GET['id']); // Get the ID and convert it to an integer

// Query to get the record data with the specific ID
$sql = "SELECT * FROM granna80_bdlinks.token_historical_data WHERE id = $id";
$result = mysqli_query($conn, $sql);

// Check if the record was found
if (mysqli_num_rows($result) > 0) {
$row = mysqli_fetch_assoc($result);
} else {
echo "Record not found!";
exit;
}
} else {
echo "ID not specified!";
exit;
}

// Check if the form was submitted
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$date = $_POST['date'];
$price = $_POST['price'];
$volume = $_POST['volume'];
$market_cap = ($price * 11299000992);

// Query to update the record
$sql = "UPDATE granna80_bdlinks.token_historical_data SET
date = '$date',
price = $price,
volume = $volume,
market_cap = $market_cap
WHERE id = $id";

if (mysqli_query($conn, $sql)) {
echo "Record updated successfully!";
echo "<script>window.location.href='edit.php?id=" . $id . "';</script>";
} else {
echo "Error updating the record: " . mysqli_error($conn);
}
}

// Close the database connection
mysqli_close($conn);
?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Edit Record</title>
</head>
<body>

<h2>Edit Record</h2>

<form method="POST" action="edit.php?id=<?= $id; ?>">
<label for="date">Date:</label><br>
<input type="datetime-local" id="date" name="date" value="<?= date('Y-m-d\TH:i', strtotime($row['date'])); ?>"><br><br>

<label for="price">Price:</label><br>
<input type="text" id="price" name="price" value="<?= number_format($row['price'], 10, '.', ''); ?>"><br><br>

<label for="volume">Volume:</label><br>
<input type="text" id="volume" name="volume" value="<?= number_format($row['volume'], 10, '.', ''); ?>"><br><br>

<label for="market_cap">Market Cap:</label><br>
<?= number_format($row['market_cap'], 10, '.', ''); ?><br><br>

<input type="submit" value="Update">
</form>

<a href="index.php">Back</a> <!-- Return link to the main or listing page -->

</body>
</html>
53 changes: 53 additions & 0 deletions historical-data/historicaldata.fetch.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

$url = 'https://typofx.ie/plataforma/panel/token-historical-data/live_plt.json';

// Make the request to the URL and get the content as a string
$json_data = file_get_contents($url);

// Check if the request failed
if ($json_data === false) {
die('Error fetching data from the URL.');
}

// Decode the JSON string into a PHP object
$data_object = json_decode($json_data);

// Decode the JSON string into a PHP associative array
$data_array = json_decode($json_data, true);

// Check if the JSON decoding failed
if ($data_object === null && json_last_error() !== JSON_ERROR_NONE) {
die('Error decoding the JSON.');
}

// Displaying the data from the object
echo "<h2>Data as Object:</h2>";
echo "Date: " . $data_object->date . "<br>";
echo "Price: " . number_format($data_object->price, 10, '.', ',') . "<br>";
echo "Volume: " . number_format($data_object->volume, 4, '.', ',') . "<br>";
echo "Market Cap: " . number_format($data_object->market_cap, 4, '.', ',') . "<br>";

echo "<hr>";

// Displaying the data from the associative array
echo "<h2>Data as Associative Array:</h2>";
echo "Date: " . $data_array['date'] . "<br>";
echo "Price: " . number_format($data_array['price'], 10, '.', ',') . "<br>";
echo "Volume: " . number_format($data_array['volume'], 4, '.', ',') . "<br>";
echo "Market Cap: " . number_format($data_array['market_cap'], 4, '.', ',') . "<br>";

echo "<hr>";

// Displaying the full structure for debugging
echo "<h2>Object Structure:</h2>";
echo "<pre>";
print_r($data_object);
echo "</pre>";

echo "<h2>Array Structure:</h2>";
echo "<pre>";
print_r($data_array);
echo "</pre>";

?>
33 changes: 33 additions & 0 deletions historical-data/historicaldata.style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
body {
font-family: monospace;
padding: 25px;
padding-right: 250px;
background-color: #fff;
}

table.dataTable {
width: auto;
margin: 0 auto;
border-collapse: collapse;
}

table.dataTable th,
table.dataTable td {
padding: 8px 12px;
text-align: left;
}

table.dataTable th {
background-color: #fff;
}

table.dataTable tbody tr:nth-child(even) {
background-color: #f9f9f9;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
padding: 0;
margin: 0;
border: none;
background: none;
}
Loading