Location: PHPKode > projects > DataDivisions > includes/funcDeleteDisplay.php
<?
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# DataDivisions, Build 1.0, 12/11/2003                                      #
# FileName: funcDeleteDisplay.php                                           #
# File Description:                                                         #
#   Provides functions required for a user to delete a saved display (back- #
#   end, middle and front-end)                                              #
#                                                                           #
# +-----------------------------------------------------------------------+ #
# | DataDivisions - Website Statistic Visualization Software              | #
# | Copyright (c) 2003, Brian Willison                                    | #
# +-----------------------------------------------------------------------+ #
# | The contents of this file are subject to the GNU General Public       | #
# | License version 2 (June 1991). This file and all its contents (incl.  | #
# | functions, methods, etc.) are free for general use within any         | #
# | community. This software is distributed with the intent to allow      | #
# | developers the opportunity to copy, manipulate and revamp this        | #
# | application in part or whole for best use cases.                      | #
# |                                                                       | #
# | This software is distributed "AS-IS" with no warranties of any kind   | #
# | either expressed or implied.                                          | #
# |                                                                       | #
# | Please refer to the GPL license document for more information:        | #
# | (_docs/gplLicense.pdf)                                                | #
# +-----------------------------------------------------------------------+ #
# | Developer, Designer, Initial Creator:                                 | #
# | Brian Willison (hide@address.com)                       | #
# +-----------------------------------------------------------------------+ #
# | Initial Download Reference:                                           | #
# | http://datadivisions.sourceforge.net                                  | #
# +-----------------------------------------------------------------------+ #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

// Function: Check Register Form
function checkDeleteDisplayForm($_POST) {
	if ($_POST['description'] == "") {
		return "blankSubmit";
	} else {
		// Gather Posted Data
		$username = $_POST['username'];
		$displayUrl = $_POST['displayUrl'];
		$description = stripslashes($_POST['description']);
		// Connnect To Db To Update Description Of Saved Display
		$dbOpen = dbConnect();
		$query = "DELETE FROM ".dbTableSavedDisplays." WHERE username='$username' AND description='$description' AND displayUrl='$displayUrl'";
		$result = mysql_query($query) or die(mysql_error());
		dbClose($dbOpen);
	}
}
// Function: Generate Register Form
function genDeleteDisplayForm($errorCheck) {
global $_POST,$_GET;
	$username = (isset($_GET['username'])) ? $_GET['username'] : $_POST['username'];
	$displayUrl = (isset($_GET['displayUrl'])) ? $_GET['displayUrl'] : $_POST['displayUrl'];
	$description = (isset($_GET['description'])) ? $_GET['description'] : $_POST['description'];
	$displayUrl = ereg_replace("\(","",$displayUrl);
	$displayUrl = ereg_replace("\)","",$displayUrl);
	$displayUrl = ereg_replace("_","&",$displayUrl);
	$description = ereg_replace("_"," ",$description);
	genAppSmHeader(pageName);
?>
	<tr>
	<td></td>
	<td valign="top" colspan="3"><p class="header">You are about to delete the following display. To confirm this action please click 
	"Submit." If you wish to <i>not</i> delete this item, simply close this window.</td>
	</td>
	</tr>
	<tr>
	<td valign="top" colspan="5"><?writeSpacer(1,10);?></td>
	</tr>
<?
	if ($errorCheck != 0) {
		printf("\t<tr><td></td><td valign=\"top\" colspan=\"3\"><p class=\"error\">%s</td><td></td></tr>",genErrorMsg($errorCheck));
	}
?>
	<tr>
	<td valign="top" colspan="5"><?writeSpacer(1,10);?></td>
	</tr>
	<tr>
	<form name="deleteDisplay" method="post" action="<?=phpSelf?>">
	<td></td>
	<td valign="top"><p align="right">Description:<input type="text" style="width:0px;height0px;border:0px;"></td>
	<td></td>
	<td><p><?=$description?></td>
	<td></td>
	</tr>
	<tr>
	<td valign="top" colspan="5"><?writeSpacer(1,10);?></td>
	</tr>
	<input type="hidden" name="username" value="<?=$username?>">
	<input type="hidden" name="displayUrl" value="<?=$displayUrl?>">
	<input type="hidden" name="description" value="<?=$description?>">
	<tr>
	<td></td>
	<td></td>
	<td></td>
	<td valign="top"><input type="submit" name="submit" value="Submit" class="btnSubmit"></td>
	<td></td>
	</form>
	</tr>
	<tr>
	<td valign="top" colspan="5"><?writeSpacer(1,15);?></td>
	</tr>
<?
	genAppSmFooter(pageName);
}
?>
Return current item: DataDivisions