forked from assembler-institute/php-server-environment
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate.php
More file actions
32 lines (23 loc) · 830 Bytes
/
validate.php
File metadata and controls
32 lines (23 loc) · 830 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
<?php
session_start();
$username = $_POST['username'];
$password = $_POST['password'];
$user = "wilson";
$pass = "españita";
if(isset($_SESSION['username'])){
header("Location: panel.php");
}else {
if($username == "" || $password == ""){
$_SESSION["errorVacio"] = "<b>Error:</b> Tienes que rellenar el formulario";
header("Location: index.php");
}
if(($username != $user && $username!="") || ($password != $pass && $password!="")){
$_SESSION["errorSession"] = "<b>Error:</b> El Username o el Password son incorrecto, por favor vuelve a intentarlo";
header("Location: index.php");
}
if ($username == $user && $password == $pass) {
$_SESSION['username']=$user;
$_SESSION['password']=$pass;
header("Location: panel.php");
}
}