Posted By

asterfr on 04/05/10


Tagged

php session


Versions (?)

Simple http session


 / Published in: PHP
 

This script helps you to test session persistence for your HTTP API.

Launch this.php?set=valuuue to set the session value stored to value. Launch this.php to retrieve the value.

  1. <?php
  2. /**
  3.  * This script helps you to test session persistence for your HTTP API
  4.  *
  5.  * launch this.php?set=valuuue to set the session value stored to value
  6.  * launch this.php to retrieve the value
  7.  */
  8.  
  9.  
  10. if (isset($_GET['set'])) {
  11. $_SESSION['value'] = $_GET['set'];
  12. echo 'value set to : '.$_SESSION['value'];
  13. } else {
  14. if (!isset($_SESSION['value'])) {
  15. echo 'no value stored';
  16. } else {
  17. echo 'session contains : '.$_SESSION['value'];
  18. }
  19. }
  20. ?>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: darksider on April 21, 2010

i don't get it.. what's this for? if you were trying to teach people i think you should write like a basic login script or something... i just don't understand what this was supposed to achieve..sorry dude =(

You need to login to post a comment.