Guest User

Untitled

a guest
Jul 17th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. <?php
  2. /*
  3. session_test.php
  4. */
  5.  
  6. session_start();
  7. $arr = explode('/', $_SERVER["REQUEST_URI"]);
  8. if( count($arr) > 2 )
  9. {
  10. $name = $arr[2];
  11. if($name == 'clear')
  12. {
  13. session_destroy();
  14. }
  15. elseif( count($arr) > 3)
  16. {
  17. $value = $arr[3];
  18. $_SESSION[$name] = $value;
  19. }
  20. else
  21. {
  22. unset($_SESSION[$name]);
  23. }
  24. }
  25. echo '<html>';
  26. echo '<head>';
  27. echo '<script src="THISENDSUPINSESSION.js"></script>';
  28. echo '</head>';
  29. echo '<body>';
  30. echo var_export($_SESSION,true);
  31. echo '</body>';
  32. echo '</html>';
  33.  
  34. /*
  35. To try:
  36.  
  37. session_test/id/1
  38.  
  39. session_test
  40.  
  41. gives me:
  42.  
  43. id => 'THISENDSUPINTHESESSION'
  44.  
  45. */
Add Comment
Please, Sign In to add comment