john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

user session intro

php-user-session-intro

# not production safe method...

<?php
session_start();
if(isset($_SESSION['views']))
    $_SESSION['views'] = $_SESSION['views']+ 1;
else
    $_SESSION['views'] = 1;

echo "views = ". $_SESSION['views'];



# erase all data in the 'cart' variable
if(isset($_SESSION['cart']))
    unset($_SESSION['cart']);

# completely destroy the session (erase all data)
    session_destroy();
?>

  • « Sql query if no prod desc then use write in name
  • Qemu convert hard disk image »

Published

Oct 27, 2010

Category

php

~35 words

Tags

  • intro 9
  • php 82
  • session 3
  • user 18