Creada conexion a bd
Login funcional Implementada página main provisional
This commit is contained in:
parent
5a820e4d37
commit
75481926d4
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
$host = "localhost";
|
||||||
|
$user = "company";
|
||||||
|
$pass = "2004";
|
||||||
|
$dbname = "ticketcompany_db";
|
||||||
|
|
||||||
|
$conn = new mysqli($host, $user, $pass, $dbname);
|
||||||
|
|
||||||
|
if ($conn->connect_error) {
|
||||||
|
die("Error de conexión: " . $conn->connect_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once "conexion-bd.php";
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$email = $conn->real_escape_string($_POST['email']);
|
||||||
|
$password = $_POST['password'];
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM vendedores WHERE email = '$email' LIMIT 1";
|
||||||
|
$result = $conn->query($sql);
|
||||||
|
|
||||||
|
if ($result && $result->num_rows === 1) {
|
||||||
|
$usuario = $result->fetch_assoc();
|
||||||
|
|
||||||
|
if ($password === $usuario['password']) {
|
||||||
|
$_SESSION['vendedor_id'] = $usuario['id'];
|
||||||
|
$_SESSION['vendedor_nombre'] = $usuario['nombre'];
|
||||||
|
header("Location: ../main.html");
|
||||||
|
exit();
|
||||||
|
} else {
|
||||||
|
header("Location: login.html?error=" . urlencode("Credenciales incorrectas."));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
header("Location: login.html?error=" . urlencode("Usuario no encontrado."));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
|
@ -0,0 +1,58 @@
|
||||||
|
body {
|
||||||
|
background-color: #2980b9;
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-container {
|
||||||
|
width: 320px;
|
||||||
|
margin: 100px auto;
|
||||||
|
background: #fff;
|
||||||
|
padding: 25px;
|
||||||
|
border-radius: 5px;
|
||||||
|
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-container h2 {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-group {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-group label {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-group input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 8px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
background-color: #3498db;
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 3px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:hover {
|
||||||
|
background-color: #2980b9;
|
||||||
|
}
|
||||||
|
|
||||||
|
#error {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
color: red;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background-color: #f4f4f4;
|
||||||
|
}
|
||||||
|
header {
|
||||||
|
background-color: #333;
|
||||||
|
color: white;
|
||||||
|
padding: 10px 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
nav ul {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
nav ul li {
|
||||||
|
display: inline;
|
||||||
|
margin: 0 15px;
|
||||||
|
}
|
||||||
|
nav ul li a {
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.banner {
|
||||||
|
color: white;
|
||||||
|
text-align: center;
|
||||||
|
padding: 100px 20px;
|
||||||
|
}
|
||||||
|
.eventos {
|
||||||
|
text-align: center;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
.evento {
|
||||||
|
display: inline-block;
|
||||||
|
background: white;
|
||||||
|
padding: 15px;
|
||||||
|
margin: 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
.evento img {
|
||||||
|
max-width: 100%;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
background: #28a745;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
button:hover {
|
||||||
|
background: #218838;
|
||||||
|
}
|
Binary file not shown.
After ![]() (image error) Size: 9.9 KiB |
Binary file not shown.
After ![]() (image error) Size: 8.0 KiB |
|
@ -0,0 +1,27 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="es">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Login - TicketCompany</title>
|
||||||
|
<link rel="css" href="css/login.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="login-container">
|
||||||
|
<h2>Iniciar Sesión</h2>
|
||||||
|
<?php if(isset($_GET['error'])): ?>
|
||||||
|
<div id="error"><?php echo htmlspecialchars($_GET['error']); ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form id="loginForm" action="controladores/login.php" method="post">
|
||||||
|
<div class="input-group">
|
||||||
|
<label for="email">Correo electrónico</label>
|
||||||
|
<input type="email" id="email" name="email" required>
|
||||||
|
</div>
|
||||||
|
<div class="input-group">
|
||||||
|
<label for="password">Contraseña</label>
|
||||||
|
<input type="password" id="password" name="password" required>
|
||||||
|
</div>
|
||||||
|
<button type="submit">Ingresar</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
39
main.html
39
main.html
|
@ -3,9 +3,44 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Hola Mundo</title>
|
<title>Venta de Boletos</title>
|
||||||
|
<link rel="stylesheet" href="css/main.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Hola Mundo</h1>
|
<header>
|
||||||
|
<nav>
|
||||||
|
<div class="logo">TicketCompany</div>
|
||||||
|
<ul>
|
||||||
|
<li><a href="login.html">Iniciar sesión</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<section class="banner">
|
||||||
|
<h1>Encuentra tus eventos favoritos</h1>
|
||||||
|
<p>Compra boletos para tu artista favorito.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="eventos">
|
||||||
|
<h2>Próximos Conciertos</h2>
|
||||||
|
<div class="evento">
|
||||||
|
<img src="img/images.jpeg" alt="Evento 1">
|
||||||
|
<h3>Concierto de Artista X</h3>
|
||||||
|
<p>15 de marzo - Ciudad de México</p>
|
||||||
|
<button>Comprar boletos</button>
|
||||||
|
</div>
|
||||||
|
<div class="evento">
|
||||||
|
<img src="evento2.jpg" alt="Evento 2">
|
||||||
|
<h3>Partido de Fútbol</h3>
|
||||||
|
<p>20 de abril - Estadio Nacional</p>
|
||||||
|
<button>Comprar boletos</button>
|
||||||
|
</div>
|
||||||
|
<div class="evento">
|
||||||
|
<img src="evento3.jpg" alt="Evento 3">
|
||||||
|
<h3>Obra de Teatro</h3>
|
||||||
|
<p>10 de mayo - Teatro Principal</p>
|
||||||
|
<button>Comprar boletos</button>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue