Recent Post

Dear reader, this blog has been moved to here

Thursday, 13 June 2013

[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
 <?php  
 echo"<a href='logout.php?url=".$_SERVER[PHP_SELF]." '>Logout</a>";  
 ?>  

NOW IN UR logout.php
 <?php  
 //assigning $_GET to variable  
 $url = $_GET[url];  
 //checkin if $_GET comes wit a link  
 if(isset($url))  
  {  
   session_destroy();  
 //afta destroyin d session, it redirects back to d link coming with $_GET  
   header('location: '.$url.'');  
   die();  
  }  
 //if $_GET does not cum wit a link  
 if(!$url)  
 {  
   session_destroy();  
   header('location: index.php');  
   die();  
  }  
 ?>  
 

Email Newsletter



Smiley :)
:D
:)
:[
;)
:D
:O
(6)
(A)
:'(
:|
:o)
8)
(K)
(M)

No comments:

Post a Comment