cookies
This commit is contained in:
@@ -1,14 +1,37 @@
|
||||
<?php
|
||||
// Leer cookies
|
||||
$tema = isset($_COOKIE['tema']) ? $_COOKIE['tema'] : 'oscuro';
|
||||
if ($_SERVER["REQUEST_METHOD"] == "GET" && !empty($_GET)) {
|
||||
$tema = $_GET['tema'];
|
||||
setcookie("tema", $tema, time() + (86400 * 30), "/");
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" type="text/css" href="estilos.css" />
|
||||
<?php
|
||||
echo $tema === 'claro' ? '<link rel="stylesheet" type="text/css" href="estilos_claro.css" />'
|
||||
: '<link rel="stylesheet" type="text/css" href="estilos.css" />' ?>
|
||||
<title>Login</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div>
|
||||
<h3>Seleccione su tema preferido</h3>
|
||||
<form method="get">
|
||||
<label for="claro">Tema Claro</label>
|
||||
<input style="min-width: auto;" type="radio" id="claro" name="tema" value="claro" <?php echo $tema === 'claro' ? 'checked' : '' ?>>
|
||||
<label for="oscuro">Tema Oscuro</label>
|
||||
<input style="min-width: auto;" type="radio" id="oscuro" name="tema" value="oscuro" <?php echo $tema === 'oscuro' ? 'checked' : '' ?>> <br>
|
||||
<input type="submit" value="Guardar">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h2>Login de usuario</h2>
|
||||
<form method="post">
|
||||
|
||||
Reference in New Issue
Block a user