[PHP/MYSQL TUT] REDIRECT TO THE SAME PAGE AFTER SESSION DESTROY (LOGOUT)
I jst got this trick lst nyt
NOW LETS START
in your logout link put it lyk dz
NOW IN UR logout.php
NOW LETS START
in your logout link put it lyk dz
1 |
<?php <br /> echo"<a href='logout.php?url=".$_SERVER[PHP_SELF]." '>Logout</a>"; <br /> ?> <br /> |
NOW IN UR logout.php
1 |
<?php <br /> //assigning $_GET to variable <br /> $url = $_GET[url]; <br /> //checkin if $_GET comes wit a link <br /> if(isset($url)) <br /> { <br /> session_destroy(); <br /> //afta destroyin d session, it redirects back to d link coming with $_GET <br /> header('location: '.$url.''); <br /> die(); <br /> } <br /> //if $_GET does not cum wit a link <br /> if(!$url) <br /> { <br /> session_destroy(); <br /> header('location: index.php'); <br /> die(); <br /> } <br /> ?> <br /> |