Advertisement
Guest User

Untitled

a guest
Jan 10th, 2016
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1. SISTEMA DE CADASTRO:
  2.  
  3. <?php
  4. require_once "config.php";
  5. ?>
  6. <html>
  7. <head>
  8. <meta http-equiv="conten-type" content="text/html, charset-utf-8">
  9. <title>VIDEO - CADASTRO COM PHP</title>
  10. <link rel="stylesheet" type="text/css" href="estilo.css">
  11. </head>
  12. <body>
  13.  
  14. <div id="cadastro">
  15. <form method="post" action="?go=cadastrar">
  16. <table id="cad_table">
  17. <tr>
  18. <td>nome:</td>
  19. <td><input type="text" name="nome" id="nome" class="txt"/></td>
  20. </tr>
  21. <tr>
  22. <td>Email:</td>
  23. <td><input type="text" name="email" id="email" class="txt"/></td>
  24. </tr>
  25. <tr>
  26. <td>Usuario:</td>
  27. <td><input type="text" name="usuario" id="usuario" class="txt" maxlenght="15"/></td>
  28. </tr>
  29. <tr>
  30. <td>Senha:</td>
  31. <td><input type="password" name="senha" id="senha" class="txt" maxlenght="15"/></td>
  32. </tr>
  33. <tr>
  34. <td colspan="2"><input type="submit" value="cadastrar" id="btncad"></td>
  35. </tr>
  36. </table>
  37. </form>
  38. </div>
  39.  
  40. </body>
  41. </html>
  42.  
  43. <?php
  44. if(@$_GET['go'] == 'cadastrar'){
  45. $nome = $_POST['nome'];
  46. $email = $_POST['email'];
  47. $user = $_POST['usuario'];
  48. $pwd = $_POST['senha'];
  49.  
  50. if(empty($nome)){
  51. echo "<script>alert('Preencha todos os campos para se cadastrar.');history.back();</script>";
  52. }else if(empty($email)){
  53. echo "<script>alert('Preencha todos os campos para se cadastrar.');history.back();</script>";
  54. }else if(empty($user)){
  55. echo "<script>alert('Preencha todos os campos para se cadastrar.');history.back();</script>";
  56. }else if(empty($pwd)){
  57. echo "<script>alert('Preencha todos os campos para se cadastrar.');history.back();</script>";
  58. }else{
  59. $queryl = @mysql_num_rows(mysql_query("SELECT * FROM USUARIO WHERE USUARIO = '$USER'"));
  60. if($queryl == 1){
  61. echo "<script>alert('Usuario ja existe.'); history.back();</script>";
  62. }else{
  63. @mysql_query("insert into usuario (nome,email,usuario,senha) values ('$nome','$email','$user','$pwd')");
  64. echo "<script>alert('Usuario cadastrado com sucesso.');</script>";
  65. echo "<meta http-equiv= 'refresh' content='0', url='cadasto.php'>";
  66. }
  67.  
  68. }
  69. }
  70.  
  71. ?>
  72.  
  73.  
  74. SISTEMA DE LOGIN:
  75.  
  76. <?php
  77. require_once "config.php";
  78. ?>
  79. <html>
  80. <head>
  81. <meta http-equiv="conten-type" content="text/html, charset-utf-8">
  82. <title>VIDEO - CADASTRO COM PHP</title>
  83. <link rel="stylesheet" type="text/css" href="estilo.css">
  84. </head>
  85. <body>
  86.  
  87. <div id="cadastro">
  88. <form method="post" action="?go=logar">
  89. <table id="cad_table">
  90. <tr
  91. > <td>Usuario:</td>
  92. <td><input type="text" name="usuario" id="usuario" class="txt" maxlenght="15"/></td>
  93. </tr>
  94. <tr>
  95. <td>Senha:</td>
  96. <td><input type="password" name="senha" id="senha" class="txt" maxlenght="15"/></td>
  97. </tr>
  98. <tr>
  99. <td colspan="2"><input type="submit" value="Entrar" class="btn" id="btnCad"></td>
  100. </tr>
  101. </table>
  102. </form>
  103. </div>
  104.  
  105. </body>
  106. </html>
  107.  
  108.  
  109.  
  110. <?php
  111. if(@$_GET['go'] == 'logar'){
  112. $usuario = $_POST['usuario'];
  113. $senha = $_POST['senha'];
  114.  
  115. if(empty($user)){
  116. echo "<script>alert('Preencha todos os campos para logar-se.');history.back();</script>";
  117. }else if(empty($pwd)){
  118. echo "<script>alert('Preencha todos os campos para se cadastrar.');history.back();</script>";
  119. }else{
  120.  
  121. $queryl = @mysql_num_rows(mysql_query("SELECT * FROM USUARIO WHERE USUARIO = '$usuario' AND SENHA = '$senha' "));
  122.  
  123. if($queryl == 1){
  124.  
  125.  
  126. echo "<script>alert('Usuario logado com sucesso.');</script>";
  127.  
  128. echo "header('location: https://vittruvio.com.br/'.$usuario);";
  129.  
  130. }else{
  131.  
  132. echo "<script>alert('usuario e senha nao correspondem!');</script>";
  133. }
  134.  
  135. }
  136. }
  137.  
  138. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement