Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SISTEMA DE CADASTRO:
- <?php
- require_once "config.php";
- ?>
- <html>
- <head>
- <meta http-equiv="conten-type" content="text/html, charset-utf-8">
- <title>VIDEO - CADASTRO COM PHP</title>
- <link rel="stylesheet" type="text/css" href="estilo.css">
- </head>
- <body>
- <div id="cadastro">
- <form method="post" action="?go=cadastrar">
- <table id="cad_table">
- <tr>
- <td>nome:</td>
- <td><input type="text" name="nome" id="nome" class="txt"/></td>
- </tr>
- <tr>
- <td>Email:</td>
- <td><input type="text" name="email" id="email" class="txt"/></td>
- </tr>
- <tr>
- <td>Usuario:</td>
- <td><input type="text" name="usuario" id="usuario" class="txt" maxlenght="15"/></td>
- </tr>
- <tr>
- <td>Senha:</td>
- <td><input type="password" name="senha" id="senha" class="txt" maxlenght="15"/></td>
- </tr>
- <tr>
- <td colspan="2"><input type="submit" value="cadastrar" id="btncad"></td>
- </tr>
- </table>
- </form>
- </div>
- </body>
- </html>
- <?php
- if(@$_GET['go'] == 'cadastrar'){
- $nome = $_POST['nome'];
- $email = $_POST['email'];
- $user = $_POST['usuario'];
- $pwd = $_POST['senha'];
- if(empty($nome)){
- echo "<script>alert('Preencha todos os campos para se cadastrar.');history.back();</script>";
- }else if(empty($email)){
- echo "<script>alert('Preencha todos os campos para se cadastrar.');history.back();</script>";
- }else if(empty($user)){
- echo "<script>alert('Preencha todos os campos para se cadastrar.');history.back();</script>";
- }else if(empty($pwd)){
- echo "<script>alert('Preencha todos os campos para se cadastrar.');history.back();</script>";
- }else{
- $queryl = @mysql_num_rows(mysql_query("SELECT * FROM USUARIO WHERE USUARIO = '$USER'"));
- if($queryl == 1){
- echo "<script>alert('Usuario ja existe.'); history.back();</script>";
- }else{
- @mysql_query("insert into usuario (nome,email,usuario,senha) values ('$nome','$email','$user','$pwd')");
- echo "<script>alert('Usuario cadastrado com sucesso.');</script>";
- echo "<meta http-equiv= 'refresh' content='0', url='cadasto.php'>";
- }
- }
- }
- ?>
- SISTEMA DE LOGIN:
- <?php
- require_once "config.php";
- ?>
- <html>
- <head>
- <meta http-equiv="conten-type" content="text/html, charset-utf-8">
- <title>VIDEO - CADASTRO COM PHP</title>
- <link rel="stylesheet" type="text/css" href="estilo.css">
- </head>
- <body>
- <div id="cadastro">
- <form method="post" action="?go=logar">
- <table id="cad_table">
- <tr
- > <td>Usuario:</td>
- <td><input type="text" name="usuario" id="usuario" class="txt" maxlenght="15"/></td>
- </tr>
- <tr>
- <td>Senha:</td>
- <td><input type="password" name="senha" id="senha" class="txt" maxlenght="15"/></td>
- </tr>
- <tr>
- <td colspan="2"><input type="submit" value="Entrar" class="btn" id="btnCad"></td>
- </tr>
- </table>
- </form>
- </div>
- </body>
- </html>
- <?php
- if(@$_GET['go'] == 'logar'){
- $usuario = $_POST['usuario'];
- $senha = $_POST['senha'];
- if(empty($user)){
- echo "<script>alert('Preencha todos os campos para logar-se.');history.back();</script>";
- }else if(empty($pwd)){
- echo "<script>alert('Preencha todos os campos para se cadastrar.');history.back();</script>";
- }else{
- $queryl = @mysql_num_rows(mysql_query("SELECT * FROM USUARIO WHERE USUARIO = '$usuario' AND SENHA = '$senha' "));
- if($queryl == 1){
- echo "<script>alert('Usuario logado com sucesso.');</script>";
- echo "header('location: https://vittruvio.com.br/'.$usuario);";
- }else{
- echo "<script>alert('usuario e senha nao correspondem!');</script>";
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement