-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcaduser.php
More file actions
129 lines (123 loc) · 4.51 KB
/
caduser.php
File metadata and controls
129 lines (123 loc) · 4.51 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php session_start(); ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Bem-Vindo ao Education Life - Cadastre-se</title>
<link href="stylesheets/style.css" rel="stylesheet" type="text/css" />
<!--[if lte IE 8]>
<script src="js/html5.js" type="text/javascript"></script>
<![endif]-->
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready( function() {
$("#cadastro").validate({
// Define as regras
rules:{
sobrenome:{
required: true, minlength: 5
},
email:{
required: true, email: true
},
nascimento:{
required: true,minlength: 8
},
nome:{
required: true,minlength: 5
},
senha:{
required: true,minlength: 5
}
},
// Define as mensagens de erro para cada regra
messages:{
sobrenome:{
required: "Digite o seu nome",
minLength: "O seu nome deve conter, no mínimo, 5 caracteres"
},
email:{
required: "Digite o seu e-mail para contato",
email: "Digite um e-mail válido"
},
nascimento:{
required: "Digite a sua data de nascimento",
minLength: "Sua data de nascimento deve conter, no mínimo, 8 caracteres"
},
nome:{
required: "Digite o seu nome",
minLength: "O seu nome deve conter, no mínimo, 5 caracteres"
},
senha:{
required: "Digite a sua senha",
minLength: "sua senha nome deve conter, no mínimo, 5 caracteres"}
}
});
});</script>
</head>
<body>
<div id="topo"><a href="./" style="color:#FFF; margin-left:5px;">Voltar</a></div>
<div id="caduser">
<h2>Cadastro de Usuário.</h2><?php
if(isset($_SERVER['REQUEST_METHOD']) AND $_SERVER['REQUEST_METHOD'] == 'POST'){
extract($_POST);
include('classes/DB.class.php');
$emailInsert = sha1($email);
$verificar = DB::getConn()->prepare("SELECT `id` FROM `usuarios` WHERE `email`=?");
if($verificar->execute(array($emailInsert))){
if($verificar->rowCount()==1){
echo 'Este e-mail ja esta cadastrado em nosso sistema';
}else{
$senhaInsert = sha1($senha);
$inserir = DB::getConn()->prepare('INSERT INTO `usuarios` SET `email`=?, `senha`=?, `nome`=?, `sobrenome`=?,`nascimento`=?, `sexo`=?, `imagem`="default.png", `status`=0, `cadastro`=now(), `nivel`=0');
if($inserir->execute(array($emailInsert,$senhaInsert,$nome,$sobrenome,$nascimento,$sexo))){
header('Location: ./');
}
}
}
echo '</h3>';
}
?>
<blockquote><i>Atenção: Não esqueça de ler às regras de privacidade. <a href="politica.php">Clique aqui para visualizar</a></i></blockquote>
<form id="cadastro" name="cadastro" style="width:97%" action="" method="POST">
<fieldset>
<legend>Dados Pessoais</legend>
<table width="90%" border="0">
<tr>
<td class="aligntxtcad"><label for="sobrenome">Nome</label></td>
<td ><input type="text" name="sobrenome" size="50" required autofocus></td>
</tr>
<tr>
<td class="aligntxtcad"><label for="sexo">Sexo:</label></td>
<td ><select name="sexo" required><option name="sexo" value="masculino" selected>Masculino</option>
<option name="sexo" value="feminino">Feminino</option></select> </td>
</tr>
<tr>
<td class="aligntxtcad"><label for="email">E-mail:</label></td>
<td><input type="email" name="email" size="50" required></td>
<tr>
<td class="aligntxtcad"><label for="nascimento">Data de Nascimento:</label></td>
<td> <input type="date" name="nascimento" size="10" required></td>
</tr>
</table></fieldset><br />
<fieldset>
<legend>Conta</legend>
<table width="90%" border="0">
<tr>
<td class="aligntxtcad"><label for="nome">Nome de Exibição:</label></td>
<td><input type="text" name="nome" size="25" required></td>
</tr>
<tr>
<td class="aligntxtcad"><label for="senha">Senha:</label></td>
<td><input type="password" name="senha" size="20" required></td>
</tr>
</table>
</fieldset>
<h6 align="right">Todos os campos são obrigatórios.</h6>
<input class="submit" type="submit" value="Enviar" name="enviar" >
<input type="reset" name="limpardados" value="Limpar">
</form>
<br></div>
</body>
</html>