Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.14 KB | None | 0 0
  1. function alerta() {
  2. new $.Zebra_Dialog('<strong>Actualizacion del Usuario</strong><br><br>', {
  3. 'source': {'ajax': 'perfil/actualizar.php?nickP=<?php echo "$nick2" ?>'},
  4. width: 1000,
  5. buttons: false,
  6. animation_speed_show: 3000,
  7. animation_speed_hide: 3000,
  8. 'title': 'Actualizar'
  9. });
  10. }
  11.  
  12. <body>
  13. <?php
  14. $servername = "localhost";
  15. $username = "root";
  16. $password = "";
  17. $dbname = "proyecto_terror";
  18.  
  19. $conn = mysqli_connect($servername, $username, $password, $dbname);
  20.  
  21. $nick2 = $_GET["nickP"];
  22. $sql = "SELECT * FROM usuario WHERE nick = '" . $nick2 . "'";
  23. $result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
  24. $datos = array();
  25. if (mysqli_num_rows($result) > 0) {
  26. while ($row = mysqli_fetch_assoc($result)) {
  27. $datos[] = $row;
  28. ?>
  29.  
  30.  
  31. <div id="alerta" style="width: 100%;height: 100%; ">
  32.  
  33. <form id="formularin" method="POST" action="perfil/Update.php"><center><table class="formulario" id="tabla" >
  34. <tr>
  35.  
  36. <td><center><label >Nombre: </label></center></td>
  37. <td><input onkeypress="sololetras()" id="nombre" class="cajaTexto" value="<?php echo $row["nombre"]; ?>" name="nombre" type="text"></td>
  38.  
  39. </tr>
  40. <tr>
  41. <td><center><label >Nick:</label></center></td>
  42. <td><input maxlength="20" id="nick" class="cajaTexto" value="<?php echo $row["nick"]; ?>" name="nick" type="text"></td>
  43. </tr>
  44. <tr>
  45. <td><center>Cumpleaños: </center></td>
  46. <td>
  47. <span style="margin-left: 20px;margin-right: 10px;"> Dia: </span> <select name="dia" class="selector" id="dia">
  48. <option value="01">1</option>
  49. <option value="02">2</option>
  50. <option value="03">3</option>
  51. <option value="04">4</option>
  52. <option value="05">5</option>
  53. <option value="06">6</option>
  54. <option value="07">7</option>
  55. <option value="08">8</option>
  56. <option value="09">9</option>
  57. <option value="10">10</option>
  58. <option value="11">11</option>
  59. <option value="12">12</option>
  60. <option value="13">13</option>
  61. <option value="14">14</option>
  62. <option value="15">15</option>
  63. <option value="16">16</option>
  64. <option value="17">17</option>
  65. <option value="18">18</option>
  66. <option value="19">19</option>
  67. <option value="20">20</option>
  68. <option value="21">21</option>
  69. <option value="22">22</option>
  70. <option value="23">23</option>
  71. <option value="24">24</option>
  72. <option value="25">25</option>
  73. <option value="26">26</option>
  74. <option value="27">27</option>
  75. <option value="28">28</option>
  76. <option value="29">29</option>
  77. <option value="30">30</option>
  78. </select>
  79.  
  80. <span style="margin-left: 20px;margin-right: 10px;"> Mes: </span><select name="mes" class="selector" id="mes">
  81. <option value="01">Enero</option>
  82. <option value="02">Febrero</option>
  83. <option value="03">Marzo</option>
  84. <option value="04">Abril</option>
  85. <option value="05">Mayo</option>
  86. <option value="06">Junio</option>
  87. <option value="07">Julio</option>
  88. <option value="08"> Agosto</option>
  89. <option value="09">Septiembre</option>
  90. <option value="10">Octubre</option>
  91. <option value="11">Noviembre</option>
  92. <option value="12">Diciembre</option>
  93.  
  94. </select>
  95. <span style="margin-left: 20px;margin-right: 10px;"> Año: </span><input name="ano" class="spinnerT" id="ano" TYPE="NUMBER" MIN="1950" MAX="2006" STEP="1" VALUE="2000">
  96. </td>
  97. </tr>
  98. <tr>
  99. <td><center><label >Edad: </label></center></td>
  100. <td><input class="spinnerT" value="<?php echo $row["edad"]; ?>" id="edad" name="edad" TYPE="NUMBER" MIN="10" MAX="66" STEP="1" VALUE="20"></td>
  101. </tr>
  102. <tr>
  103. <td><center><label >Sexo: </label> </center></td>
  104. <td><div class="radio">
  105. <?php
  106. if ($row["sexo"] == "hombre") {
  107. ?>
  108. <input type = "radio" name = "sexo" value = "hombre" checked = "checked" id = "hombre">
  109. <label for = "hombre" >Hombre</label>
  110. <input type="radio" name="sexo" value="mujer" id="mujer">
  111. <label for="mujer">Mujer</label>
  112. <?php
  113. } else {
  114. ?>
  115. <input type = "radio" name = "sexo" value = "hombre" id = "hombre">
  116. <label for = "hombre" >Hombre</label>
  117. <input type="radio" name="sexo" value="mujer" checked = "checked" id="mujer">
  118. <label for="mujer">Mujer</label>
  119. <?php
  120. }
  121. ?>
  122.  
  123. </div>
  124. </tr>
  125. <tr>
  126. <td><center><label >Intereses: </label></center></td>
  127. <td>
  128. <div class="checkbox">
  129. <table >
  130.  
  131. <tr>
  132. <td> <input value="Asesinos" type="checkbox" id="checkbox1" name="checkbox[]"><label for="checkbox1" style="margin-right: 10px;">Asesinos</label>
  133. </td>
  134. <td> <input value="Misterios" type="checkbox" id="checkbox2" name="checkbox[]" ><label for="checkbox2" style="margin-right: 30px;">Misterios</label>
  135. </td>
  136. <td> <input value="Creppys" type="checkbox" id="checkbox3" name="checkbox[]" ><label for="checkbox3" style="margin-right: 10px;">Creppys</label>
  137. </td>
  138. </tr>
  139.  
  140. <tr>
  141. <td> <input value="Ovnis" type="checkbox" id="checkbox4" name="checkbox[]" ><label for="checkbox4" style="margin-right: 35px;">Ovnis</label>
  142. </td>
  143. <td> <input value="Enfermedades" type="checkbox" id="checkbox5" name="checkbox[]" ><label for="checkbox5" style="margin-right: -10px;">Enfermedades</label>
  144. </td>
  145. <td> <input value="Leyendas" type="checkbox" id="checkbox6" name="checkbox[]" ><label for="checkbox6" style="margin-right: 10px;">Leyendas</label>
  146. </td>
  147. </tr>
  148.  
  149.  
  150. <tr>
  151. <td> <input value="Fantasmas" type="checkbox" id="checkbox7" name="checkbox[]" ><label for="checkbox7" style="margin-right: -5px;">Fantasmas</label>
  152. </td>
  153. <td> <input value="Conspiraciones" type="checkbox" id="checkbox8" name="checkbox[]" ><label for="checkbox8" style="margin-right: -13px;">Conspiraciones</label>
  154. </td>
  155. <td> <input value="Deep-Web" type="checkbox" id="checkbox9" name="checkbox[]" ><label for="checkbox9" style="margin-right: 10px;">Deep Web</label>
  156. </td>
  157. </tr>
  158.  
  159. </table>
  160. <br>
  161. </div>
  162. </td>
  163. </tr>
  164. <tr>
  165. <td colspan="2"><center><button id="btnsave" style="margin-right: 20px;text-decoration: none;">Guardar<img src="../Imagenes/images/ICO/Mask 2.ico" style="width:20px;height: 20px;margin-top: -1px;margin-left: 3px;"></button>
  166. <button type="reset" id="btncancelar" >Cancelar<img src="../Imagenes/images/ICO/Jack O Lantern.ico" style="width:20px;height: 20px;margin-top: -1px;float: right;margin-right: 5px;"></button></center></td>
  167.  
  168. </tr>
  169. </table></center></form>
  170.  
  171. <?php
  172. }
  173. }
  174. mysqli_close($conn);
  175. ?>
  176. </div>
  177.  
  178. </body>
  179.  
  180. if ($_POST['checkbox'] != "") {
  181. if (is_array($_POST['checkbox'])) {
  182. while (list($key, $value) = each($_POST['checkbox'])) {
  183. if ($contador == 0) {
  184. $registro1 = $_POST['checkbox'][0];
  185. $registro2 = "";
  186. $registro3 = "";
  187. $registro4 = "";
  188. $registro5 = "";
  189. $registro6 = "";
  190. $registro7 = "";
  191. $registro8 = "";
  192. $registro9 = "";
  193. $contador++;
  194. } else if ($contador == 1) {
  195. $registro2 = $_POST['checkbox'][1];
  196. $registro3 = "";
  197. $registro4 = "";
  198. $registro5 = "";
  199. $registro6 = "";
  200. $registro7 = "";
  201. $registro8 = "";
  202. $registro9 = "";
  203. $contador++;
  204. } else if ($contador == 2) {
  205. $registro3 = $_POST['checkbox'][2];
  206. $registro4 = "";
  207. $registro5 = "";
  208. $registro6 = "";
  209. $registro7 = "";
  210. $registro8 = "";
  211. $registro9 = "";
  212. $contador++;
  213. } else if ($contador == 3) {
  214. $registro4 = $_POST['checkbox'][3];
  215. $registro5 = "";
  216. $registro6 = "";
  217. $registro7 = "";
  218. $registro8 = "";
  219. $registro9 = "";
  220. $contador++;
  221. } else if ($contador == 4) {
  222. $registro5 = $_POST['checkbox'][4];
  223. $registro6 = "";
  224. $registro7 = "";
  225. $registro8 = "";
  226. $registro9 = "";
  227. $contador++;
  228. } else if ($contador == 5) {
  229. $registro6 = $_POST['checkbox'][5];
  230. $registro7 = "";
  231. $registro8 = "";
  232. $registro9 = "";
  233. $contador++;
  234. } else if ($contador == 6) {
  235. $registro7 = $_POST['checkbox'][6];
  236. $registro8 = "";
  237. $registro9 = "";
  238. $contador++;
  239. } else if ($contador == 7) {
  240. $registro8 = $_POST['checkbox'][7];
  241. $registro9 = "";
  242. $contador++;
  243. } else if ($contador == 8) {
  244. $registro9 = $_POST['checkbox'][8];
  245. }
  246. }
  247. }
  248.  
  249. $cadena = $registro1 . " " . $registro2 . " " . $registro3 . " " . $registro4 . " " . $registro5 . " " . $registro6 . " " . $registro7 . " " . $registro8 . " " . $registro9;
  250.  
  251.  
  252. mysql_query("insert into usuario(nombre,nick,password,fecha_nac,edad,sexo,intereses,fecha_reg) values ('$nombre','$nick','$password','$cumpleano','$edad','$sexo','$cadena','$fechaR')");
  253.  
  254. <tr>
  255. <td><center><label >Edad: </label></center></td>
  256. <td><input class="spinnerT" value="<?php echo $row["edad"]; ?>" id="edad" name="edad" TYPE="NUMBER" MIN="10" MAX="66" STEP="1" VALUE="20"></td>
  257. </tr>
  258.  
  259. <?php if (array_search( [VALOR_DEL_CHECKBOX], $intereses) >= 0) { echo "checked"; } ?>
  260.  
  261. <?php
  262.  
  263. $intereses = explode(",", $row["intereses"]);
  264. ?>
  265.  
  266. <tr>
  267. <td><input value="Asesinos" type="checkbox" id="checkbox1" name="checkbox[]" <?php if (array_search("Asesinos", $intereses) >= 0) { echo "checked"; } ?>><label for="checkbox1" style="margin-right: 10px;">Asesinos</label>
  268. </td>
  269. <td><input value="Misterios" type="checkbox" id="checkbox2" name="checkbox[]" <?php if (array_search("Misterios", $intereses) >= 0) { echo "checked"; } ?>><label for="checkbox2" style="margin-right: 30px;">Misterios</label>
  270. </td>
  271. <td><input value="Creppys" type="checkbox" id="checkbox3" name="checkbox[]" <?php if (array_search("Creppys", $intereses) >= 0) { echo "checked"; } ?> ><label for="checkbox3" style="margin-right: 10px;">Creppys</label>
  272. </td>
  273. </tr>
  274.  
  275. <tr>
  276. <td><input value="Ovnis" type="checkbox" id="checkbox4" name="checkbox[]" <?php if (array_search("Ovnis", $intereses) >= 0) { echo "checked"; } ?>><label for="checkbox4" style="margin-right: 35px;">Ovnis</label>
  277. </td>
  278. <td><input value="Enfermedades" type="checkbox" id="checkbox5" name="checkbox[]" <?php if (array_search("Enfermedades", $intereses) >= 0) { echo "checked"; } ?> ><label for="checkbox5" style="margin-right: -10px;">Enfermedades</label>
  279. </td>
  280. <td><input value="Leyendas" type="checkbox" id="checkbox6" name="checkbox[]" <?php if (array_search("Leyendas", $intereses) >= 0) { echo "checked"; } ?> ><label for="checkbox6" style="margin-right: 10px;">Leyendas</label>
  281. </td>
  282. </tr>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement