/** * Destroy a specific session * * @param int $id Session Id * @return boolean */ public function destroy($id) { try { $sessionRecord = $this->_tableStorage->retrieveEntityById($this->_sessionTable, $this->_sessionTablePartition, $id); $this->_tableStorage->deleteEntity($this->_sessionTable, $sessionRecord); return true; } catch (Microsoft_WindowsAzure_Exception $ex) { return false; } }
/** * Destroy a specific session * * @param int $id Session Id * @return boolean */ public function destroy($id) { // Destroy data if ($this->_storageType == self::STORAGE_TYPE_TABLE) { // In table storage try { $sessionRecord = $this->_storage->retrieveEntityById($this->_sessionContainer, $this->_sessionContainerPartition, $id); $this->_storage->deleteEntity($this->_sessionContainer, $sessionRecord); return true; } catch (Microsoft_WindowsAzure_Exception $ex) { return false; } } else { if ($this->_storageType == self::STORAGE_TYPE_BLOB) { // In blob storage try { $this->_storage->deleteBlob($this->_sessionContainer, $this->_sessionContainerPartition . '/' . $id); return true; } catch (Microsoft_WindowsAzure_Exception $ex) { return false; } } } }
$blob->createcontainerIfNotExists(BLOB_GUESTBOOK); // Set ACL $blob->setContainerAcl(BLOB_GUESTBOOK, Microsoft_WindowsAzure_Storage_Blob::ACL_PUBLIC_CONTAINER); // If the user submitted something put it into the table storage // NOTE: Inputs are not cleaned for example purposes if (isset($_POST['NameTextBox']) && isset($_POST['MessageTextBox'])) { $g = new GuestBookEntry(); $image = $blob->putBlob(BLOB_GUESTBOOK, $_FILES['Image']['name'], $_FILES['Image']['tmp_name']); $g->GuestName = $_POST['NameTextBox']; $g->Message = $_POST['MessageTextBox']; $g->ImageUrl = $image->Url; $table->insertEntity(TABLE_GUESTBOOK, $g); } // User wishes to delete something if (isset($_GET['Delete']) && isset($_GET['key'])) { $g = $table->retrieveEntityById(TABLE_GUESTBOOK, $_GET['Delete'], $_GET['key']); $table->deleteEntity(TABLE_GUESTBOOK, $g); header("Location: index.php"); } // Get all the guest book entries for display $entries = $table->retrieveEntities(TABLE_GUESTBOOK); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Windows Azure Guestbook</title> <link href="main.css" rel="stylesheet" type="text/css" /> </head> <body>