COMO HAGO QUE MI LOGIN ENTRE A MI PAGINA WEB
Publicado por Gibran (1 intervención) el 15/08/2020 08:34:55
AMIGOS HOY VENGO POR SU AYUDA ESTOY DESESPERADO, COMO HAGO QUE MI LOGIN ENTRE A MI PAGINA WEB EJEMPLO: INICIAS SESIÓN EN FACEBOOK Y YA PUEDES ENTRAR
Y CREAR UNA BASE DE DATOS PARA LOS USUARIOS PARA ENTRAR
USANDO HTML, PHP Y MYSQL
LES DEJO MIS CODIGOS
HTML LOGIN
PHP PARA LOS USUARIOS
Y EN LA PAGINA QUE SE NECESITA PONER?
YO SOY NUEVO EN ESTE PEDUL
Y CREAR UNA BASE DE DATOS PARA LOS USUARIOS PARA ENTRAR
USANDO HTML, PHP Y MYSQL
LES DEJO MIS CODIGOS
HTML LOGIN
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
<meta name="generator" content="Jekyll v4.0.1">
<title>Acceso al sistema</title>
<link rel="canonical" href="https://getbootstrap.com/docs/4.5/examples/sign-in/">
<!-- Bootstrap core CSS -->
<link href="../assets/dist/css/bootstrap.css" rel="stylesheet">
<style>
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
</style>
<!-- Custom styles for this template -->
<link href="signin.css" rel="stylesheet">
</head>
<body class="text-center" background="https://i.pinimg.com/originals/65/97/03/6597030cc06dad1d682c14568b7b735c.jpg">
<form class="form-signin" action="login.php" method="GET">
<img class="mb-4" src= "../image/summer.png" alt="" width="400" height="200">
<h1 class="h3 mb-3 font-weight-normal">Inicia sesiòn</h1>
<label for="inputEmail" class="sr-only">Email</label>
<input name="email" id="inputEmail" class="form-control" placeholder="Email" required autofocus>
<label for="inputPassword" class="sr-only">Password</label>
<input name="password" id="inputPassword" class="form-control" placeholder="Password" required>
<div class="checkbox mb-3">
<label>
<input type="checkbox" value="remember-me"> Recuerdame
</label>
</div>
<button class="btn btn-lg btn-primary btn-block" type="submit">Iniciar</button>
<p class="mt-5 mb-3 text-muted">© 2017-2020</p>
</form>
</body>
</html>
PHP PARA LOS USUARIOS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
if (
!isset($_POST['correo_electronico'])
|| empty($_POST['correo_electronico'])
|| !filter_var($_POST['correo_electronico'], FILTER_VALIDATE_EMAIL)
|| !isset($_POST['password'])
|| empty($_POST['password'])
) {
header('Location: index.php?error=Escribe tu correo y password');
exit;
}
require_once './conexion.php';
$sql = 'select id_cliente,nombre_cliente,perfil, password from cliente where correo_electronico =:correo_electronico';
$sentencia = $conexion->prepare($sql, [PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY]);
$sentencia->execute([':correo_electronico'=>$_POST['correo_electronico']]);
$usuario =$sentencia->fetch(PDO::FETCH_ASSOC);
// el usuario existe?
if($usuario==false){
header('Location: index.php?error=Cliente no encontrado '.$_POST['correo_electronico']);
exit;
}
// echo($_POST['password'] .$usuario['password']);
// ¿contraseña coincide?
if (!password_verify($_POST['password'], $usuario['password'])) {
// header('Location: index.php?error=Usuario o password incorrectos');
// exit;
}
session_start();
$_SESSION['id']=$usuario['id_cliente'];
$_SESSION['nombre']=$usuario['nombre_cliente'];
$_SESSION['perfil']=$usuario['perfil'];
header('Location: inicio.php?info=Bienvenido '.$usuario['nombre_cliente']);
?>
YO SOY NUEVO EN ESTE PEDUL
Valora esta pregunta


0