Embed presentation
Download to read offline
![<?php
session_start();
if(!isset($_SESSION['s_username']))header("location: res.php");
echo "<font face='Tahoma, Geneva, sans-serif' color='#009966'>Bienvenido
</font><b>".$_SESSION['s_username']."</b> <a href="index.php" title='Pagina
Principal'>Pagina Principal</a> || <a href="logout.php"
title='Cerrar Sesion'>Cerrar Sesion</a>";
?>](https://image.slidesharecdn.com/codigoprincipal-131110094716-phpapp01/75/Codigo-principal-1-2048.jpg)

This PHP code checks if a user is logged in through a session variable. If the user is not logged in, they are redirected to a login page. If they are logged in, their username is displayed along with links to the home page and a logout page.
![<?php
session_start();
if(!isset($_SESSION['s_username']))header("location: res.php");
echo "<font face='Tahoma, Geneva, sans-serif' color='#009966'>Bienvenido
</font><b>".$_SESSION['s_username']."</b> <a href="index.php" title='Pagina
Principal'>Pagina Principal</a> || <a href="logout.php"
title='Cerrar Sesion'>Cerrar Sesion</a>";
?>](https://image.slidesharecdn.com/codigoprincipal-131110094716-phpapp01/75/Codigo-principal-1-2048.jpg)