Ver Mensaje Individual
  #8 (permalink)  
Antiguo 30/06/2011, 21:58
mauricio_grandon
 
Fecha de Ingreso: junio-2011
Mensajes: 10
Antigüedad: 12 años, 9 meses
Puntos: 0
Respuesta: Dudas Con Sesiones

Código PHP:
Ver original
  1. <?php
  2. $us=$_POST['rut'];
  3. $cl=$_POST['pass'];
  4. $link = mysql_connect('localhost', 'mauricio', '123456');
  5. if (!$link) {
  6.     die('No se puede connectar: ' . mysql_error());
  7. }
  8. $db_selected = mysql_select_db('prueba3', $link);
  9. if (!$db_selected) {
  10.     die ('Error al utilizar la BD : ' . mysql_error());
  11. }
  12. $sql = "SELECT
  13. usuario.rut,
  14. usuario.pass,
  15. usuario.rol
  16. from usuario
  17. where rut='".$us."' and pass='".$cl."'";
  18. $result = mysql_query($sql);
  19. if($row = mysql_fetch_array($result)){
  20.            
  21. $nombre = $row['nombre'];
  22. $rol = $row["rol"];
  23. switch($rol)
  24. {
  25. case 01:
  26. header(" location: 1.html");
  27. break;
  28.  
  29. case 02:
  30. header(" location: 2.html");
  31. break;
  32.  
  33. case 03:
  34. header(" location: 03.html");
  35. break;
  36.  
  37. default:
  38. header(" location: sinpermisos.html");
  39. break;
  40. }  
  41. }
  42. }
  43. ?>

asi tengo mi codigo pero no me funciona estara bn??