<?
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# DataDivisions, Build 1.0, 12/11/2003 #
# FileName: funcSaveDisplay.php #
# File Description: #
# Provides functions required for a user to save a 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 checkSaveDisplayForm($_POST) {
if ($_POST['desc'] == "") {
return "blankSubmit";
} else {
// Gather Posted Data
$username = $_POST['username'];
$desc = $_POST['desc'];
$displayUrl = $_POST['displayUrl'];
// Generate Date For TimeStamp
$date = date("YmdHis");
// Setup Db Connection
$dbOpen = dbConnect();
$query = "INSERT INTO ".dbTableSavedDisplays." VALUES ('$username','$desc','$displayUrl','$date')";
$result = mysql_query($query);
dbClose($dbOpen);
}
}
// Function: Generate Register Form
function genSaveDisplayForm($errorCheck) {
global $_POST,$_GET;
$username = (isset($_GET['username'])) ? $_GET['username'] : $_POST['username'];
$displayUrl = (isset($_GET['displayUrl'])) ? $_GET['displayUrl'] : $_POST['displayUrl'];
$displayUrl = ereg_replace("\(","",$displayUrl);
$displayUrl = ereg_replace("\)","",$displayUrl);
$displayUrl = ereg_replace("_","&",$displayUrl);
genAppSmHeader(pageName);
?>
<tr>
<td></td>
<td valign="top" colspan="3"><p class="header">To save this display for future reference, please enter a short description of it below.
When you are finished, please click "Submit."</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="saveDisplay" method="post" action="<?=phpSelf?>">
<td></td>
<td valign="top"><p align="right">Description:</td>
<td></td>
<td><p><textarea name="desc" cols="22" rows="3"><?if(isset($_POST['desc'])){echo$_POST['desc'];}?></textarea></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?>">
<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);
}
?>