mirror of
https://github.com/FranP-code/Visit-counter.git
synced 2025-10-12 23:52:54 +00:00
Modificada la logica de la pagina principal
This commit is contained in:
33
index.php
33
index.php
@@ -1,17 +1,4 @@
|
|||||||
<?php
|
<?php require 'logic.php'; ?>
|
||||||
|
|
||||||
require 'logic.php';
|
|
||||||
|
|
||||||
if (file_exists('./visits.txt')) {
|
|
||||||
$c = file_get_contents('./visits.txt');
|
|
||||||
$c++;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$c = 'Error, el archivo visits.txt no existe';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="es">
|
<html lang="es">
|
||||||
@@ -27,7 +14,16 @@ if (file_exists('./visits.txt')) {
|
|||||||
<div class="blue-circle">
|
<div class="blue-circle">
|
||||||
<div class="gray-rectangle">
|
<div class="gray-rectangle">
|
||||||
<h2 class="visits">VISITAS</h2>
|
<h2 class="visits">VISITAS</h2>
|
||||||
<h2 class="amount"><?php echo $c ?></h2>
|
<?php
|
||||||
|
|
||||||
|
if(!$tooBig) {
|
||||||
|
echo $allRight;
|
||||||
|
} else {
|
||||||
|
echo $alert;
|
||||||
|
$c = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a href="./definer.html"><button>
|
<a href="./definer.html"><button>
|
||||||
@@ -36,9 +32,4 @@ if (file_exists('./visits.txt')) {
|
|||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
<?php
|
<?php actualizeNumber($c); ?>
|
||||||
|
|
||||||
if (file_exists('./visits.txt')) {
|
|
||||||
file_put_contents('./visits.txt', $c);
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
35
logic.php
35
logic.php
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
if (file_exists('./visits.txt')) {
|
||||||
|
$c = file_get_contents('./visits.txt');
|
||||||
|
$c++;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$c = 'Error, el archivo visits.txt no existe';
|
||||||
|
}
|
||||||
|
|
||||||
|
$tooBig = false;
|
||||||
|
$allRight = '<h2 class="amount">' . $c . '</h2>';
|
||||||
|
$alert = '<h2 class="alert">!!!</h2>';
|
||||||
|
|
||||||
|
if ($c > 9999) {
|
||||||
|
$tooBig = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function actualizeNumber($c) {
|
||||||
|
|
||||||
|
if (file_exists('./visits.txt')) {
|
||||||
|
file_put_contents('./visits.txt', $c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkNumber($c) {
|
||||||
|
require './messages_and_variables.php';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -64,6 +64,12 @@ h2 {
|
|||||||
font-size: 25pt;
|
font-size: 25pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.alert {
|
||||||
|
padding-top: 20px;
|
||||||
|
font-size: 35pt;
|
||||||
|
color: #ff5555;
|
||||||
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
112
|
445
|
||||||
Reference in New Issue
Block a user