Modificada la logica de la pagina principal

This commit is contained in:
2021-05-23 19:27:45 -03:00
parent 6fd88804c1
commit 48c9e3f633
4 changed files with 54 additions and 22 deletions

View File

@@ -1,17 +1,4 @@
<?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';
}
?>
<?php require 'logic.php'; ?>
<!DOCTYPE html>
<html lang="es">
@@ -27,7 +14,16 @@ if (file_exists('./visits.txt')) {
<div class="blue-circle">
<div class="gray-rectangle">
<h2 class="visits">VISITAS</h2>
<h2 class="amount"><?php echo $c ?></h2>
<?php
if(!$tooBig) {
echo $allRight;
} else {
echo $alert;
$c = 0;
}
?>
</div>
</div>
<a href="./definer.html"><button>
@@ -36,9 +32,4 @@ if (file_exists('./visits.txt')) {
</body>
</html>
<?php
if (file_exists('./visits.txt')) {
file_put_contents('./visits.txt', $c);
}
?>
<?php actualizeNumber($c); ?>

View File

@@ -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';
}
?>

View File

@@ -64,6 +64,12 @@ h2 {
font-size: 25pt;
}
.alert {
padding-top: 20px;
font-size: 35pt;
color: #ff5555;
}
a {
text-decoration: none;
color: inherit;

View File

@@ -1 +1 @@
112
445