Just in case here is the full page code -- thanks again.
<?php require_once('Connections/dpConnect.php'); ?>
<?php require_once("WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
<?php require_once("WA_DigitalFilePro/HelperPHP.php"); ?>
<?php
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;
}
}
?>
<?php
// *** Redirect if username exists
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
$MM_dupKeyRedirect="duplicate.php";
$loginUsername = $_POST['UserEmail'];
$LoginRS__query = "SELECT UserEmail FROM users WHERE UserEmail='" . $loginUsername . "'";
mysql_select_db($database_dpConnect, $dpConnect);
$LoginRS=mysql_query($LoginRS__query, $dpConnect) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
//if there is a row in the database, the username was found - can not add the requested username
if($loginFoundUser){
$MM_qsChar = "?";
//append the username to the redirect page
if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
$MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
header ("Location: $MM_dupKeyRedirect");
exit;
}
}
?>
<?php
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
?>
<?php
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "WAATKRegistrationForm")) {
$insertSQL = sprintf("INSERT INTO users (UserFirstName, UserLastName, UserPhone, UserEmail, UserPassword, PetName, PetImage, ContestTerms) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['UserFirstName'], "text"), GetSQLValueString($_POST['UserLastName'], "text"), GetSQLValueString($_POST['UserPhone'], "text"), GetSQLValueString($_POST['UserEmail'], "text"), GetSQLValueString($_POST['UserPassword'], "text"), GetSQLValueString($_POST['PetName'], "text"), GetSQLValueString($_POST['PetImage'], "text"), GetSQLValueString($_POST['ContestTerms'], "int"));
mysql_select_db($database_dpConnect, $dpConnect);
$Result1 = mysql_query($insertSQL, $dpConnect) or die(mysql_error());
$insertGoTo = "users_LogIn.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}?>
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "../images/petImages/",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "4",
'ResizeWidth' => "200",
'ResizeHeight' => "150",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if($_SERVER["REQUEST_METHOD"] == "POST"){
WA_DFP_UploadFiles("WA_UploadResult1", "PetImage", "0", "", "JPG:80", $WA_UploadResult1_Params);
}?>
<?php
// WA Application Builder Insert
if ($_SERVER["REQUEST_METHOD"] == "POST") // Trigger
{
$WA_connection = $dpConnect;
$WA_table = "users";
$WA_sessionName = "users_UserID";
$WA_redirectURL = "";
$WA_keepQueryString = false;
$WA_indexField = "UserID";
$WA_fieldNamesStr = "PetImage";
$WA_fieldValuesStr = "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] ."";
$WA_columnTypesStr = "',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_dpConnect;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
$_SESSION[$WA_sessionName] = mysql_insert_id();
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Registration</title>
<link href="WA_SecurityAssist/styles/Refined_Pacifica.css" rel="stylesheet" type="text/css" />
<link href="WA_SecurityAssist/styles/Arial.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="RegistrationContainer" class="WAATK">
<form action="<?php echo $editFormAction; ?>" method="post" name="WAATKRegistrationForm" id="WAATKRegistrationForm">
<h1>Registration</h1>
<table class="WAATKDataTable" cellpadding="0" cellspacing="0" border="0">
<tr>
<th>First Name:</th>
<td><input type="text" class="WAATKTextField" name="UserFirstName" id="UserFirstName" value="" size="32" /></td>
</tr>
<tr>
<th>Last Name:</th>
<td><input type="text" class="WAATKTextField" name="UserLastName" id="UserLastName" value="" size="32" /></td>
</tr>
<tr>
<th>Phone Number:</th>
<td><input type="text" class="WAATKTextField" name="UserPhone" id="UserPhone" value="" size="32" /></td>
</tr>
<tr>
<th>Email Address:</th>
<td><input type="text" class="WAATKTextField" name="UserEmail" id="UserEmail" value="" size="32" /></td>
</tr>
<tr>
<th>Password:</th>
<td><input type="password" class="WAATKTextField" name="UserPassword" id="UserPassword" value="" ></td>
</tr>
<tr>
<th>Pet Name:</th>
<td><input type="text" class="WAATKTextField" name="PetName" id="PetName" value="" size="32" /></td>
</tr>
<tr>
<th>Pet Image:</th>
<td><input name="PetImage" type="file" id="PetImage"></td>
</tr>
<tr>
<th>Contest Terms:</th>
<td><input type="checkbox" name="ContestTerms" id="ContestTerms" value="1" /></td>
</tr>
</table>
<div class="WAATKButtonRow">
<input type="image" hspace="0" vspace="0" border="0" name="Register" id="Register" value="Register" alt="Register" src="WA_SecurityAssist/images/Pacifica/Refined_register.gif" />
<input type="hidden" name="MM_insert" value="WAATKRegistrationForm">
</div>
</form>
</div>
</body>
</html>