Advertisement
Guest User

cadastrar.php

a guest
May 24th, 2012
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4.  
  5. <?php
  6.  
  7. $conexao = mysql_connect('localhost', 'root', '3630207')
  8. or die('Erro ao conectar com o bando de dados!');
  9. $db = mysql_select_db('informacoes')
  10. or die('Erro ao selecionar o banco de dados!');
  11.  
  12. ?>
  13.  
  14.  
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  16. <title>Cadastro de contas</title>
  17. </head>
  18.  
  19. <body>
  20.  
  21. <h1><strong>CADASTRO DE USUÁRIOS</strong></h1>
  22. <form name="cadastrar" action="" method="post" enctype="multipart/form-data">
  23. <h3>Usuário:
  24. <input name="usuario" type="text" value="Usuario" />
  25. </h3>
  26. <h3>
  27. Senha:
  28. <input name="senha" type="password" />
  29. </h3>
  30. <h3>
  31. Score:
  32. <input name="score" type="text" value="Score" />
  33. </h3>
  34. <h3>Dinheiro:
  35. <input name="dinheiro" type="text" value="Dinheiro" />
  36. </h3>
  37. <h3>
  38. Avisos:
  39. <input name="avisos" type="text" value="Avisos" />
  40. </h3>
  41. <h3>
  42. Nivel:
  43. <input name="nivel" type="text" value="Nivel" />
  44. </h3>
  45. <h3>
  46. Vip:
  47. <input name="vip" type="text" value="Vip" />
  48. </h3>
  49. <h3>
  50. Skin:
  51.  
  52. <input name="skin" type="text" value="Skin" />
  53. </h3>
  54. <h3>
  55. Admin:
  56. <input name="admin" type="text" value="Admin" />
  57. </h3>
  58. <h3>
  59. <input type="submit" name="cadastrar" value="Cadastrar"/>
  60. </h3>
  61. </form>
  62.  
  63. <form action="index.php">
  64. <input type="submit" name="voltar" value="Voltar"/>
  65.  
  66. </form>
  67.  
  68. <?php if(isset($_POST['cadastrar']))
  69. {
  70.  
  71. $usuario = $_POST['usuario'];
  72. $senha = $_POST['senha'];
  73. $score = $_POST['score'];
  74. $dinheiro = $_POST['dinheiro'];
  75. $avisos = $_POST['avisos'];
  76. $nivel = $_POST['nivel'];
  77. $vip = $_POST['vip'];
  78. $skin = $_POST['skin'];
  79. $admin = $_POST['admin'];
  80.  
  81. if($usuario == ''){
  82. echo 'Campo usuário está em branco! Preencha!';
  83. }else if($senha == ''){
  84. echo 'Campo senha está em branco! Preencha!';
  85. }else if($score == ''){
  86. echo 'Campo score está em branco! Preencha!';
  87. }else if($dinheiro == ''){
  88. echo 'Campo dinheiro está em branco! Preencha!';
  89. }else if($avisos == ''){
  90. echo 'Campo avisos está em branco! Preencha!';
  91. }else if($nivel == ''){
  92. echo 'Campo nivel está em branco! Preencha!';
  93. }else if($vip == ''){
  94. echo 'Campo vip está em branco! Preencha!';
  95. }else if($skin == ''){
  96. echo 'Campo skin está em branco! Preencha!';
  97. }else if($admin == ''){
  98. echo 'Campo score está em branco! Preencha!';
  99. }else{
  100.  
  101. $inserir = mysql_query("INSERT INTO informacoes (usuario, senha, score, dinheiro, avisos, nivel, vip, skin, admin) VALUES ('$usuario', '$senha', '$score', '$dinheiro', '$avisos', '$nivel', '$vip', '$skin', '$admin')");
  102.  
  103. if($inserir == '')
  104. {
  105. echo 'Erro ao cadastrar usuário!';
  106. }
  107. else
  108. {
  109. echo 'Cadastro efetuado com sucesso!';
  110. }
  111. } // fechando else
  112. }
  113. ?>
  114. </body>
  115. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement