-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.php
88 lines (66 loc) · 1.95 KB
/
signup.php
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
session_start();
if (isset($_SESSION['user_id'])) {
dashboard('Location: logout.php');
}
require 'database.php';
$message = '';
if (!empty($_POST['email']) && !empty($_POST['password']) && !empty($_POST['confirm_password'])) {
if($_POST['password'] == $_POST['confirm_password']){
$query = "SELECT id FROM USERS WHERE email ='".$_POST['email']."'";
$consul = mysqli_query($conn, $query);
$results = mysqli_fetch_array($consul);
if (count($results) == 0) {
$query = "INSERT INTO USERS (email, password) VALUES ('".$_POST['email']."' ,'".$_POST['confirm_password']."')";
$consul = mysqli_query($conn, $query);
$message = 'Successfully created new user';
}
else{
$message = 'El email ya existe';
}
}else{
$message="La contraseña no coincide";
}
}
else{
$message="Hay campos vacios, llene los campos";
}
?>
<!--echo "<script>alert('Recuerde diligenciar todos los campos');</script>";-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>PAMI Project V 0.0.1</title>
</head>
<body>
<?php if(!empty($message)): ?>
<p> <?= $message ?></p>
<?php endif; ?>
<form action="signup.php" method="POST" >
<span> Registro</span>
<h1>Registro</h1>
<span>O <a href="login.php">Inicie Sesion</a></span>
<div>
<input name="email" type="text" placeholder="Email">
</div>
<div >
<input name="password" type="password" placeholder="Ingrese Su Contraseña">
</div>
<div>
<input name="confirm_password" type="password" placeholder="Repita Su Contraseña">
</div>
<div >
<button>
Registrarse
</button>
</div>
</div>
</div>
</div>
</form>
</body>
<footer>
<p> © Blinter <a href="mailto:andres.david8.8@gmail.com"> Andago</a> <a href="mailto:velozasergio@gmail.com">Velosergio </a> 2018. Version 0.0.1</p>
</footer>
</html>