-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidateUser.php
More file actions
33 lines (26 loc) · 1000 Bytes
/
Copy pathvalidateUser.php
File metadata and controls
33 lines (26 loc) · 1000 Bytes
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
<?php
$correo = $_POST['correo'];
$password = $_POST['password'];
session_start();
include('includes/dbh.inc.php');
$consult_email = "SELECT * FROM usuario WHERE emailUsuario = '$correo'";
$result = mysqli_query($conn, $consult_email);
$findEmail = mysqli_num_rows($result);
$searchColumn = mysqli_fetch_assoc($result);
$name = $searchColumn['nombreUsuario'];
$lastname = $searchColumn['apellidoUsuario'];
$username = $name . ' ' . $lastname;
$pass2 = $searchColumn['claveUsuario'];
if ($findEmail === 0) {
$_SESSION['notificacion'] = '<div class="notification is-danger">Correo no válido o no existente.</div>';
header("location:login.php");
}else if(strcmp($password, $pass2) === 0){
$_SESSION['nombreUsuario'] = $username;
$_SESSION['correo'] = $correo;
header("location:index.php");
}else{
echo "Error de sesion";
}
mysqli_free_result($result);
mysqli_close($conn);
?>