Advertisement
Guest User

Untitled

a guest
May 5th, 2016
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. //validar.php
  2. <?php
  3. extract($_POST);
  4. include("../config.php");
  5. include("class_mysql.php");
  6. $miconexion = new DB_mysql;
  7. $miconexion->conectar($db_data,$db_host,$db_user, $db_pass);
  8.  
  9. $clave=md5($clave);
  10. $miconexion->consulta("select * from usuarios where username='$usuario' and password='$clave'");
  11.  
  12. $lista=$miconexion->verconsulta_lista();
  13. if ($lista[0]!=NULL) {
  14. session_start();
  15. $_SESSION['id']=$lista[0];
  16. $_SESSION['nombre']=$lista[1];
  17. $_SESSION['rol']=$lista[6];
  18. echo "<script>location.href='$url_site/resources/admin/admin.php'</script>";
  19. }else{
  20. echo '<script>alert("Datos Incorrectos")</script>';
  21. echo "<script>location.href='$url_site/public_html'</script>";
  22. }
  23.  
  24. ?>
  25.  
  26.  
  27.  
  28. //salir.php
  29. <?php
  30. session_start();
  31. session_destroy();
  32. session_unset($_SESSION['nombre']);
  33. $_SESSION['nombre']=NULL;
  34. echo '<script>alert("Ingreso Ilegal...")</script>';
  35. echo "<script>location.href='../../public_html'</script>";
  36. exit();
  37. ?>
  38.  
  39. //clase_mysql
  40. function verconsulta_lista(){
  41. while ( $row=mysql_fetch_row($this->Consulta_ID)) {
  42. for ($i=0; $i < $this->numcampos(); $i++) {
  43. $row[$i];
  44. }
  45. return $row;
  46. }
  47. }
  48.  
  49.  
  50.  
  51.  
  52. //index
  53.  
  54. <?php
  55. session_start();
  56. if(@$_SESSION['id']==NULL){
  57. include("../resources/template/register.php");
  58. include("../resources/template/login.php");
  59. }else{
  60. echo "Usuario ya ingresado:".$_SESSION['nombre'];
  61. echo "<a href='../resources/library/salir.php'>Salir</a>";
  62. }
  63. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement