-
Notifications
You must be signed in to change notification settings - Fork 0
/
novo-usuario.php
104 lines (83 loc) · 4.38 KB
/
novo-usuario.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
require 'includes/autoloader.php';
use core\Database;
use core\Users;
if (isset($_POST['name'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
if (!empty($name) && !empty($email) && !empty($password)) {
try {
$database = new Database();
$registered = Users::isEmailRegistered($email, $database);
if (!$registered) {
$created = Users::addUser($name, $email, $password, $database);
}
$database = null;
} catch (PDOException $e) {
}
}
}
?>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<title>Novo usuário | EACHe sua república</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen" />
<link rel="stylesheet" type="text/css" href="css/basico-minified.css"/>
<link rel="canonical" href="http://eacherepublica.com.br/novo-usuario" />
</head>
<body>
<div id="wrapper">
<header>
<a href="http://eacherepublica.com.br/"><h1>EACH sua república</h1></a>
<p><a href="http://eacherepublica.com.br/">← Página inicial</a></p>
</header>
<div id="content">
<!-- Alerts -->
<?php if (isset($registered) && $registered) : ?>
<div class="alert alert-error">
<b>Abre o olho!</b> Esse e-mail já está registrado! Tente: <a href="http://eacherepublica.com.br/esqueci-minha-senha">Esqueci minha senha</a>.
</div>
<?php endif; ?>
<?php if (isset($created)) : if ($created) : ?>
<div class="alert alert-success">
<b>Eba!</b> Agora você é um dos nossos! Comece já: insira as repúblicas que você conhece!
</div>
<?php else : ?>
<div class="alert alert-error">
<b>Ah!</b> Algum erro ocorreu e seu cadastro não pôde ser finalizado. Tente novamente mais tarde.
</div>
<?php endif; endif; ?>
<!--/ Alerts -->
<h2>Novo usuário</h2>
<form name="registry-form" action="" method="post" onsubmit="return verifyUserRegistration();">
<label for="name-field" class="required">Nome</label> <span class="label label-important">Obrigatório</span>
<input type="text" name="name" id="name-field" class="input-block-level" required /><br />
<label for="email-field" class="required">E-mail</label> <span class="label label-important">Obrigatório</span>
<input type="email" name="email" id="email-field" class="input-block-level" required /><br />
<label for="pass-field" class="required">Senha</label> <span class="label label-important">Obrigatório</span>
<input type="password" name="password" id="pass-field" class="input-block-level" required /><br />
<label for="confirm-pass-field" class="required">Confirmação da senha</label> <span class="label label-important">Obrigatório</span>
<input type="password" id="confirm-pass-field" class="input-block-level" required /><br />
<button type="submit" class="btn btn-info">Registrar</button>
</form>
</div>
</div>
<script type="text/javascript" src="js/verify-form-minified.js"></script>
<!-- Google Analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-29750007-3']);
_gaq.push(['_setDomainName', 'eacherepublica.com.br']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<!--/ Google Analytics -->
</body>
</html>