first commit
This commit is contained in:
80
app/data.csv
Normal file
80
app/data.csv
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
869356070050873
|
||||||
|
869356070050808
|
||||||
|
869356070052093
|
||||||
|
869356070825860
|
||||||
|
867730084636673
|
||||||
|
867730084683360
|
||||||
|
867730084693344
|
||||||
|
867730084697196
|
||||||
|
867730084692676
|
||||||
|
867730084631641
|
||||||
|
867730084685308
|
||||||
|
867730084691439
|
||||||
|
867730084669195
|
||||||
|
867730084689896
|
||||||
|
867730084691330
|
||||||
|
863078081737829
|
||||||
|
867730084685852
|
||||||
|
867730084693047
|
||||||
|
867730084684491
|
||||||
|
867730084691926
|
||||||
|
867730084669286
|
||||||
|
867730084668361
|
||||||
|
867730084682354
|
||||||
|
867730084671340
|
||||||
|
867730084691322
|
||||||
|
867730084680317
|
||||||
|
867730084683329
|
||||||
|
867730084685381
|
||||||
|
867730084691843
|
||||||
|
867730084697188
|
||||||
|
867730084695893
|
||||||
|
867730084687429
|
||||||
|
867730084685373
|
||||||
|
867730084695703
|
||||||
|
867730084697204
|
||||||
|
867730084691025
|
||||||
|
867730084684608
|
||||||
|
867730084685977
|
||||||
|
867730084686298
|
||||||
|
867730084686116
|
||||||
|
867730084687403
|
||||||
|
867730084669146
|
||||||
|
867730084701444
|
||||||
|
869356078426695
|
||||||
|
867730084695869
|
||||||
|
867730084671142
|
||||||
|
867730084685860
|
||||||
|
867730084640949
|
||||||
|
867730084697139
|
||||||
|
867730084687478
|
||||||
|
867730084687304
|
||||||
|
867730084645948
|
||||||
|
867730084690951
|
||||||
|
867730084685910
|
||||||
|
867730084690969
|
||||||
|
867730084686256
|
||||||
|
867730084695885
|
||||||
|
867730084669187
|
||||||
|
867730084695729
|
||||||
|
867730084672926
|
||||||
|
867730084695778
|
||||||
|
867730084645344
|
||||||
|
867730084681687
|
||||||
|
869356078430374
|
||||||
|
867730084667009
|
||||||
|
867730084687379
|
||||||
|
867730084633092
|
||||||
|
867730084687338
|
||||||
|
867730084687452
|
||||||
|
867730084697287
|
||||||
|
867730084697212
|
||||||
|
869356078424435
|
||||||
|
867730084641707
|
||||||
|
867730084669161
|
||||||
|
867730084684483
|
||||||
|
867730084691454
|
||||||
|
867730084691272
|
||||||
|
867730084693146
|
||||||
|
867730084692981
|
||||||
|
867730084680871
|
||||||
|
90
app/index.html
Normal file
90
app/index.html
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Number Logger</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial;
|
||||||
|
text-align: center;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
input, button {
|
||||||
|
width: 90%;
|
||||||
|
padding: 12px;
|
||||||
|
margin: 10px;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
background: #28a745;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
ul {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
li {
|
||||||
|
background: #f1f1f1;
|
||||||
|
margin: 5px;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h2>Enter Number</h2>
|
||||||
|
|
||||||
|
<input type="number" id="number" placeholder="Enter number">
|
||||||
|
<button onclick="submitData()">Submit</button>
|
||||||
|
|
||||||
|
<p id="status"></p>
|
||||||
|
|
||||||
|
<h3>Saved Numbers</h3>
|
||||||
|
<ul id="list"></ul>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function loadData() {
|
||||||
|
fetch("read.php")
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(data => {
|
||||||
|
let list = document.getElementById("list");
|
||||||
|
list.innerHTML = "";
|
||||||
|
|
||||||
|
data.reverse().forEach(item => {
|
||||||
|
let li = document.createElement("li");
|
||||||
|
li.innerText = item.number;
|
||||||
|
list.appendChild(li);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitData() {
|
||||||
|
let number = document.getElementById("number").value;
|
||||||
|
|
||||||
|
if (!number) {
|
||||||
|
alert("Enter a number");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fetch("save.php", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded"
|
||||||
|
},
|
||||||
|
body: `number=${number}`
|
||||||
|
})
|
||||||
|
.then(res => res.text())
|
||||||
|
.then(data => {
|
||||||
|
document.getElementById("status").innerText = data;
|
||||||
|
document.getElementById("number").value = "";
|
||||||
|
loadData(); // refresh list
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load data on page open
|
||||||
|
loadData();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
21
app/read.php
Normal file
21
app/read.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$file = 'data.csv';
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
if (file_exists($file)) {
|
||||||
|
|
||||||
|
$handle = fopen($file, 'r');
|
||||||
|
|
||||||
|
while (($row = fgetcsv($handle)) !== false) {
|
||||||
|
$data[] = [
|
||||||
|
"number" => $row[0]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode($data);
|
||||||
|
?>
|
||||||
23
app/save.php
Normal file
23
app/save.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
|
|
||||||
|
$number = $_POST['number'];
|
||||||
|
|
||||||
|
if (empty($number)) {
|
||||||
|
echo "Invalid input";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = 'data.csv';
|
||||||
|
|
||||||
|
$handle = fopen($file, 'a');
|
||||||
|
|
||||||
|
// Save ONLY number (no timestamp)
|
||||||
|
fputcsv($handle, [$number]);
|
||||||
|
|
||||||
|
fclose($handle);
|
||||||
|
|
||||||
|
echo "Saved!";
|
||||||
|
}
|
||||||
|
?>
|
||||||
19
docker-compose.yml
Normal file
19
docker-compose.yml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
nginx:
|
||||||
|
image: nginx:latest
|
||||||
|
container_name: number-nginx
|
||||||
|
ports:
|
||||||
|
- "8081:80"
|
||||||
|
volumes:
|
||||||
|
- ./app:/var/www/html
|
||||||
|
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
|
||||||
|
depends_on:
|
||||||
|
- php
|
||||||
|
|
||||||
|
php:
|
||||||
|
image: php:8.2-fpm
|
||||||
|
container_name: number-php
|
||||||
|
volumes:
|
||||||
|
- ./app:/var/www/html
|
||||||
18
nginx/default.conf
Normal file
18
nginx/default.conf
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
root /var/www/html;
|
||||||
|
index index.html index.php;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_pass number-php:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user