PHP Code:
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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($_POST["MM_insert"])) && ($_POST["MM_insert"] == "RegForm")) {
$insertSQL = sprintf("INSERT INTO Registrations (UserID, day_pre, conf, Workshops, Track, CEU, Meals_1, Meals_2, Meals_3, Meals_4, Meals_5, meal_vegan, meal_vegetarian, meal_wheat, meal_dairy, meal_other, HUB, payment_method, CCNum, CCexp, CCV, CheckNum, CheckDate, WireNum, FirstName, LastName, Organization, Address, Address2, `State`, StateProv, City, PostalCode, Phone, Country, payment_other, payment_other_name, notes) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['UserID'], "text"),
GetSQLValueString(isset($_POST['day_pre']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['conf']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString($_POST['Workshops'], "text"),
GetSQLValueString($_POST['Track'], "text"),
GetSQLValueString($_POST['CEU'], "text"),
GetSQLValueString(isset($_POST['Meals_1']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['Meals_2']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['Meals_3']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['Meals_4']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['Meals_5']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['meal_vegan']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['meal_vegetarian']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['meal_wheat']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['meal_dairy']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString($_POST['meal_other'], "text"),
GetSQLValueString(isset($_POST['HUB']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString($_POST['payment_method'], "text"),
GetSQLValueString($_POST['CCNum'], "text"),
GetSQLValueString($_POST['CCexp'], "text"),
GetSQLValueString($_POST['CCV'], "text"),
GetSQLValueString($_POST['CheckNum'], "text"),
GetSQLValueString($_POST['CheckDate'], "text"),
GetSQLValueString($_POST['WireNum'], "text"),
GetSQLValueString($_POST['FirstName'], "text"),
GetSQLValueString($_POST['LastName'], "text"),
GetSQLValueString($_POST['Organization'], "text"),
GetSQLValueString($_POST['Address'], "text"),
GetSQLValueString($_POST['Address2'], "text"),
GetSQLValueString($_POST['State'], "text"),
GetSQLValueString($_POST['StateProv'], "text"),
GetSQLValueString($_POST['City'], "text"),
GetSQLValueString($_POST['PostalCode'], "text"),
GetSQLValueString($_POST['Phone'], "text"),
GetSQLValueString($_POST['Country'], "text"),
GetSQLValueString(isset($_POST['payment_other']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString($_POST['payment_other_name'], "text"),
GetSQLValueString($_POST['notes'], "text"));
mysql_select_db($database_conference, $conference);
$Result1 = mysql_query($insertSQL, $conference) or die(mysql_error());
$insertGoTo = "register3a.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_conference, $conference);
$query_rs_ceus = "SELECT * FROM CEUs ORDER BY code ASC";
$rs_ceus = mysql_query($query_rs_ceus, $conference) or die(mysql_error());
$row_rs_ceus = mysql_fetch_assoc($rs_ceus);
$totalRows_rs_ceus = mysql_num_rows($rs_ceus);
mysql_select_db($database_conference, $conference);
$query_rs_states = "SELECT * FROM States ORDER BY stprv_ID ASC";
$rs_states = mysql_query($query_rs_states, $conference) or die(mysql_error());
$row_rs_states = mysql_fetch_assoc($rs_states);
$totalRows_rs_states = mysql_num_rows($rs_states);
$colname_rs_user = "1";
if (isset($_GET['Email1'])) {
$colname_rs_user = (get_magic_quotes_gpc()) ? $_GET['Email1'] : addslashes($_GET['Email1']);
}
mysql_select_db($database_conference, $conference);
$query_rs_user = sprintf("SELECT * FROM Attendee WHERE Email1 = '%s'", $colname_rs_user);
$rs_user = mysql_query($query_rs_user, $conference) or die(mysql_error());
$row_rs_user = mysql_fetch_assoc($rs_user);
$totalRows_rs_user = mysql_num_rows($rs_user);
?>
And on the redirect page:
Bookmarks