CS 328 - Week 9 Lecture 2 - 2016-03-23
* intro to PHP sessions, continued
----------
* from course text: Section 14.3, p. 556:
IF, for SOME reason, you want to get
rid of the current session and immediately
begin a new session, you have to REGENERATE
a NEW session id and then restart:
session_destroy();
session_regenerate_id(TRUE);
session_start();
----------
* note: you can remove a key (and its value)
from an associative array using the unset function:
unset($_SESSION['fave_sound']);
----------
* we "talked through" an approach to a single PHP document
using sessions to control a sequence of responses
to a user at the end of class on Monday (Week 9 Lecture 1);
we now DEMOED this in class developing
try-trio.php
* (and transformed complain_and_exit.php from a stub
to operational after class -- check it out,
and let me know if you have any questions about
it)
----------
* note: looked up after class:
PHP has a function trim that expects a string, and
returns that string with any leading or trailing
white space removed;
(this is now used in the
posted version of try-trio.php to allow it to
complain and exit if a silly person tries to
enter a name, quest, or color consisting of,
for example, just blanks... 8-) )