Primeiro Commit

parents
<?php
require('DbCOnnection.php');
if(empty($_POST['id'])){
salvarUsuario(formToArray());
}
else
{
}
function salvarUsuario($user)
{
$values = implode(',',$user);
$sql = "INSERT INTO tbUser (nome,email,senha) values ({$values}) ";
$result = mysql_query($sql);
if(!$result)
{
echo 'ERRO ao se cadastrar';
exit;
}
}
function atulizarUsuario()
{
}
function formToArray()
{
$user = array();
$user['nome'] = isset($_POST['nome']) ? $_POST['nome'] : "";
$user['email'] = isset($_POST['email']) ? $_POST['nome'] : "";
$user['senha'] = isset($_POST['senha']) ? $_POST['senha'] : "";
return $user;
}
function ehSenhaIgual()
{
return $_POST['senha'] == $_POST['confirmarSenha'];
}
?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.5.0/pure-min.css">
</head>
<body>
<form method="post" class="pure-form pure-form-stacked">
<fieldset>
<input type="text" name="nome" placeholder="Nome"/>
<input type="text" name="email" placeholder="Email" />
<input type="password" name="senha" placeholder="Senha"/>
<input type="password" name="confirmarSenha" placeholder="Confirme a senha"/>
<input type="submit" value="Cadastrar" class="pure-button pure-button-primary"/>
<input type="hidden" name="id" value=""/>
</fieldset>
</form>
</body>
</html>
<!--
-->
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.5.0/pure-min.css">
</head>
<body>
<form method="post" class="pure-form">
<input type="text" name="login" placeholder="Login"/>
<input type="password" name="senha" placeholder="Senha" />
<input type="submit" class="pure-button pure-button-primary" name="enviar" value="Logar"/>
</form>
<br>
<a href="cadastro.php" class="pure-button pure-button-primary">Cadastre-se</a>
</body>
</html>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.5.0/pure-min.css">
</head>
<body>
<div>
<form method="get" class="pure-form">
<input type="text" name="busca" placeholder="Pesquisar">
<input type="submit" class="pure-button pure-button-primary" name="busca" value="Pesquisar">
<input type="reset" class="pure-button" name="busca" value="Limpar">
</form>
</div>
<div>
<a href="cadastro.php" class="pure-button">Novo</a>
</div>
<table class="pure-table">
<thead>
<tr>
<th>Nome</th>
<th>Email</th>
<th>Login</th>
<th>Ações</th>
</tr>
</thead>
<tr>
<td>Jill</td>
<td>email@email.com</td>
<td>jill2310</td>
<td>
<a href="cadastro.php" class="pure-button">Atualizar</a>
<a href="cadastro.php" class="pure-button">Remover</a>
</td>
</tr>
<tr>
<td>Eve</td>
<td>email2@email.com</td>
<td>eve10</td>
<td>
<a href="cadastro.php" class="pure-button">Atualizar</a>
<a href="cadastro.php" class="pure-button">Remover</a>
</td>
</tr>
</table>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment