Advertisement
Guest User

editar.php

a guest
May 24th, 2012
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 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. <?php
  5.  
  6. $conexao = mysql_connect('localhost', 'root', '3630207')
  7. or die('Erro ao conectar com o bando de dados!');
  8. $db = mysql_select_db('informacoes')
  9. or die('Erro ao selecionar o banco de dados!');
  10.  
  11. ?>
  12. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  13. <title>Exibir dados</title>
  14. </head>
  15.  
  16. <body>
  17. <h1>
  18. <?php if(isset($_POST['editar']))
  19. {
  20.  
  21. $usuario = $_POST['usuario'];
  22. $senha = $_POST['senha'];
  23. $score = $_POST['score'];
  24. $dinheiro = $_POST['dinheiro'];
  25. $avisos = $_POST['avisos'];
  26. $nivel = $_POST['nivel'];
  27. $vip = $_POST['vip'];
  28. $skin = $_POST['skin'];
  29. $admin = $_POST['admin'];
  30.  
  31. $atualiza = mysql_query("UPDATE informacoes SET usuario = '$usuario', senha = '$senha', score = '$score', dinheiro = '$dinheiro', avisos = '$avisos', nivel = '$nivel', vip = '$vip', skin = '$skin', admin = '$admin' WHERE usuario = '$usuario'");
  32.  
  33. if($atualiza == '')
  34. {
  35. echo 'Erro ao atualizar usuário.';
  36. }else
  37. {
  38. echo 'Dados atualizados com sucesso.';
  39. }
  40.  
  41. }?>
  42.  
  43.  
  44. <?php
  45.  
  46. $usuario = $_GET['usuario'];
  47. $seleciona = mysql_query("SELECT * FROM informacoes WHERE usuario = '$usuario'");
  48.  
  49. if($seleciona == ''){
  50. echo 'Erro ao selecionar usuario!';
  51. }else{
  52. while($res_usuario = mysql_fetch_array($seleciona))
  53. {
  54. $usuario = $res_usuario['usuario'];
  55. $senha = $res_usuario['senha'];
  56. $score = $res_usuario['score'];
  57. $dinheiro = $res_usuario['dinheiro'];
  58. $avisos = $res_usuario['avisos'];
  59. $nivel = $res_usuario['nivel'];
  60. $vip = $res_usuario['vip'];
  61. $skin = $res_usuario['skin'];
  62. $admin = $res_usuario['admin'];
  63. ?>EDIÇÃO DE USUÁRIOS
  64.  
  65. </h1>
  66. <form name="editar" action="" enctype="multipart/form-data" method="post">
  67.  
  68. <input name="usuario" type="text" disabled="disabled" value="<?php echo $usuario; ?>" />
  69. <input type="text" name="senha" value="<?php echo $senha; ?>" />
  70. <input type="text" name="score" value="<?php echo $score; ?>" />
  71. <input type="text" name="dinheiro" value="<?php echo $dinheiro; ?>" />
  72. <input type="text" name="avisos" value="<?php echo $avisos; ?>" />
  73. <input type="text" name="nivel" value="<?php echo $nivel; ?>" />
  74. <input type="text" name="vip" value="<?php echo $vip; ?>" />
  75. <input type="text" name="skin" value="<?php echo $skin; ?>" />
  76. <input type="text" name="admin" value="<?php echo $admin; ?>" />
  77. <input type="hidden" name="usuario" value="<?php echo $usuario; ?>" />
  78. <input type="submit" name="editar" value="editar" />
  79. </form>
  80.  
  81. <form name="voltar" action="index.php">
  82. <input type="submit" name="Voltar" value="Voltar" />
  83.  
  84. </form>
  85.  
  86.  
  87. <?php
  88. }
  89. }
  90.  
  91. ?>
  92. </body>
  93. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement