Okay, Here it is:
<?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 = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO users (email, password, `first`, `last`, offers) VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['email'], "text"),
GetSQLValueString($HTTP_POST_VARS['password'], "text"),
GetSQLValueString($HTTP_POST_VARS['first'], "text"),
GetSQLValueString($HTTP_POST_VARS['last'], "text"),
GetSQLValueString(isset($HTTP_POST_VARS['offers']) ? "true" : "", "defined","'Y'","'N'"));
mysql_select_db($database_thecaval_lyrics, $thecaval_lyrics);
$Result = mysql_query($insertSQL, $thecaval_lyrics) or die(mysql_error());
}
?>