<?php require_once('base.php'); ?>
<?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 nuke_users (name, username, user_email, user_password) VALUES (%s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['name'], "text"
,
GetSQLValueString($HTTP_POST_VARS['username'], "text"
,
GetSQLValueString($HTTP_POST_VARS['user_email'], "text"
,
GetSQLValueString($HTTP_POST_VARS['user_password'], "text"
);
mysql_select_db($database_base, $base);
$Result1 = mysql_query($insertSQL, $base) or die(mysql_error());
$insertGoTo = "index.php"; /* la dirección de carga despues del registro */
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Documento sin título</title>
<meta http-equiv="Cont?:?:,?ent-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table width="369" align="center">
<tr valign="baseline">
<td nowrap align="right">Nombre real:</td>
<td><input type="text" name="name" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Nombre usuario:</td>
<td><input type="text" name="username" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">email:</td>
<td><input type="text" name="user_email" value="@" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Contraseña:</td>
<td><input type="password" name="user_password" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Insertar registro"></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
<p>
</p>
<!-- ZoneLabs Popup Blocking Insertion -->
<script language='javascript'>postamble();</script>
<!-- ZoneLabs Popup Blocking Insertion -->
<script language='javascript'>postamble();</script>
<!-- ZoneLabs Popup Blocking Insertion -->
<script language='javascript'>postamble();</script>
</body>
</html>
Tenemos que incluir los datos correctos.
Perdonar por los caretos....