Advertisement
Guest User

Untitled

a guest
Jan 25th, 2016
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.38 KB | None | 0 0
  1.  
  2. <?php
  3. session_start();
  4. $user_id = $_SESSION['user_id'];
  5. ?>
  6. <!DOCTYPE html>
  7.  
  8. <html>
  9. <head>
  10. <meta name="viewport" content="width=425px, user-scalable=no">
  11.  
  12. <link rel="stylesheet" href="css/bootstrap.min.css">
  13. <link rel="stylesheet" href="css/style.css">
  14. <title>Twitter Tecnologías Web</title>
  15. <script type="text/javascript" src="js/validaciones.js">
  16. </script>
  17. </head>
  18. <body style="margin-left:20px;width:300px;zoom:125%;">
  19. <form action="modprofile.php" method="POST" role="form" style="width:300px;">
  20. <h3>Twitter Tecnologías Web</h3>
  21. <h4>Modificar Perfil</h4>
  22. <?php
  23. if($_POST['btn']=="submit-modifier-form"){
  24. if($_POST['userfullname']!="" && $_POST['email']!="" && $_POST['username']!="" && $_POST['password']!="" && $_POST['confirm-password']!=""){
  25. if($_POST['password']==$_POST['confirm-password']){
  26. include 'connect.php';
  27. $username = strtolower($_POST['username']);
  28. $query = mysql_query("UPDATE users
  29. SET
  30. username='$username'
  31. WHERE user_id=='$user_id'");
  32. $userfullname =($_POST['userfullname']);
  33. $query = mysql_query("UPDATE users
  34. SET
  35. userfullname='$userfullname'
  36. WHERE user_id=='$user_id'");
  37. $email = strtolower($_POST['email']);
  38. $query = mysql_query("UPDATE users
  39. SET
  40. email='$email'
  41. WHERE user_id=='$user_id'");
  42. $password = strtolower($_POST['password']);
  43. $query = mysql_query("UPDATE users
  44. SET
  45. password='$password'
  46. WHERE user_id=='$user_id'");
  47. mysql_close($conn);
  48. if(!(mysql_num_rows($query)>=1)){
  49. $password = md5($_POST['password']);
  50. include 'connect.php';
  51. mysql_query("INSERT INTO users(userfullname, email, username, password)
  52. VALUES ('$userfullname','$email','$username', '$password')
  53. ");
  54. mysql_close($conn);
  55. echo "<div class='alert alert-success'>Usuario Modificado con exito!</div>";
  56. echo "<a href='.' style='width:300px;' class='btn btn-info'>Volver al inicio</a>";
  57. echo "</form>";
  58. echo "<br>";
  59. echo "<div class='jumbotron' style='padding:3px;'>
  60. <div class='container'>
  61. <h5>Hecho por <a href='http://www.artregresion.com'>Javier Anaya</a></h5>
  62. <h5>Trabajo Final Tecnologias web</h5>
  63. </div>
  64. </div>";
  65. echo "</body>";
  66. echo "</html>";
  67. exit;
  68.  
  69. }
  70. else{
  71. $error_msg="El usuario ya existe¡¡ prueba con otro";
  72. }
  73. }
  74. else{
  75. $error_msg="Las conrtraseñas no coinciden";
  76. }
  77. }
  78. else{
  79. $error_msg="Rellene todos los campos porfavor.";
  80. }
  81. }
  82.  
  83. ?>
  84. <input type="text" class="form-control" placeholder="Nuevo Nombre" name="userfullname" value="<?php echo $_POST['userfullname']; ?>"><br>
  85. <input type="email" class="form-control" placeholder="Nuevo E-mail" name="email" id="email" onblur="validaEmail()"><br>
  86. <div class="input-group" style="margin-bottom:10px;">
  87. <span class="input-group-addon">@</span>
  88. <input type="text" class="form-control" placeholder="Nuevo Nickname" name="username" value="<?php echo $_POST['username']; ?>">
  89. </div>
  90. <input type="password" style="margin-bottom:10px;" class="form-control" placeholder="Nueva Contraseña" name="password">
  91. <input type="password" style="margin-bottom:10px;" class="form-control" placeholder="Confirmar Contraseña" name="confirm-password">
  92. <?php
  93. if($error_msg){
  94. echo "<div class='alert alert-danger'>".$error_msg."</div>";
  95. }
  96. ?>
  97. <button type="submit" style="width:300px; margin-bottom:5px;" class="btn btn-success" name="btn" value="submit-modifier-form">Guardar Cambios</button>
  98. <a href="." style="width:300px;" class="btn btn-info">Volver al Inicio</a>
  99. </form>
  100. <br>
  101. <div class="jumbotron" style="padding:3px;">
  102. <div class="container">
  103. <h5>Hecho por <a href="http://www.artregresion.com">Javier Anaya</a></h5>
  104. <h5>Trabajo Final Tecnologías web</h5>
  105. </div>
  106. </div>
  107. </body>
  108. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement