[Previous] [Contents] [Next]


sessionDestroy

When session_destroy( ) is called, the sessionDestroy( ) handler shown in Example D-7 is called. This function deletes the row identified by the $sess_id argument from the table that holds the session variables.

Example D-7. The sessionDestroy handler
// This is called whenever the session_destroy(  )
// function call is made. Returns true if the session
// has successfully been deleted.

function sessionDestroy($sess_id)
{
  global $connection;
  global $session_table;

  $delete_query =
    "DELETE FROM $session_table
      WHERE session_id = '$sess_id'";

  if (!($result = @ mysql_query($delete_query,
                                $connection)))
     showerror(  );

  return true;
}

[Previous] [Contents] [Next]