PageRenderTime 76ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/ajustesemail.php

https://gitlab.com/manuperazafa/habbofa2
PHP | 216 lines | 200 code | 12 blank | 4 comment | 11 complexity | f89438a886d269e8bed75c57de077ed6 MD5 | raw file
  1. <?php
  2. require_once ('heliocms/core.php');
  3. require_once ('heliocms/session.php');
  4. require_once ('web/templates/header.php');
  5. if ($_GET['save'] == "$w") {
  6. $message = '<div class="msg"><b>EXITO!</b> has actualizado tu perfil correctamente</div>';
  7. }
  8. $profilevisible_a = mysql_query("SELECT * FROM heliocms_profilesettings WHERE email='$user_q[mail]'");
  9. $profilevisible_q = mysql_fetch_assoc($profilevisible_a);
  10. if (isset($_POST['save'])) {
  11. $password = $_POST['passwordCurrent'];
  12. $email = $_POST['emailAddress'];
  13. $password_verify = mysql_query("SELECT * FROM users WHERE mail='$user_q[mail]' AND password='".MD5($password)."'");
  14. $emailaddress_verify = mysql_query ("SELECT * FROM users WHERE mail='$email'");
  15. if (empty($password)) {
  16. $error = '1';
  17. $passwordcurrent_errors_2 = '<div class="box-rojo">Este campo es obligatorio.</div>';
  18. $passwordcurrent_class = 'form__input password-toggle-mask ng-valid-password-name ng-valid-password-email ng-valid-maxlength ng-dirty ng-valid-parse ng-touched ng-valid-password-pattern ng-invalid ng-valid-required ng-invalid-minlength';
  19. }else{
  20. if (mysql_num_rows($password_verify) == 0) {
  21. $error = '1';
  22. $passwordcurrent_errors = '<div class="box-rojo">Vaya, la contraseña no es correcta. ¡Inténtalo de nuevo!</div>';
  23. $passwordcurrent_class = 'form__input ng-invalid ng-dirty ng-invalid-email ng-valid-required ng-touched';
  24. }}
  25. if (mysql_num_rows($emailaddress_verify) == 1) {
  26. $error = '1';
  27. $emailaddress_errors = '<div class="box-rojo">El email ya está en uso, por favor usa otra dirección.</div>';
  28. $emailaddress_class = 'form__input ng-invalid ng-dirty ng-invalid-email ng-valid-required ng-touched';
  29. }else{
  30. if (empty($email)) {
  31. $error = '1';
  32. $emailaddress_errors_2 = '<div class="box-rojo">Este campo es obligatorio.</div>';
  33. $emailaddress_class = 'form__input ng-invalid ng-dirty ng-invalid-email ng-valid-required ng-touched';
  34. }else{
  35. if (!preg_match("/^[A-Z0-9._-]{2,}+@[A-Z0-9._-]{2,}\.[A-Z0-9._-]{2,}$/i", $email)) {
  36. $error = '1';
  37. $emailaddress_errors = '<div class="box-rojo">Necesitas un email válido.</div>';
  38. $emailaddress_class = 'form__input ng-invalid ng-dirty ng-invalid-email ng-valid-required ng-touched';
  39. }}}
  40. if ($error <> 1) {
  41. mysql_query ("UPDATE users SET mail='$email' WHERE mail='$user_q[mail]'");
  42. mysql_query ("UPDATE heliocms_avatars SET parent_email='$email' WHERE parent_email='$user_q[mail]'");
  43. mysql_query ("UPDATE heliocms_safetyquestions SET email='$email' WHERE email='$user_q[mail]'");
  44. mysql_query ("UPDATE heliocms_profilesettings SET email='$email' WHERE email='$user_q[mail]'");
  45. header ("Location: $site/ajustes/correo?save=$w");
  46. }}
  47. ?>
  48. <style>
  49. .msg {
  50. color: #fff;
  51. background: green;
  52. padding: 5px;
  53. width: 100%;
  54. }
  55. input {
  56. background-color: transparent !important;
  57. border: 1px solid #ccc !important;
  58. border-radius: 0;
  59. height: 20px !important;
  60. outline: none;
  61. width: 50% !important;
  62. }
  63. input:focus {border-bottom: none 1px solid #ccc;box-shadow: none !important;}
  64. [type="radio"]:checked+label:after, [type="radio"].with-gap:checked+label:after {background-color: #424242 !important;}
  65. [type="radio"]:checked+label:after, [type="radio"].with-gap:checked+label:before, [type="radio"].with-gap:checked+label:after {border: 2px solid #424242 !important;}
  66. [type="radio"]:not(:checked)+label, [type="radio"]:checked+label {padding-left: 25px !important;}
  67. #slideselector {
  68. position: absolue;
  69. top:0;
  70. left:0;
  71. border: 2px solid black;
  72. padding-top: 1px;
  73. }
  74. .slidebutton {
  75. height: 21px;
  76. margin: 2px;
  77. }
  78. #slideshow {
  79. margin: 50px auto;
  80. position: relative;
  81. width: 240px;
  82. height: 240px;
  83. padding: 10px;
  84. box-shadow: 0 0 20px rgba(0,0,0,0.4);
  85. }
  86. #slideshow > div {
  87. position: absolute;
  88. top: 10px;
  89. left: 10px;
  90. right: 10px;
  91. bottom: 10px;
  92. overflow:hidden;
  93. }
  94. .imgLike {
  95. width:100%;
  96. height:100%;
  97. }
  98. /* Radio */
  99. input[type="radio"] {
  100. background-color: #ddd;
  101. background-image: -webkit-linear-gradient(0deg, transparent 20%, hsla(0,0%,100%,.7), transparent 80%),
  102. -webkit-linear-gradient(90deg, transparent 20%, hsla(0,0%,100%,.7), transparent 80%);
  103. border-radius: 10px;
  104. box-shadow: inset 0 1px 1px hsla(0,0%,100%,.8),
  105. 0 0 0 1px hsla(0,0%,0%,.6),
  106. 0 2px 3px hsla(0,0%,0%,.6),
  107. 0 4px 3px hsla(0,0%,0%,.4),
  108. 0 6px 6px hsla(0,0%,0%,.2),
  109. 0 10px 6px hsla(0,0%,0%,.2);
  110. cursor: pointer;
  111. display: inline-block;
  112. height: 15px;
  113. margin-right: 15px;
  114. position: relative;
  115. width: 15px;
  116. -webkit-appearance: none;
  117. }
  118. input[type="radio"]:after {
  119. background-color: #444;
  120. border-radius: 25px;
  121. box-shadow: inset 0 0 0 1px hsla(0,0%,0%,.4),
  122. 0 1px 1px hsla(0,0%,100%,.8);
  123. content: '';
  124. display: block;
  125. height: 7px;
  126. left: 4px;
  127. position: relative;
  128. top: 4px;
  129. width: 7px;
  130. }
  131. input[type="radio"]:checked:after {
  132. background-color: #f66;
  133. box-shadow: inset 0 0 0 1px hsla(0,0%,0%,.4),
  134. inset 0 2px 2px hsla(0,0%,100%,.4),
  135. 0 1px 1px hsla(0,0%,100%,.8),
  136. 0 0 2px 2px hsla(0,70%,70%,.4);
  137. }
  138. .mercuryzero_btn {
  139. background: #fff;
  140. border: 3px solid #000;
  141. border-bottom: 5px solid #000;
  142. border-radius: 4px;
  143. font-weight: 600;
  144. padding: 2px 13px;
  145. }
  146. .box-rojo {
  147. width: 60%;
  148. background: rgba(255, 0, 0, 0.64);
  149. color: #fff;
  150. border-radius: 3px;
  151. text-align: center;
  152. }
  153. </style>
  154. <div class="container">
  155. <div class="row">
  156. <div class="col s12 m3">
  157. <div class="card blue-white darken-1" style="border-radius: 5px;">
  158. <div class="box-blue" style="background: #424242;">
  159. <div class="title">Ajustes</div>
  160. </div>
  161. <div class="card-content black-text" style="padding: 0px 20px 2px 20px;">
  162. <a href="<?php echo $site; ?>/ajustes/perfil" style="color: #000;">Mi perfil</a><br>
  163. <b><a href="<?php echo $site; ?>/ajustes/correo" style="color: #000;">Email y verificaci&oacute;n</a><br></b>
  164. <a href="<?php echo $site; ?>/ajustes/contrasena" style="color: #000;">Mi contrase&ntilde;a</a><br>
  165. </div>
  166. </div>
  167. </div>
  168. <div class="col s12 m9">
  169. <div class="card blue-white darken-1" style="border-radius: 5px;">
  170. <div class="box-blue" style="background: #424242;">
  171. <div class="title">Correo electr&oacute;nico</div>
  172. </div>
  173. <div class="card-content black-text" style="padding: 0px 20px 2px 20px;">
  174. <?php echo $message; ?>
  175. <form name="emailChangeForm" method="post">
  176. <p>
  177. <br>
  178. Tu correo electr&oacute;nico actual: <?php echo $user_q['mail']; ?>
  179. <br>
  180. <br>
  181. <hr>
  182. </p>
  183. <p>
  184. <b>Nuevo email</b><br>
  185. <?php echo $emailaddress_errors; ?>
  186. <?php echo $emailaddress_errors_2; ?>
  187. Introduce un correo v&aacute;lido por si pierdes tu contrase&ntilde;a o la newlestter de <?php echo $sitename; ?> Hotel<br>
  188. Correo: <input name="emailAddress" value="<?php echo $email; ?>">
  189. </p>
  190. <p>
  191. <b>Contrase&ntilde;a</b><br>
  192. <?php echo $passwordcurrent_errors_2; ?>
  193. <?php echo $passwordcurrent_errors; ?>
  194. Por metodos de seguridad pedimos que introduzcas tu contrase&ntilde;a<br>
  195. Contrase&ntilde;a: <input type="password" name="passwordCurrent" value="<?php echo $password; ?>">
  196. </p>
  197. <button type="submit" class="mercuryzero_btn" name="save">Salvar cambios</button>
  198. </form>
  199. </div>
  200. </div>
  201. </div>
  202. </div>
  203. </div>
  204. <?php require_once 'web/templates/footer.php'; ?>