code_junkie

Accessing html parameter in PHP

Nov 10th, 2011
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <?php
  2.  
  3. if ($_POST['destroy'])
  4. {
  5. session_destroy();
  6. }
  7. else
  8. {
  9. session_start();
  10. }
  11.  
  12. ?>
  13.  
  14. <html>
  15. <head>
  16. <title>Session test</title>
  17. </head>
  18.  
  19. <body>
  20.  
  21. <?php
  22.  
  23. if (isset($_POST['destroy']))
  24. {
  25. echo "Destroy set";
  26. }
  27.  
  28. $_SESSION['counter']++;
  29.  
  30. echo "You have visited this page " . $_SESSION['counter'] . " times" . "<BR>";
  31. echo "I am tracking you using the session id " . session_id() . "<BR>";
  32. echo "Click <a href="" . $_SERVER['PHP_SELF'] . "?destroy=1">here</a> to destroy the session.";
  33. ?>
  34.  
  35. $_POST['destroy']
  36.  
  37. $_GET['destroy']
  38.  
  39. session_start();
  40. $_SESSION = array();
  41. if (isset($_COOKIE[session_name()])) {
  42. setcookie(session_name(), '', time()-42000, '/');
  43. }
  44. session_destroy();
  45.  
  46. if( $_GET['destroy'] == 1 )
  47.  
  48. if( isset($_GET['destroy']) )
Add Comment
Please, Sign In to add comment