I am having a hard time figuring out what is going on.
Everytime that Insert/Upload a new image to the site, all of the fields and data are inserted correctly, but for some reason there is also a blank record that is created at the same time.
Here is the code:
<?php //********************** // DwZone Upload Resize //********************** require_once("dwzUpload/dwzUpload.php"); require_once('Connections/BergerAustralienDB.php'); ?> <?php require_once('Connections/BergerAustralienDB.php'); ?> <?php if (!isset($_SESSION)) { session_start(); } $MM_authorizedUsers = ""; $MM_donotCheckaccess = "true";
// *** 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 == "") && true) { $isValid = true; } } return $isValid; }
$MM_restrictGoTo = "IntranetLogin.php"; 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($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) $MM_referrer .= "?" . $_SERVER['QUERY_STRING']; $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer); header("Location: ". $MM_restrictGoTo); exit; } ?> <?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; } }
mysql_select_db($database_BergerAustralienDB, $BergerAustralienDB); $query_rsNoSequence = "SELECT Max(SequenceNo) FROM NosChiens"; $rsNoSequence = mysql_query($query_rsNoSequence, $BergerAustralienDB) or die(mysql_error()); $row_rsNoSequence = mysql_fetch_assoc($rsNoSequence); $totalRows_rsNoSequence = mysql_num_rows($rsNoSequence);
mysql_select_db($database_BergerAustralienDB, $BergerAustralienDB); $query_rsYesNO = "SELECT * FROM YesNo"; $rsYesNO = mysql_query($query_rsYesNO, $BergerAustralienDB) or die(mysql_error()); $row_rsYesNO = mysql_fetch_assoc($rsYesNO); $totalRows_rsYesNO = mysql_num_rows($rsYesNO); ?> <?php //************************** // INSERT RECORD UPLOAD // http://www.DwZone-it.com // Version: 1.1.8 //************************** set_time_limit(5400); $upload = new dwzUpload(); $upload->SetProgressBar(""); $upload->SetTempFolder("undefined"); $upload->SetTotalFileSize(""); $upload->SetRedirectUrl("Intranet.php"); $upload->SetFiles("/Photos/Nos Chiens/;1;;;;0;Image;1;;;;0;;;;Thumbnail;1;;1;Image@_@_@0@_@_@php@_@_@-1;800;600;80;-1;223;150;80;-1;_th;-1;1;0;;;80;0;_small;0@_@_@./@_@_@POST"); $upload->SetFormName("form1"); $upload->SetUploadType("insert"); $upload->SetValueToRedirectSend("Description|NomChien|NoSequence|YesNo"); $upload->SetDbParam($hostname_BergerAustralienDB, $database_BergerAustralienDB, $username_BergerAustralienDB, $password_BergerAustralienDB); $upload->SetEditTable("NosChiens"); $upload->SetFields("NoSequence|value|NomChien|value|Description|value|YesNo|value"); $upload->SetColumns("SequenceNo|int|DogName|text|Description|text|DisplayInd|text"); $upload->Execute(); ?> <!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> <?php //********************** // DwZone Upload Resize //********************** require_once("dwzUpload/dwzUploadClient.php"); ?> <meta name="robots" content="noindex"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Berger Australien - Ajouter Chiens</title> </head>
<body> <form ACTION="<?php echo $upload->GetEditAction(); ?>" onsubmit="return ProgressBar()" method="post" enctype="multipart/form-data" name="form1" id="form1"> <table width="100%" border="1" cellspacing="0" cellpadding="5"> <tr> <td colspan="2">Enter les details</td> </tr> <tr> <td width="12%"> </td> <td width="88%"> </td> </tr> <tr> <td>No Sequence:</td> <td><label for="NoSequence"></label> <input type="text" name="NoSequence" id="NoSequence" /> (Dernier # Séquence utiliser = <?php echo $row_rsNoSequence['Max(SequenceNo)']; ?>)</td> </tr> <tr> <td>Nom du Chien:</td> <td><label for="NomChien"></label> <input type="text" name="NomChien" id="NomChien" /></td> </tr> <tr> <td>Description:</td> <td><label for="Description"></label> <textarea name="Description" cols="100" id="Description"></textarea></td> </tr> <tr> <td>Image:</td> <td><label for="Image"></label> <label for="Image2"></label> <input name="Image" type="file" id="Image2" onchange="dwz_setEvent(this,'change')" onclick="dwz_setEvent(this,'click')" size="75" /></td> </tr> <tr> <td>Display:</td> <td><label for="YesNo"></label> <select name="YesNo" id="YesNo"> <?php do { ?> <option value="<?php echo $row_rsYesNO['Value']?>"<?php if (!(strcmp($row_rsYesNO['Value'], "Y"))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsYesNO['Value']?></option> <?php } while ($row_rsYesNO = mysql_fetch_assoc($rsYesNO)); $rows = mysql_num_rows($rsYesNO); if($rows > 0) { mysql_data_seek($rsYesNO, 0); $row_rsYesNO = mysql_fetch_assoc($rsYesNO); } ?> </select></td> </tr> <tr> <td> </td> <td><table border="0" cellspacing="0" cellpadding="5"> <tr> <td><input type="submit" name="dwzSubmit" id="dwzSubmit" value="Submit" /></td> <td><input type=button value="Cancel" onclick="javascript:window.location='Intranet.php';" /></td> </tr> </table></td> </tr> </table> <input type="hidden" name="dwzUpload" id="dwzUpload" value="form1" /> </form> </body> </html> <?php mysql_free_result($rsNoSequence);
mysql_free_result($rsYesNO); ?>
Hoping some one can help
thanks in advance
Pierre Letourneau |
|
|