Guest User

Untitled

a guest
Dec 12th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. <DOCTYPE! html>
  2. <html lang="es">
  3.  
  4. <head>
  5. <title>Universalistas</title>
  6. <meta charset="utf-8"/>
  7. </head>
  8.  
  9. <body>
  10. <p>hola</p>
  11.  
  12. <?php
  13.  
  14. $host = "xxxxxx";
  15. $user = "xxxxxx";
  16. $pass = "xxxxxx";
  17. $name = "xxxxxx";
  18.  
  19.  
  20. $con = mysqli_connect($host, $user, $pass, $name);
  21.  
  22. if(mysqli_connect_errno()) echo "" . mysqli_connect_error();
  23. if(mysqli_ping($con)) echo "ok!";
  24. else echo "" . mysqli_error($con);
  25.  
  26. /*$user = "test";
  27. $password = "test";
  28. $mail = "tes@test.test";
  29. $name = "test";
  30. $lastname = "test";
  31. $origin = "test";
  32. $area = "test";*/
  33.  
  34. $conn = new mysqli($host, $user, $pass, $name);
  35.  
  36. $reg = mysqli_query($conn, "select * from users;");
  37. if($reg)
  38. {
  39. echo "<script>alert('Usuario registrado correctamente.');
  40. window.location.href = 'index.php';</script>";
  41. }
  42. else
  43. {
  44. echo "Ño"/*"<script>alert('¡Ha ocurrido un error y no se registraron los datos!');
  45. window.location.href = 'index.php';</script>"*/;
  46. }
  47.  
  48. ?>
  49.  
  50.  
  51. </body>
  52.  
  53. </html>
  54.  
  55. ini_set('display_errors', 1);
  56. error_reporting(E_ALL);
  57.  
  58. try {
  59. $conn = new mysqli($host, $user, $pass, $name);
  60. $reg = mysqli_query($conn, "select * from users;");
  61. if($reg) {
  62. echo "Si";
  63. } else {
  64. echo "Ño";
  65. }
  66. } catch (Exception $exc) {
  67. echo '<pre>';
  68. var_export($exc);
  69. echo '<br>';
  70. }
Add Comment
Please, Sign In to add comment