diff --git a/controladores/conexion-bd.php b/controladores/conexion-bd.php new file mode 100644 index 0000000..a2e4765 --- /dev/null +++ b/controladores/conexion-bd.php @@ -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); +} + +?> diff --git a/controladores/login.php b/controladores/login.php new file mode 100644 index 0000000..3d1cbcb --- /dev/null +++ b/controladores/login.php @@ -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(); + } +} +?> diff --git a/css/login.css b/css/login.css new file mode 100644 index 0000000..8b49114 --- /dev/null +++ b/css/login.css @@ -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; + } + \ No newline at end of file diff --git a/css/main.css b/css/main.css new file mode 100644 index 0000000..5e794b1 --- /dev/null +++ b/css/main.css @@ -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; +} diff --git a/img/fondo.jpeg b/img/fondo.jpeg new file mode 100644 index 0000000..874553a Binary files /dev/null and b/img/fondo.jpeg differ diff --git a/img/images.jpeg b/img/images.jpeg new file mode 100644 index 0000000..3b5dec7 Binary files /dev/null and b/img/images.jpeg differ diff --git a/login.html b/login.html new file mode 100644 index 0000000..e281930 --- /dev/null +++ b/login.html @@ -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> diff --git a/main.html b/main.html index c0ca8fc..106248f 100644 --- a/main.html +++ b/main.html @@ -3,9 +3,44 @@ <head> <meta charset="UTF-8"> <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> <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> </html>