Advertisement
Guest User

Untitled

a guest
Jan 8th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.45 KB | None | 0 0
  1. <?php
  2. include("config.php");
  3. session_start();
  4. if($_POST['bacceso'] == 'Acceder' && !empty($_POST['ipersonaje']))
  5. {
  6. $idPJ = strval($_POST['ipersonaje']);
  7. $conexion = mysqli_connect($host_pcu, $user_pcu, $password_pcu, $database_pcu);
  8. $sql = "SELECT * FROM players WHERE id = $idPJ AND Email = '".$_SESSION['email']."'";
  9. $result = mysqli_query($conexion, $sql);
  10. if($result == false)
  11. {
  12. mysqli_close($conexion);
  13. ob_end_clean();
  14. header("Location: personaje.php");
  15. }
  16. $row = mysqli_fetch_array($result);
  17. $_SESSION['id'] = $row['id'];
  18. $_SESSION['nombre'] = $row['Nombre'];
  19. $_SESSION['contraseña'] = $row['Password'];
  20. $_SESSION['seguro'] = $row['SeguroMedico'];
  21. $_SESSION['licencias'] = $row['Licencias'];
  22. $_SESSION['telefonos'] = $row['Telefonos'];
  23. $_SESSION['banco'] = $row['Banco'];
  24. $_SESSION['sexo'] = $row['Sexo'];
  25. $_SESSION['raza'] = $row['Raza'];
  26. $_SESSION['skin'] = $row['Skin'];
  27. $_SESSION['edad'] = $row['Edad'];
  28. $_SESSION['faccion'] = $row['Faccion'];
  29. $_SESSION['certificacion'] = $row['Certificacion'];
  30. $_SESSION['certificador'] = $row['Certificador'];
  31. $_SESSION['peliculas'] = $row['Peliculas'];
  32. $_SESSION['coches'] = $row['Coches'];
  33. switch($row['Certificacion'])
  34. {
  35. case 0:
  36. mysqli_close($conexion);
  37. ob_end_clean();
  38. header("Location: test.php");
  39. break;
  40. case 1:
  41. $_SESSION['user_logged_in'] = 2;
  42. mysqli_close($conexion);
  43. ob_end_clean();
  44. header("Location: estadisticas.php");
  45. break;
  46. default:
  47. $sql = "SELECT * FROM web_cert WHERE nombre = '".$_SESSION['nombre']."'";
  48. $result = mysqli_query($conexion, $sql);
  49. $row = mysqli_fetch_array($result);
  50. $id = $row['id'];
  51. if(mysqli_num_rows($result) == 0)
  52. {
  53. mysqli_close($conexion);
  54. ob_end_clean();
  55. header("Location: certificacion.php");
  56. }
  57. else
  58. {
  59. $sql= "SELECT * FROM web_cert WHERE id < $id";
  60. $resultado = mysqli_query($conexion, $sql);
  61. $certificaciones = mysqli_num_rows($resultado);
  62. mysqli_close($conexion);
  63. if($certificaciones == 0) echo "<script>alert('Todavía no te han certificado la cuenta, estás en primera posición.'); window.location = 'personaje.php';</script>";
  64. else echo "<script>alert('Todavía no te han certificado la cuenta, hay $certificaciones antes que la tuya.'); window.location = 'personaje.php';</script>";
  65. }
  66. break;
  67. }
  68. }
  69. else if($_POST['blogin'] == "Acceder" && !empty($_POST['logincuenta']) && !empty($_POST['loginpass']))
  70. {
  71. $conexion = mysqli_connect($host_foro, $user_foro, $password_foro, $database_foro);
  72. $usuario = mysqli_real_escape_string($conexion, $_POST['logincuenta']);
  73. $password = md5($_POST['loginpass']);
  74. $sql = "SELECT email FROM user WHERE username = '".$usuario."' AND password = '".$password."'";
  75. if($result = mysqli_query($conexion, $sql))
  76. {
  77. $row = mysqli_fetch_row($result);
  78. $_SESSION['user_logged_in'] = 1;
  79. $_SESSION['email'] = $row[0];
  80. $_SESSION['usuario'] = $usuario;
  81. mysqli_close($conexion);
  82. ob_end_clean();
  83. header("Location: personaje.php");
  84. }
  85. else
  86. {
  87. mysqli_close($conexion);
  88. ob_end_clean();
  89. header("Location: index.php");
  90. }
  91. }
  92. else
  93. {
  94. ob_end_clean();
  95. if($_SESSION['user_logged_in'] == 1) header("Location: personaje.php");
  96. else if($_SESSION['user_logged_in'] == 2) header("Location: estadisticas.php");
  97. else header("Location: index.php");
  98. }
  99. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement