Pure PHP Upload 3 Support Product Page
I just wanted to add a sipp but all gone to crap
Reported 01 Apr 2014 22:28:46
1
has this problem
01 Apr 2014 22:28:46 Phil Boyle posted:
I just wanted to add a sipp to my ppu but it didn't work. I tried upgrading to PPU3. I have had to completely rebuild my page which has been working for years and then right at the end I try and put the update server behaviour to encounter a javascript error. So I manually try to add the update server behaviour (from a backup copy) which then stops the PPu working, now nothing is working. or I get undefined errors on lines 18 and 19.I use a select menu to choose a page to edit. This passes the value onto the update form. The form has values and information and images to edit. It was working perfectly but it didn't have a sipp because I had been managing the photos and just uploading the correct size images. Now the client would like to upload their own images I just needed to add a resize feature.
The code is below.
<?php require_once('../Connections/dbConn.php'); ?>
<?php require_once('../ScriptLibrary/incPureUpload.php'); ?>
<?php require_once('../ScriptLibrary/cGraphicMediator.php'); ?>
<?php
//*** Pure PHP File Upload 3.1.0
// Process form edit_PagePhoto
$ppu = new pureFileUpload();
$ppu->nameConflict = "over";
$ppu->storeType = "file";
$ppu->progressBar = "win_look.htm";
$ppu->progressWidth = 400;
$ppu->progressHeight = 200;
$ppu->path = "uploadPagePhotos";
$ppu->redirectUrl = "";
$ppu->checkVersion("3.1.0"
$ppu->doUpload();
if ($ppu->done) {
$_POST["undefined"] = undefined;
$_POST["undefined"] = undefined;
}
?>
<?php
// Smart Image Processor PHP 2.1.1
if (isset($_GET['GP_upload'])) {
$sipp2 = new cGraphicMediator("upload", $ppu, ""
$sipp2->setComponent("Auto"
$sipp2->setMatteColor("#FFFFFF"
$sipp2->resizeEx(50, 50, true, false);
$sipp2->overwrite = true;
$sipp2->saveJPEG(80);
$sipp2->process();
$sipp2GoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$sipp2GoTo .= (strpos($sipp2GoTo, '?')) ? "&" : "?";
$sipp2GoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $sipp2GoTo));
}
?>
<?php
if (!function_exists("GetSQLValueString") {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string" ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "" ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "" ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "" ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "" ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "" ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if (isset($editFormAction)) {
if (isset($_SERVER['QUERY_STRING'])) {
if (!eregi("GP_upload=true", $_SERVER['QUERY_STRING'])) {
$editFormAction .= "&GP_upload=true";
}
} else {
$editFormAction .= "?GP_upload=true";
}
}
if (!isset($mm_abort_edit) || !$mm_abort_edit) {
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "edit_PagePhoto") {
$updateSQL = sprintf("UPDATE pagephotostbl SET pageCategory=%s, filename1=%s, description1=%s, rotate1=%s, left1=%s, top1=%s, filename2=%s, description2=%s, rotate2=%s, left2=%s, top2=%s, filename3=%s, description3=%s, rotate3=%s, left3=%s, top3=%s WHERE photo_ID=%s",
GetSQLValueString($_POST['pageCategory'], "text",
GetSQLValueString($_POST['filename1'], "text",
GetSQLValueString($_POST['description1'], "text",
GetSQLValueString($_POST['rotate1'], "text",
GetSQLValueString($_POST['left1'], "text",
GetSQLValueString($_POST['top1'], "text",
GetSQLValueString($_POST['filename2'], "text",
GetSQLValueString($_POST['description2'], "text",
GetSQLValueString($_POST['rotate2'], "text",
GetSQLValueString($_POST['left2'], "text",
GetSQLValueString($_POST['top2'], "text",
GetSQLValueString($_POST['filename3'], "text",
GetSQLValueString($_POST['description3'], "text",
GetSQLValueString($_POST['rotate3'], "text",
GetSQLValueString($_POST['left3'], "text",
GetSQLValueString($_POST['top3'], "text",
GetSQLValueString($_POST['photo_ID'], "int");
mysql_select_db($database_dbConn, $dbConn);
$Result1 = mysql_query($updateSQL, $dbConn) or die(mysql_error());
$updateGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}}
$colname_Recordset1 = "-1";
if (isset($_POST['search_info'])) {
$colname_Recordset1 = $_POST['search_info'];
}
mysql_select_db($database_dbConn, $dbConn);
$query_Recordset1 = sprintf("SELECT * FROM pagephotostbl WHERE pageCategory = %s", GetSQLValueString($colname_Recordset1, "text");
$Recordset1 = mysql_query($query_Recordset1, $dbConn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_select_db($database_dbConn, $dbConn);
$query_rsMain = "SELECT iCategory, iPage, iKey FROM information WHERE iCategory = 'main'";
$rsMain = mysql_query($query_rsMain, $dbConn) or die(mysql_error());
$row_rsMain = mysql_fetch_assoc($rsMain);
$totalRows_rsMain = mysql_num_rows($rsMain);
mysql_select_db($database_dbConn, $dbConn);
$query_rsAboutPages = "SELECT iCategory, iPage, iKey FROM information WHERE iCategory = 'about'";
$rsAboutPages = mysql_query($query_rsAboutPages, $dbConn) or die(mysql_error());
$row_rsAboutPages = mysql_fetch_assoc($rsAboutPages);
$totalRows_rsAboutPages = mysql_num_rows($rsAboutPages);
mysql_select_db($database_dbConn, $dbConn);
$query_rsActivities = "SELECT iCategory, iPage, iKey FROM information WHERE iCategory = 'activities'";
$rsActivities = mysql_query($query_rsActivities, $dbConn) or die(mysql_error());
$row_rsActivities = mysql_fetch_assoc($rsActivities);
$totalRows_rsActivities = mysql_num_rows($rsActivities);
mysql_select_db($database_dbConn, $dbConn);
$query_rsLearning = "SELECT iCategory, iPage, iKey FROM information WHERE iCategory = 'learning'";
$rsLearning = mysql_query($query_rsLearning, $dbConn) or die(mysql_error());
$row_rsLearning = mysql_fetch_assoc($rsLearning);
$totalRows_rsLearning = mysql_num_rows($rsLearning);
?>
<!DOCTYPE html >
<html>
<head>
<title>StarCMS v5.1
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="imagetoolbar" content="false">
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="Author" content="Phillip Boyle">
<meta name="description" content="
">
<link rel="stylesheet" type="text/css" href="s/cms.css">
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="s/ie7.css" />
<![endif]-->
</head>
<body>
<div id="pagewrapper">
<div id="header"><a href="index.php" title="Home page"><h1><span class="hide">StarCMS v5.1</span></h1></a>
<div id="logout"><a href="<?php echo $logoutAction ?>">log out</a></div>
<!--primary navigation-->
<ul id="nav">
<li><a href="index.php" title="Home page">Home</a></li>
<li><a href="#" title="Add, edit, delete users and website pages ">Admin</a>
<ul><li><a href="#">CMS Users</a>
<ul> <li><a href="add_user.php" > Add users</a></li> <li><a href="edit_user.php" >Edit/Delete user</a></li>
</ul></li>
<li><a href="#">Pages</a>
<ul><li><a href="add_pages.php">Create new page</a></li>
<li><a href="admin_Editpages.php">Edit/Delete page</a></li>
</ul>
</li>
</ul> </li>
<li><a href="#" title="Add, edit or delete photos">Photos / Videos</a>
<ul><li><a href="#">Page photos</a>
<ul> <li><a href="add_pagePhotos.php">Add photos</a></li>
<li><a href="edit_pagePhoto.php">Edit photos</a></li> <!-- <li><a href="delete_pagePhotos.php">Delete photos</a></li>-->
</ul>
</li> <li><a href="#">Photo galleries / Videos</a>
<ul>
<li><a href="create_photoGallery.php">Create gallery /Add video</a></li> <li><a href="edit_photoGallery.php">Edit/Delete gallery/Video</a></li> <li><a href="add_photo_gallery.php">Add photos</a></li> <li><a href="delete_photosFromGallery.php">Delete photos</a></li> </ul>
</li></ul></li>
<li><a href="#" title="Add, edit or delete calendar entries.">Calendar</a>
<ul><li><a href="add_calendar.php">Add a calendar entry</a></li>
<li><a href="edit_calendar.php">Edit/Delete calendar entry</a></li>
</ul>
</li>
<li><a href="edit_pages.php" title="Edit website pages ">Pages</a></li>
<li><a href="edit_ClassPages.php" title="Edit class pages">Class pages</a></li>
<li><a href="#" title="Upload newsletter in pdf format">Newsletter</a>
<ul><li><a href="add_documentFile.php">Add item</a></li>
<li><a href="edit_documentFile.php">Edit/Delete item</a></li>
</ul></li>
</ul></div>
<!-- end primary navigation-->
<div id="contentWrapper">
<div id="content">
<h2>Choose a page to edit the photos</h2>
<form name="search_form" id="search_form" action="TESTedit_pagePhoto.php" method="post">
<select name="search_info">
<option value="#">--choose--</option>
<?php if ($totalRows_rsMain > 0) { // Show if recordset not empty ?>
<optgroup label="Main Pages">
<?php do { ?>
<option value="<?php echo $row_rsMain['iPage']; ?>"><?php echo $row_rsMain['iPage']; ?></option>
<?php } while ($row_rsMain = mysql_fetch_assoc($rsMain)); ?>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_rsAboutPages > 0) { // Show if recordset not empty ?>
<optgroup label="About NCS">
<?php do { ?>
<option ><?php echo $row_rsAboutPages['iPage']; ?></option>
<?php } while ($row_rsAboutPages = mysql_fetch_assoc($rsAboutPages)); ?>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_rsActivities > 0) { // Show if recordset not empty ?>
<optgroup label="Activities">
<?php do { ?>
<option value="<?php echo $row_rsActivities['iPage']; ?>"><?php echo $row_rsActivities['iPage']; ?></option>
<?php } while ($row_rsActivities = mysql_fetch_assoc($rsActivities)); ?>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_rsLearning > 0) { // Show if recordset not empty ?>
<optgroup label="Learning">
<?php do { ?>
<option value="<?php echo $row_rsLearning['iPage']; ?>"><?php echo $row_rsLearning['iPage']; ?></option>
<?php } while ($row_rsLearning = mysql_fetch_assoc($rsLearning)); ?>
<?php } // Show if recordset not empty ?>
</select>
<input class="search_btn" type="submit" value="go" name="submit" /></form>
<hr>
<h1>Edit page photos</h1>
<form action="<?php echo $row_Recordset1['']; ?>" method="post" enctype="multipart/form-data" name="edit_PagePhoto" onSubmit="<?php echo $ppu->getSubmitCode() ?>;return document.MM_returnValue">
<?php echo $ppu->getProgressField() ?>
<p>
<label>Page</label>
<input type="text" name="pageCategory" size="30" value="<?php echo $row_Recordset1['pageCategory']; ?>" />
</p>
<fieldset>
<legend>Photo #1</legend>
<p>
<label>Description</label>
<input type="text" name="description1" size="30" value="<?php echo $row_Recordset1['description1']; ?>"/>
</p>
<p>
<label>Photo name</label>
<input name="filename1" type="text" size="30" value="<?php echo $row_Recordset1['filename1']; ?>"/>
</p>
<p>
<label>Photo</label>
<input name="file1" type="file" class="file" onChange="<?php echo $ppu->getValidateCode() ?>;return document.MM_returnValue" size="30" />
</p>
<fieldset>
<p><label>Rotate:</label><input name="rotate1" type="text" size="2" value="<?php echo $row_Recordset1['rotate1']; ?>"/></p>
<p><label>From top:</label><input name="top1" type="text" size="2" value="<?php echo $row_Recordset1['top1']; ?>"/></p>
<p><label>From text:</label><input name="left1" type="text" size="2" value="<?php echo $row_Recordset1['left1']; ?>"/></p>
</fieldset>
</fieldset>
<fieldset>
<legend>Photo #2</legend>
<p><label>Description</label> <input type="text" name="description2" size="30" value="<?php echo $row_Recordset1['description2']; ?>"/></p>
<p><label>Photo name</label><input name="filename2" type="text" size="30" value="<?php echo $row_Recordset1['filename2']; ?>"/></p>
<p>
<label>Photo</label>
<input name="file2" type="file" class="file" onChange="<?php echo $ppu->getValidateCode() ?>;return document.MM_returnValue" size="30" />
</p>
<fieldset>
<p><label>Rotate:</label><input name="rotate2" type="text" size="2" value="<?php echo $row_Recordset1['rotate2']; ?>"/></p>
<p><label>From top:</label><input name="top2" type="text" size="2" value="<?php echo $row_Recordset1['top2']; ?>"/></p>
<p><label>From text:</label><input name="left2" type="text" size="2" value="<?php echo $row_Recordset1['left2']; ?>"/></p>
</fieldset>
</fieldset>
<fieldset>
<legend>Photo #3</legend>
<p><label>Description</label> <input type="text" name="description3" size="30" value="<?php echo $row_Recordset1['description3']; ?>"/></p>
<p><label>Photo name</label><input name="filename3" type="text" size="30" value="<?php echo $row_Recordset1['filename3']; ?>"/></p>
<p>
<label>Photo</label>
<input name="file3" type="file" class="file" onChange="<?php echo $ppu->getValidateCode() ?>;return document.MM_returnValue" size="30" />
</p>
<fieldset>
<p><label>Rotate:</label><input name="rotate3" type="text" size="2" value="<?php echo $row_Recordset1['rotate3']; ?>"/></p>
<p><label>From top:</label><input name="top3" type="text" size="2" value="<?php echo $row_Recordset1['top3']; ?>"/></p>
<p><label>From text:</label><input name="left3" type="text" size="2" value="<?php echo $row_Recordset1['left3']; ?>"/></p>
</fieldset>
</fieldset>
<p class="controls_narrow">
<input class="submit_btn" type="submit" value="submit">
</p>
<input type="hidden" name="photo_ID">
<input type="hidden" name="MM_update" value="edit_PagePhoto">
</form>
</div>
<script type="text/javascript"><?php echo $ppu->generateScriptCode() ?></script>
<script src="../ScriptLibrary/incPU3.js" type="text/javascript"></script>
</div>
</div>
</div>
<div id="footer">
<p>© Copyright <script>d=new Date;document.write(d.getFullYear());</script>
- trickstar web design - All rights reserved</p>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
mysql_free_result($rsMain);
mysql_free_result($rsAboutPages);
mysql_free_result($rsActivities);
mysql_free_result($rsLearning);
?>
This is the version I was tryng to update the added sipp doesn't work but everything else does.
<?php require_once('../Connections/dbConn.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
}
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != ""){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true"){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']); $logoutGoTo = "www.napiercentral.net.nz";
if ($logoutGoTo) {
header("Location: $logoutGoTo"
exit;
}
}
?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "Admin,Staff";
$MM_donotCheckaccess = "false";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "" && false) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "error.html";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?") $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php require_once('../ScriptLibrary/incPureUpload.php'); ?>
<?php
// Pure PHP Upload 2.1.12
$ppu = new pureFileUpload();
$ppu->path = "uploadPagePhotos";
$ppu->extensions = "GIF,JPG,JPEG,BMP,PNG";
$ppu->formName = "edit_PagePhoto";
$ppu->storeType = "file";
$ppu->sizeLimit = "";
$ppu->nameConflict = "over";
$ppu->nameToLower = false;
$ppu->requireUpload = false;
$ppu->minWidth = "";
$ppu->minHeight = "";
$ppu->maxWidth = "";
$ppu->maxHeight = "";
$ppu->saveWidth = "";
$ppu->saveHeight = "";
$ppu->timeout = "600";
$ppu->progressBar = "fileCopyProgress.htm";
$ppu->progressWidth = "300";
$ppu->progressHeight = "100";
$ppu->redirectURL = "";
$ppu->checkVersion("2.1.12"
$ppu->doUpload();
if (!function_exists("GetSQLValueString") {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string" ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "" ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "" ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "" ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "" ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "" ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if (isset($editFormAction)) {
if (isset($_SERVER['QUERY_STRING'])) {
if (!eregi("GP_upload=true", $_SERVER['QUERY_STRING'])) {
$editFormAction .= "&GP_upload=true";
}
} else {
$editFormAction .= "?GP_upload=true";
}
}
if (!isset($mm_abort_edit) || !$mm_abort_edit) {
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "edit_PagePhoto") {
$updateSQL = sprintf("UPDATE pagephotostbl SET pageCategory=%s, filename1=%s, description1=%s, rotate1=%s, left1=%s, top1=%s, filename2=%s, description2=%s, rotate2=%s, left2=%s, top2=%s, filename3=%s, description3=%s, rotate3=%s, left3=%s, top3=%s WHERE photo_ID=%s",
GetSQLValueString($_POST['pageCategory'], "text",
GetSQLValueString($_POST['filename1'], "text",
GetSQLValueString($_POST['description1'], "text",
GetSQLValueString($_POST['rotate1'], "text",
GetSQLValueString($_POST['left1'], "text",
GetSQLValueString($_POST['top1'], "text",
GetSQLValueString($_POST['filename2'], "text",
GetSQLValueString($_POST['description2'], "text",
GetSQLValueString($_POST['rotate2'], "text",
GetSQLValueString($_POST['left2'], "text",
GetSQLValueString($_POST['top2'], "text",
GetSQLValueString($_POST['filename3'], "text",
GetSQLValueString($_POST['description3'], "text",
GetSQLValueString($_POST['rotate3'], "text",
GetSQLValueString($_POST['left3'], "text",
GetSQLValueString($_POST['top3'], "text",
GetSQLValueString($_POST['photo_ID'], "int");
mysql_select_db($database_dbConn, $dbConn);
$Result1 = mysql_query($updateSQL, $dbConn) or die(mysql_error());
$updateGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}}
$colname_Recordset1 = "-1";
if (isset($_POST['search_info'])) {
$colname_Recordset1 = $_POST['search_info'];
}
mysql_select_db($database_dbConn, $dbConn);
$query_Recordset1 = sprintf("SELECT * FROM pagephotostbl WHERE pageCategory = %s", GetSQLValueString($colname_Recordset1, "text");
$Recordset1 = mysql_query($query_Recordset1, $dbConn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_select_db($database_dbConn, $dbConn);
$query_rsMain = "SELECT iCategory, iPage, iKey FROM information WHERE iCategory = 'main'";
$rsMain = mysql_query($query_rsMain, $dbConn) or die(mysql_error());
$row_rsMain = mysql_fetch_assoc($rsMain);
$totalRows_rsMain = mysql_num_rows($rsMain);
mysql_select_db($database_dbConn, $dbConn);
$query_rsAboutPages = "SELECT iCategory, iPage, iKey FROM information WHERE iCategory = 'about'";
$rsAboutPages = mysql_query($query_rsAboutPages, $dbConn) or die(mysql_error());
$row_rsAboutPages = mysql_fetch_assoc($rsAboutPages);
$totalRows_rsAboutPages = mysql_num_rows($rsAboutPages);
mysql_select_db($database_dbConn, $dbConn);
$query_rsActivities = "SELECT iCategory, iPage, iKey FROM information WHERE iCategory = 'activities'";
$rsActivities = mysql_query($query_rsActivities, $dbConn) or die(mysql_error());
$row_rsActivities = mysql_fetch_assoc($rsActivities);
$totalRows_rsActivities = mysql_num_rows($rsActivities);
mysql_select_db($database_dbConn, $dbConn);
$query_rsLearning = "SELECT iCategory, iPage, iKey FROM information WHERE iCategory = 'learning'";
$rsLearning = mysql_query($query_rsLearning, $dbConn) or die(mysql_error());
$row_rsLearning = mysql_fetch_assoc($rsLearning);
$totalRows_rsLearning = mysql_num_rows($rsLearning);
?>
<?php
// Smart Image Processor PHP 2.0.9
if (isset($_GET['GP_upload'])) {
$sipp1 = new cGraphicMediator("upload", $ppu, ""
$sipp1->setComponent("Auto"
$sipp1->setMatteColor("#FFFFFF"
$sipp1->resizeEx(126, 126, true, false);
$sipp1->overwrite = false;
$sipp1->setMask("##path##thumb_##name##.jpg"
$sipp1->saveJPEG(80);
$sipp1->process();
}
?>
<!DOCTYPE html >
<html>
<head>
<title>StarCMS v5.1
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="imagetoolbar" content="false">
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="Author" content="Phillip Boyle">
<meta name="description" content="
">
<link rel="stylesheet" type="text/css" href="s/cms.css">
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="s/ie7.css" />
<![endif]-->
<script language='javascript' src='../ScriptLibrary/incPureUpload.js'></script>
</head>
<body>
<div id="pagewrapper">
<div id="header"><a href="index.php" title="Home page"><h1><span class="hide">StarCMS v5.1</span></h1></a>
<div id="logout"><a href="<?php echo $logoutAction ?>">log out</a></div>
<!--primary navigation-->
<ul id="nav">
<li><a href="index.php" title="Home page">Home</a></li>
<li><a href="#" title="Add, edit, delete users and website pages ">Admin</a>
<ul><li><a href="#">CMS Users</a>
<ul> <li><a href="add_user.php" > Add users</a></li> <li><a href="edit_user.php" >Edit/Delete user</a></li>
</ul></li>
<li><a href="#">Pages</a>
<ul><li><a href="add_pages.php">Create new page</a></li>
<li><a href="admin_Editpages.php">Edit/Delete page</a></li>
</ul>
</li>
</ul> </li>
<li><a href="#" title="Add, edit or delete photos">Photos / Videos</a>
<ul><li><a href="#">Page photos</a>
<ul> <li><a href="add_pagePhotos.php">Add photos</a></li>
<li><a href="edit_pagePhoto.php">Edit photos</a></li> <!-- <li><a href="delete_pagePhotos.php">Delete photos</a></li>-->
</ul>
</li> <li><a href="#">Photo galleries / Videos</a>
<ul>
<li><a href="create_photoGallery.php">Create gallery /Add video</a></li> <li><a href="edit_photoGallery.php">Edit/Delete gallery/Video</a></li> <li><a href="add_photo_gallery.php">Add photos</a></li> <li><a href="delete_photosFromGallery.php">Delete photos</a></li> </ul>
</li></ul></li>
<li><a href="#" title="Add, edit or delete calendar entries.">Calendar</a>
<ul><li><a href="add_calendar.php">Add a calendar entry</a></li>
<li><a href="edit_calendar.php">Edit/Delete calendar entry</a></li>
</ul>
</li>
<li><a href="edit_pages.php" title="Edit website pages ">Pages</a></li>
<li><a href="edit_ClassPages.php" title="Edit class pages">Class pages</a></li>
<li><a href="#" title="Upload newsletter in pdf format">Newsletter</a>
<ul><li><a href="add_documentFile.php">Add item</a></li>
<li><a href="edit_documentFile.php">Edit/Delete item</a></li>
</ul></li>
</ul></div>
<!-- end primary navigation-->
<div id="contentWrapper">
<div id="content">
<h2>Choose a page to edit the photos</h2>
<form name="search_form" id="search_form" action="edit_pagePhoto.php" method="post">
<select name="search_info">
<option value="#">--choose--</option>
<?php if ($totalRows_rsMain > 0) { // Show if recordset not empty ?>
<optgroup label="Main Pages">
<?php do { ?>
<option value="<?php echo $row_rsMain['iPage']; ?>"><?php echo $row_rsMain['iPage']; ?></option>
<?php } while ($row_rsMain = mysql_fetch_assoc($rsMain)); ?>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_rsAboutPages > 0) { // Show if recordset not empty ?>
<optgroup label="About NCS">
<?php do { ?>
<option ><?php echo $row_rsAboutPages['iPage']; ?></option>
<?php } while ($row_rsAboutPages = mysql_fetch_assoc($rsAboutPages)); ?>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_rsActivities > 0) { // Show if recordset not empty ?>
<optgroup label="Activities">
<?php do { ?>
<option value="<?php echo $row_rsActivities['iPage']; ?>"><?php echo $row_rsActivities['iPage']; ?></option>
<?php } while ($row_rsActivities = mysql_fetch_assoc($rsActivities)); ?>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_rsLearning > 0) { // Show if recordset not empty ?>
<optgroup label="Learning">
<?php do { ?>
<option value="<?php echo $row_rsLearning['iPage']; ?>"><?php echo $row_rsLearning['iPage']; ?></option>
<?php } while ($row_rsLearning = mysql_fetch_assoc($rsLearning)); ?>
<?php } // Show if recordset not empty ?>
</select>
<input class="search_btn" type="submit" value="go" name="submit" /></form>
<hr>
<h1>Edit page photos</h1>
<form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="edit_PagePhoto" id="edit_PagePhoto" onSubmit="checkFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',false,'','','','','','','');showProgressWindow('fileCopyProgress.htm',300,100);return document.MM_returnValue">
<p><label>Page</label>
<input type="text" name="pageCategory" size="30" value="<?php echo $row_Recordset1['pageCategory']; ?>" />
</p>
<fieldset><legend>Photo #1</legend>
<p><label>Description</label> <input type="text" name="description1" size="30" value="<?php echo $row_Recordset1['description1']; ?>" /></p>
<p><label>Photo name</label><input name="filename1" type="text" size="30" value="<?php echo $row_Recordset1['filename1']; ?>"/></p>
<p><label>Photo</label><input name="file1" type="file" class="file" onChange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',false,'','','','','','','')" size="30" /></p>
<fieldset>
<p><label>Rotate:</label><input name="rotate1" type="text" size="2" value="<?php echo $row_Recordset1['rotate1']; ?>"/></p>
<p><label>From top:</label><input name="top1" type="text" size="2" value="<?php echo $row_Recordset1['top1']; ?>"/></p>
<p><label>From text:</label><input name="left1" type="text" size="2" value="<?php echo $row_Recordset1['left1']; ?>"/></p>
</fieldset>
</fieldset>
<fieldset><legend>Photo #2</legend>
<p><label>Description</label> <input type="text" name="description2" size="30" value="<?php echo $row_Recordset1['description2']; ?>"/></p>
<p><label>Photo name</label><input name="filename2" type="text" size="30" value="<?php echo $row_Recordset1['filename2']; ?>"/></p>
<p><label>Photo</label><input name="file2" type="file" class="file" onChange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',false,'','','','','','','')" size="30" /></p>
<fieldset>
<p><label>Rotate:</label><input name="rotate2" type="text" size="2" value="<?php echo $row_Recordset1['rotate2']; ?>"/></p>
<p><label>From top:</label><input name="top2" type="text" size="2" value="<?php echo $row_Recordset1['top2']; ?>"/></p>
<p><label>From text:</label><input name="left2" type="text" size="2" value="<?php echo $row_Recordset1['left2']; ?>"/></p>
</fieldset>
</fieldset>
<fieldset><legend>Photo #3</legend>
<p><label>Description</label> <input type="text" name="description3" size="30" value="<?php echo $row_Recordset1['description3']; ?>"/></p>
<p><label>Photo name</label><input name="filename3" type="text" size="30" value="<?php echo $row_Recordset1['filename3']; ?>"/></p>
<p><label>Photo</label><input name="file3" type="file" class="file" onChange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',false,'','','','','','','')" size="30" /></p><fieldset>
<p><label>Rotate:</label><input name="rotate3" type="text" size="2" value="<?php echo $row_Recordset1['rotate3']; ?>"/></p>
<p><label>From top:</label><input name="top3" type="text" size="2" value="<?php echo $row_Recordset1['top3']; ?>"/></p>
<p><label>From text:</label><input name="left3" type="text" size="2" value="<?php echo $row_Recordset1['left3']; ?>"/></p>
</fieldset>
</fieldset>
<p class="controls_narrow"> <input class="submit_btn" type="submit" value="submit"></p>
<input type="hidden" name="photo_ID" value="<?php echo $row_Recordset1['photo_ID']; ?>">
<input type="hidden" name="MM_update" value="edit_PagePhoto">
</form>
</div>
</div>
</div>
<div id="footer">
<p>© Copyright <script>d=new Date;document.write(d.getFullYear());</script>
- trickstar web design - All rights reserved</p>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
mysql_free_result($rsMain);
mysql_free_result($rsAboutPages);
mysql_free_result($rsActivities);
mysql_free_result($rsLearning);
?>
I really need this to work asap , I'd be happy for the existing version working with the sipp.
Replies
Replied 02 Apr 2014 00:13:09
02 Apr 2014 00:13:09 Phil Boyle replied:
I am trying get this fixed. I have followed the instructions added ppu3 then sipp and it all works but when I try and add the update record server behaviour DW throws up a javascript error message.
And I'm getting these errors a lot Notice: Use of undefined constant undefined - assumed 'undefined' in C:\xampp\htdocs\NCS\simpleupdate.php on line 15
Notice: Use of undefined constant undefined - assumed 'undefined' in C:\xampp\htdocs\NCS\simpleupdate.php on line 16
Here is a a very basic page that won't let me add the update record server behaviour:
<?php require_once('Connections/dbConn.php'); ?>
<?php require_once('ScriptLibrary/incPureUpload.php'); ?>
<?php require_once('ScriptLibrary/cGraphicMediator.php'); ?>
<?php
//*** Pure PHP File Upload 3.1.0
// Process form form
$ppu = new pureFileUpload();
$ppu->nameConflict = "over";
$ppu->storeType = "file";
$ppu->path = "cms/uploadPagePhotos";
$ppu->redirectUrl = "";
$ppu->checkVersion("3.1.0"
$ppu->doUpload();
if ($ppu->done) {
$_POST["undefined"] = undefined;
$_POST["undefined"] = undefined;
}
?>
<?php
if (!function_exists("GetSQLValueString") {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string" ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "" ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "" ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "" ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "" ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "" ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_Recordset1 = "-1";
if (isset($_POST['search_info'])) {
$colname_Recordset1 = $_POST['search_info'];
}
mysql_select_db($database_dbConn, $dbConn);
$query_Recordset1 = sprintf("SELECT * FROM pagephotostbl WHERE pageCategory = %s", GetSQLValueString($colname_Recordset1, "text");
$Recordset1 = mysql_query($query_Recordset1, $dbConn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php
// Smart Image Processor PHP 2.1.1
if (isset($_GET['GP_upload'])) {
$sipp2 = new cGraphicMediator("upload", $ppu, ""
$sipp2->setComponent("Auto"
$sipp2->setMatteColor("#FFFFFF"
$sipp2->resizeEx(50, 50, true, false);
$sipp2->overwrite = true;
$sipp2->saveJPEG(80);
$sipp2->process();
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Rough example</title>
<script type="text/javascript"><?php echo $ppu->generateScriptCode() ?></script>
<script src="ScriptLibrary/incPU3.js" type="text/javascript"></script>
</head>
<body>
I use this to select the page to edit
<form name="search_form" id="search_form" action="simpleupdate.php" method="post">
<select name="search_info">
<option>Sports teams</option>
</select>
<input class="search_btn" type="submit" value="go" name="submit" /></form>
</form>
<hr>
<h2>Very brief version of update page form</h2>
<form action="<?php echo $DMX_uploadAction ?>" method="post" enctype="multipart/form-data" name="form" onSubmit="<?php echo $ppu->getSubmitCode() ?>;return document.MM_returnValue">
<?php echo $ppu->getProgressField() ?>
<label>Photo name</label>
<input name="filename1" type="text" size="30" value="<?php echo $row_Recordset1['filename1']; ?>"/>
<label>Photo</label>
<input name="file1" type="file" class="file" onChange="<?php echo $ppu->getValidateCode() ?>;return document.MM_returnValue" />
<input class="submit_btn" type="submit" value="submit">
<input type="hidden" name="photo_ID" value="<?php echo $row_Recordset1['photo_ID']; ?>">
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
I have uninstalled and reinstalled the extensions, have all the latest versions with DW cc. I wanted to delete the DW cache but my computer with windows 7 doesn't match these directions:
For Dreamweaver CC:
Vista, 7 & 8: C:\Users\<username>\AppData\Roaming\Adobe\Dreamweaver CC\<language>\Configuration
I really am at a loss of what to try next.
And I'm getting these errors a lot Notice: Use of undefined constant undefined - assumed 'undefined' in C:\xampp\htdocs\NCS\simpleupdate.php on line 15
Notice: Use of undefined constant undefined - assumed 'undefined' in C:\xampp\htdocs\NCS\simpleupdate.php on line 16
Here is a a very basic page that won't let me add the update record server behaviour:
<?php require_once('Connections/dbConn.php'); ?>
<?php require_once('ScriptLibrary/incPureUpload.php'); ?>
<?php require_once('ScriptLibrary/cGraphicMediator.php'); ?>
<?php
//*** Pure PHP File Upload 3.1.0
// Process form form
$ppu = new pureFileUpload();
$ppu->nameConflict = "over";
$ppu->storeType = "file";
$ppu->path = "cms/uploadPagePhotos";
$ppu->redirectUrl = "";
$ppu->checkVersion("3.1.0"
$ppu->doUpload();
if ($ppu->done) {
$_POST["undefined"] = undefined;
$_POST["undefined"] = undefined;
}
?>
<?php
if (!function_exists("GetSQLValueString") {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string" ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "" ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "" ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "" ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "" ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "" ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_Recordset1 = "-1";
if (isset($_POST['search_info'])) {
$colname_Recordset1 = $_POST['search_info'];
}
mysql_select_db($database_dbConn, $dbConn);
$query_Recordset1 = sprintf("SELECT * FROM pagephotostbl WHERE pageCategory = %s", GetSQLValueString($colname_Recordset1, "text");
$Recordset1 = mysql_query($query_Recordset1, $dbConn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php
// Smart Image Processor PHP 2.1.1
if (isset($_GET['GP_upload'])) {
$sipp2 = new cGraphicMediator("upload", $ppu, ""
$sipp2->setComponent("Auto"
$sipp2->setMatteColor("#FFFFFF"
$sipp2->resizeEx(50, 50, true, false);
$sipp2->overwrite = true;
$sipp2->saveJPEG(80);
$sipp2->process();
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Rough example</title>
<script type="text/javascript"><?php echo $ppu->generateScriptCode() ?></script>
<script src="ScriptLibrary/incPU3.js" type="text/javascript"></script>
</head>
<body>
I use this to select the page to edit
<form name="search_form" id="search_form" action="simpleupdate.php" method="post">
<select name="search_info">
<option>Sports teams</option>
</select>
<input class="search_btn" type="submit" value="go" name="submit" /></form>
</form>
<hr>
<h2>Very brief version of update page form</h2>
<form action="<?php echo $DMX_uploadAction ?>" method="post" enctype="multipart/form-data" name="form" onSubmit="<?php echo $ppu->getSubmitCode() ?>;return document.MM_returnValue">
<?php echo $ppu->getProgressField() ?>
<label>Photo name</label>
<input name="filename1" type="text" size="30" value="<?php echo $row_Recordset1['filename1']; ?>"/>
<label>Photo</label>
<input name="file1" type="file" class="file" onChange="<?php echo $ppu->getValidateCode() ?>;return document.MM_returnValue" />
<input class="submit_btn" type="submit" value="submit">
<input type="hidden" name="photo_ID" value="<?php echo $row_Recordset1['photo_ID']; ?>">
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
I have uninstalled and reinstalled the extensions, have all the latest versions with DW cc. I wanted to delete the DW cache but my computer with windows 7 doesn't match these directions:
For Dreamweaver CC:
Vista, 7 & 8: C:\Users\<username>\AppData\Roaming\Adobe\Dreamweaver CC\<language>\Configuration
I really am at a loss of what to try next.
Replied 02 Apr 2014 00:32:17
02 Apr 2014 00:32:17 Phil Boyle replied:
I have another go at the page where I had manually tried to add the update record server behaviour and discovered a couple of errors so I have got everything working. However when I pass on the form value to select the page to edit I am still getting the undefined errors.
Notice: Use of undefined constant undefined - assumed 'undefined' in C:\xampp\htdocs\NCS\cms\TESTedit_pagePhoto.php on line 18
Notice: Use of undefined constant undefined - assumed 'undefined' in C:\xampp\htdocs\NCS\cms\TESTedit_pagePhoto.php on line 19
And the other problems are still a problem if I could do all this work manually I wouldn't need to buy your extensions. So I still need help with this.
Notice: Use of undefined constant undefined - assumed 'undefined' in C:\xampp\htdocs\NCS\cms\TESTedit_pagePhoto.php on line 18
Notice: Use of undefined constant undefined - assumed 'undefined' in C:\xampp\htdocs\NCS\cms\TESTedit_pagePhoto.php on line 19
And the other problems are still a problem if I could do all this work manually I wouldn't need to buy your extensions. So I still need help with this.