$xv) {
if($xv == '') {
unset($_POST[$xa]);
}
}
###############################################################################
## Soholaunch(R) Site Management Tool
## Version 4.5
##
## Author: Mike Johnston [mike.johnston@soholaunch.com]
## Homepage: http://www.soholaunch.com
## Bug Reports: http://bugzilla.soholaunch.com
## Release Notes: sohoadmin/build.dat.php
###############################################################################
##############################################################################
## COPYRIGHT NOTICE
## Copyright 1999-2003 Soholaunch.com, Inc. and Mike Johnston
## Copyright 2003-2007 Soholaunch.com, Inc.
## All Rights Reserved.
##
## This script may be used and modified in accordance to the license
## agreement attached (license.txt) except where expressly noted within
## commented areas of the code body. This copyright notice and the comments
## comments above and below must remain intact at all times. By using this
## code you agree to indemnify Soholaunch.com, Inc, its coporate agents
## and affiliates from any liability that might arise from its use.
##
## Selling the code for this program without prior written consent is
## expressly forbidden and in violation of Domestic and International
## copyright laws.
###############################################################################
##################################################################
### FIND THE PAGE THAT THIS SCRIPT IS RUNNING ON SO THAT WE CAN
### POST ALL DATA BACK TO THE SAME PAGE. THIS WAY THIS FUNCTION
### ONLY REQUIRES A SINGLE PAGE TO OPERATE.
##################################################################
$tmp = $PHP_SELF;
$tmp_root = split("/", $tmp);
$tmp_cnt = count($tmp_root);
$tmp_cnt--;
$link_page = $tmp_root[$tmp_cnt];
reset($HTTP_POST_VARS);
while (list($name, $value) = each($HTTP_POST_VARS)) {
$value = htmlspecialchars($value); // Bugzilla #13
${$name} = $value;
}
##################################################################
### STANDARDIZE CONFIGURATION SECTION : MODIFIED BY THE SEARCH
### WIZARD WHEN OUTPUTING FINAL INCLUDE FILE.
##################################################################
$SEARCH_NAME = "10103";
$TABLE_NAME = "UDT_CART_DATA_NOVELTY_BABY_TSHIRTS";
$KEYWORD_SEARCH_ORDER_NUMBER = "on";
$DROPDOWNBOX_PRIKEY_SORTORDER = "ASC";
$DROPDOWNBOX_ORDER_NUMBER = "on";
$DROPDOWNBOX_ORDER_NUMBER_SORTORDER = "ASC";
$DROPDOWNBOX_SIZE_SORTORDER = "ASC";
$DROPDOWNBOX_TSHIRT_COLOUR_SORTORDER = "ASC";
$DROPDOWNBOX_TSHIRT_NECKRIB_COLOUR_SORTORDER = "ASC";
$DROPDOWNBOX_NOVELTY_SAYING_PLEASE_USE_KEY_WORDS_SORTORDER = "ASC";
$DROPDOWNBOX_TEXT_COLOUR_SORTORDER = "ASC";
$DROPDOWNBOX_EXTRA_NOTES_OPTIONAL_SORTORDER = "ASC";
$DROPDOWNBOX_FORM_NUMBER_SORTORDER = "ASC";
$DROPDOWNBOX_PURCHASER_SORTORDER = "ASC";
$DROPDOWNBOX_ORDER_DATE_SORTORDER = "ASC";
$NXT = " Next >> ";
$KEY_FIELD_SEARCH = "ORDER_NUMBER";
$DISPLAY_PRIKEY = "I";
$DISPLAY_ORDER_NUMBER = "I";
$DISPLAY_SIZE = "I";
$DISPLAY_TSHIRT_COLOUR = "I";
$DISPLAY_TSHIRT_NECKRIB_COLOUR = "I";
$DISPLAY_NOVELTY_SAYING_PLEASE_USE_KEY_WORDS = "I";
$DISPLAY_TEXT_COLOUR = "I";
$DISPLAY_EXTRA_NOTES_OPTIONAL = "I";
$DISPLAY_FORM_NUMBER = "I";
$DISPLAY_PURCHASER = "I";
$DISPLAY_ORDER_DATE = "I";
$DETAILS_DISPLAY = "S";
$DBSEARCH_BASE = "standard";
$SEARCH_SECURITY_CODE = "Public";
#################################################################
### MANAGE RECORD EDIT/UPDATE NOW BEFORE WE CLOUD VARIABLE
### DATA WITH CHANGES.
#################################################################
if ($SAVE_UPDATED_REC == "ON") {
$ulerr = 0;
if ($FILE1 != "none" && $FILE1 != "") { // Is there even a file here to upload?
$filename = "FILE1_name";
$filename = ${$filename};
$filesize = "FILE1_size";
$filesize = ${$filesize};
$FILE = "FILE1";
$FILE = ${$FILE};
// -----------------------------------------------------------------------
// Only allow .JPG and .GIF Images Under 60K, otherwise some idiot will
// try to upload a 300dpi scanned image of his dog or something!
// -----------------------------------------------------------------------
$fileok = 0;
$checkfor = strtolower($filename);
$filename = eregi_replace(" ", "_", $filename);
// $filename = sterilize($filename);
if (strstr($checkfor, ".gif") || strstr($checkfor, ".jpg") || strstr($checkfor, ".jpeg")) {
$filename = $filename;
$newfile = "$doc_root/images/UDT-UPLOAD_".$filename;
if ($filesize < 60000) { $fileok = 1; }
$DATA_TABLE_FILENAME = "UDT-UPLOAD_".$filename; // Bad habit of reusing $filename alot!
}
if($fileok == 1 ) {
$newfile = stripslashes($newfile);
$tempfile = stripslashes($FILE);
@unlink($newfile);
if(@copy($tempfile, $newfile)) { $ulerr = 0; } else { $ulerr = 1; }
} else {
$ulerr = 2;
}
if ($ulerr == 1) { echo "The server timed out during upload. Retry using the back button."; exit; }
if ($ulerr == 2) { echo "This file is larger than 60k or is not a valid file type."; exit; }
} // End if there is even a file to upload check
// Let's Update the Data Table to Reflect the user changes. Again, we must take the
// long way around the bend to do this because we don't know what kind of data is
// used in the table...
$SQL_STRING = "UPDATE $TABLE_NAME SET ";
$tmp_date = ""; // Prepare our tmp date string register
$tmp_time = ""; // Prepare our tmp time string register as well
reset($HTTP_POST_VARS);
while (list($name, $value) = each($HTTP_POST_VARS)) {
$value = eregi_replace("\n", " ", $value);
$value = eregi_replace("\r", "", $value);
$value = stripslashes($value); // First strip all slashes for insurance and refreshes
$value = addslashes($value); // Now add slashes for proper mysql data storage
if (ereg("VALUE_", $name) && !ereg("_DATEYEAR", $name) && !ereg("_DATEMONTH", $name) && !ereg("_DATEDAY", $name) && !ereg("_TIMEHOUR", $name) && !ereg("_TIMEMIN", $name)) { // This is a proper value
$name = ereg_replace("VALUE_", "", $name);
if ($name == "AUTO_IMAGE" && $FILE1 != "none") {
$value = "$DATA_TABLE_FILENAME";
if ($DATA_TABLE_FILENAME == "") { $value = $VALUE_AUTO_IMAGE; }
}
if (eregi("Email", $name)) { $BRAND_NEW_EMAIL = $value; }
$SQL_STRING .= "$name = '$value', ";
}
if (ereg("_DATE", $name)) {
if (ereg("_DATEMONTH", $name)) { $tmp_date .= "$value-"; }
if (ereg("_DATEDAY", $name)) { $tmp_date .= "$value"; }
if (ereg("_DATEYEAR", $name)) {
$tmp_date = "$value-" . $tmp_date;
$name = ereg_replace("VALUE_", "", $name);
$name = ereg_replace("_DATEYEAR", "", $name);
$SQL_STRING .= "$name = '$tmp_date', "; // Now add to SQL string for processing
$tmp_date = ""; // Reset tmp date string in case of a second date value
}
}
if (ereg("_TIME", $name)) {
if (ereg("_TIMEHOUR", $name)) { $tmp_time .= "$value:"; }
if (ereg("_TIMEMIN", $name)) {
$tmp_time .= "$value:00"; // Add minute to time string
$name = ereg_replace("VALUE_", "", $name);
$name = ereg_replace("_TIMEMIN", "", $name);
$SQL_STRING .= "$name = '$tmp_time', "; // Now add to SQL string for processing
$tmp_time = ""; // Reset tmp time string in case of a second time value
}
}
} // End WHILE loop
// A bi-product of this loop method is the extra comma we
// get at the end of our new sql_string. Let's remove it.
$tmp = strlen($SQL_STRING);
$new = $tmp - 2;
$SQL_STRING = substr($SQL_STRING, 0, $new);
$EDIT_WHERE_STRING = stripslashes($EDIT_WHERE_STRING);
$SQL_STRING .= " WHERE prikey = '".$recid."'";
// echo "$SQL_STRING";
// exit;
if ( !mysql_query("$SQL_STRING") ) { // UPDATE DATA NOW!
//echo "
$SQL_STRING ";
echo "Unable to save record data!
\n";
echo "Check your information for problematic characters like single (apostrophe) and double (standard) quotes, \n";
echo "commas, ampersands (&), semicolons, question marks, etc.
";
} // End Save/Update Rec Function
##################################################################
### CHECK SECURITY CLEARANCE
##################################################################
$ALLOW_ACCESS_DB = 0;
if ($GROUPS != "") {
$grp_tmp = split(";", $GROUPS); // Split this user's sec code groups into individual array
$grp_cnt = count($grp_tmp); // How Many sec groups does this user have access to?
for ($gl=0;$gl<=$grp_cnt;$gl++) { // Check Users Access level against required sec level for this search
if ($grp_tmp[$gl] != "") {
if (eregi("$SEARCH_SECURITY_CODE", $grp_tmp[$gl])) { $ALLOW_ACCESS_DB = 1; }
}
}
} // End if $GROUPS isset
if ($SEARCH_SECURITY_CODE == "Public") { $ALLOW_ACCESS_DB = 1; }
if ($ALLOW_ACCESS_DB != 1) {
$SDB_STEP_CONTROL = "10000"; // Just don't display anything to unauthorized user
}
##################################################################
### START INCLUDE FORM DATA. ITS THE SAME NO MATTER WHICH STEP
### THAT WE ARE EXECUTING.
##################################################################
echo " \n";
echo "
\n";
/// Display initial results as form with hidden fields containing mysql search info
###=========================================================================================
$i = 0; // Reset Record Count
while ($row = mysql_fetch_array($result)) {
echo "
\n";
if ($keyword_activation == 1) {
$USER_FORM .= "$SEARCH_COUNT. Search by Keyword: (Separate multiple keywords by spaces) [ $keydisplay ]
\n";
$USER_FORM .= " in $key_opts
\n";
$SEARCH_COUNT++;
} // End, If keywords are in use
if ($dropdown_activation == 1) {
$USER_FORM .= "$SEARCH_COUNT. Detail Search:
\n";
$USER_FORM .= "
\n";
$x = 0; // Reset our field counter
$width_count = 0; // Place two drop down selections per row; so lets reset
while ($x <= $numberFields) {
if ($width_count == 2) {
$width_count = 0;
$USER_FORM .= "\n";
$spacer_flag = 1;
}
$tmp_data = "DROPDOWNBOX_".$fieldname[$x];
$tmp_sort = "DROPDOWNBOX_".$fieldname[$x]."_SORTORDER";
$tmp_sort = ${$tmp_sort};
if (${$tmp_data} == "on") { // Has drop down been activated for this field?
if ($width_count == 0) {
$USER_FORM .= "
";
}
$this_option = "\n";
$result = mysql_query("SELECT DISTINCT $fieldname[$x] FROM $TABLE_NAME ORDER BY $fieldname[$x] $tmp_sort"); // Index this field
while ($row = mysql_fetch_array($result)) {
$v = $row[$fieldname[$x]];
$this_option .= "\n";
}
$display_fn = eregi_replace("_", " ", $fieldname[$x]);
$display_fn = strtolower($display_fn);
$display_fn = ucwords($display_fn);
$USER_FORM .= "
$display_fn:
\n";
$width_count++;
} // End if Drop Down activated for this field
$x++; // Increment our field counter
} // End Field While Loop
if ($width_count == 0) { $USER_FORM .= "
\n"; // End Drop Down Table
$SEARCH_COUNT++;
} // End, If Dropdown Activation is on
if ($keyword_activation == 1 && $dropdown_activation == 1) {
// Show Search Detail Options
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$USER_FORM .= "
\n"; // End End-User Display Table
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo $USER_FORM;
} // End Step One
##################################################################
//
// ########
// ##
// ##
// #####
// ##
// ##
// ##
// #######
//
##################################################################
if ($SDB_STEP_CONTROL == "3") {
echo "\n";
if ($DETAILS_DISPLAY == "C") { // If this is a custom include details page; is so show now
include("media/$DETAILS_DISPLAY_INC");
} else { // Otherwise; use standard display
echo "\n\n";
echo "\n\n";
echo "
";
$EDIT_SECURITY_CHECK = ""; // Clear Security Check for Record Owner
$result = mysql_query("SELECT * FROM $TABLE_NAME WHERE PRIKEY = '$ROW_NUM'");
$i = $ROW_NUM; // Set Row Counter to PriKey Value
while ($row = mysql_fetch_array($result)) {
if ($i == $ROW_NUM) { // Display this record
$EDIT_SECURITY_CHECK = $row[AUTO_SECURITY_AUTH]; // Does this record have an edit MD5 key?
if ($row[AUTO_IMAGE] != "NULL" && eregi("AUTO_IMAGE", $detail_display)) {
// ############################################
// Show "Image Ready" display for this record
// ############################################
$tmp = split(",", $detail_display);
$tmp_cnt = count($tmp);
// ---------------------------------------------------------------------------
// Get Image Data Now because we already know that AUTO_IMAGE has data in it.
// ---------------------------------------------------------------------------
$iname = $row[AUTO_IMAGE];
$iname = chop($iname);
$iname = ltrim($iname);
$iname = rtrim($iname);
$imagename = "$doc_root/images/$iname";
if (file_exists("$imagename")) {
$tempArray = getImageSize("$imagename");
$origW = $tempArray[0];
$origH = "HEIGHT=" . $tempArray[1];
if ($origW > 275) { $origW = "275"; $origH = ""; }
$WH = "WIDTH=$origW $origH";
$THIS_IMAGE = "";
} else {
$THIS_IMAGE = "";
}
// ---------------------------------------------------------------------------
echo "
\n";
echo "
$THIS_IMAGE
\n";
for ($x=0;$x<=$tmp_cnt;$x++) {
// Format Field for proper match
$this_field = chop($tmp[$x]);
$this_field = ltrim($this_field);
$this_field = rtrim($this_field);
if ($this_field != "" && $this_field != "AUTO_IMAGE" && $this_field != "AUTO_SECURITY_AUTH") { // In case of wierd split routine; bi-product of PHP
if ($row[$this_field] == "NULL") { $display_value = " "; } else { $display_value = $row[$this_field]; }
// Now Let's add some cool stuff like email and web linking, etc.
if (eregi("email", $this_field)) { $display_value = "$display_value"; }
if (eregi("http://", $display_value)) { $display_value = "$display_value"; }
$this_field = strtolower($this_field);
$this_field = ucwords($this_field);
echo "
$this_field:
$display_value
\n";
$tmp_row_counter++;
}
} // End For Loop through field names
// echo "
\n"; // Visual Spacing
echo "
\n";
// ======================= END IMAGE DISPLAY =========================
} else {
// ############################################
// Show Non-Image display for this record
// ############################################
echo "
\n"; }
// Format Field for proper match
$this_field = chop($tmp[$x]);
$this_field = ltrim($this_field);
$this_field = rtrim($this_field);
// Check for an authorized user logged in as owner
// of this record
if ($this_field != "" && $this_field != "AUTO_IMAGE") { // In case of wierd split routine; bi-product of PHP
if ($row[$this_field] == "NULL") { $display_value = " "; } else { $display_value = $row[$this_field]; }
// Now Let's add some cool stuff like email and web linking, etc.
if (eregi("email", $this_field)) { $display_value = "$display_value"; }
if (eregi("http://", $display_value)) { $display_value = "$display_value"; }
$this_field = strtolower($this_field);
$this_field = ucwords($this_field);
echo "
$this_field:
$display_value
\n";
$tmp_row_counter++;
}
if ($tmp_row_counter == 2) { echo "\n"; $tmp_row_counter = 0; }
} // End For Loop through field names
if ($tmp_row_counter == 1) { echo "
\n"; } // In case of ODD ending count
echo "
\n";
} // End Auto_Image Check
} // End If ROW_NUM is found
$i++;
} // End While Loop
} // End Details Display Type Check
// ------------------------------------------------------------------
// Is the owner of the Record logged in via sec login? If so, allow
// this user to edit record data from site now. (Cool Feature if I
// do say so myself-- Thanks Jim!)
// ------------------------------------------------------------------
if ($GROUPS != "" && $MD5CODE == $EDIT_SECURITY_CHECK) {
echo "\n\n\n\n";
}
// ------------------------------------------------------------------
echo "
\n\n";
echo "\n\n\n\n";
} // End Step Three
##################################################################
//
// ######## ###### ###### ##########
// ## ## ## ## ##
// ## ## ## ## ##
// ####### ## ## ## ##
// ## ## ## ## ##
// ## ## ## ## ##
// ## ## ## ## ##
// ######## ####### ###### ##
//
##################################################################
if ($EDIT_DB_RECORD == "YES") {
$result = mysql_query("SELECT * FROM $TABLE_NAME");
$numberFields = mysql_num_fields($result);
$numberFields--;
$detail_display = "";
for ($x=0;$x<=$numberFields;$x++) {
$fieldname[$x] = mysql_field_name($result, $x);
$fieldname[$x] = $fieldname[$x];
$tmp = "DISPLAY_".$fieldname[$x];
if (${$tmp} == "D" || ${$tmp} == "B") { $detail_display .= "$fieldname[$x], "; }
}
$str_tmp = strlen($detail_display);
$str_new = $str_tmp - 2;
$detail_display = substr($detail_display, 0, $str_new); // Remove extra comma in string
$SQL_SEARCH = stripslashes($SQL_LAST_SEARCH); // Remove slashes from "posted" transfer
$SQL_SEARCH = ereg_replace("SELECT (.*) FROM", "SELECT $detail_display FROM", $SQL_SEARCH); // Replace previous "selected fields" with Detail fields
$SEC_EMAIL_CHECK = ""; // Clear Security Check for Record Owner One More Time in case we has session thief
$result = mysql_query("SELECT $detail_display FROM $TABLE_NAME WHERE PRIKEY = '$PRIKEY_DATA'");
$numberFields = mysql_num_fields($result);
$numberFields--;
$i = $PRIKEY_DATA; // Reset Row Counter
while ($row = mysql_fetch_array($result)) {
if ($i == $PRIKEY_DATA) { // Here's our Key! (Crude but effective)
for ($z=0;$z<=$numberFields;$z++) {
$FIELD_DATA[$z] = $row[$z]; // Place data values into array for next section
}
} // End if $i
$i++; // Must increment count !important!
} // End While
// --------------------------------------------------------------------------
// Present Edit Form for User. Remember to utilize ENCRYPT-FORM for image
// upload capability here. Do we move these images to another folder? You
// guys figure it out... I've got a deadline. :)
// --------------------------------------------------------------------------
echo "\n\n"; // Close that great idea we had for all the previous steps. :)
echo "\n\n\n";
} // End Edit Data Record
?>