Ver Mensaje Individual
  #7 (permalink)  
Antiguo 30/07/2012, 15:42
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: Proteger pagina con usuario privilegiado

pues igual que has echo aqui pero con la session de privilegios

<?php
session_start();
if (!isset($_SESSION['username'])){
header("Location: login.php");
}
?>


if (isset($_SESSION['privilegios']) && $_SESSION['privilegios'] == 'root'){

// CONTENIDO SOLO PARA ROOT

}


Código PHP:
Ver original
  1. echo("<tr>\n");
  2. echo("<td width='5%'>" . $row["tecnologia"] . "</td>\n");
  3. echo("<td width='5%'>" . $row["equipo"] . "</td>\n");
  4. echo("<td width='10%'>" . $row["nombre"] . "</td>\n");
  5. echo("<td width='5%'>" . $row["serial_mv"] . "</td>\n");
  6. echo("<td width='5%'>" . $row["serial_e"] . "</td>\n");
  7. echo("<td width='5%'>" . $row["cod_m"] . "</td>\n");
  8. echo("<td width='5%'>" . $row["cod_p"] . "</td>\n");
  9. echo("<td width='10%'>" . $row["fecha_i"] . "</td>\n");
  10. echo("<td width='10%'>" . $row["usuario_i"] . "</td>\n");
  11. echo("<td width='10%'>" . $row["com_i"] . "</td>\n");
  12. echo("<td width='5%'>" . $row["fecha_s"] . "</td>\n");
  13. echo("<td width='5%'>" . $row["usuario_s"] . "</td>\n");
  14. echo("<td width='10%'>" . $row["com_s"] . "</td>\n");
  15.  
  16. if (isset($_SESSION['privilegios']) && $_SESSION['privilegios'] == 'root'){
  17.  
  18. echo("<td width='5%'><a href='borrar.php?id=$id' class='estilo'><img src='images/eliminar.png' title='Eliminar'></a></td>\n");
  19. echo "</tr>";
  20.  
  21. }
  22.  
  23.  
  24. }
  25.  
  26. echo "</table>";