Ver Mensaje Individual
  #3 (permalink)  
Antiguo 28/11/2013, 14:48
Avatar de elsmallville
elsmallville
 
Fecha de Ingreso: noviembre-2013
Mensajes: 7
Antigüedad: 10 años, 5 meses
Puntos: 0
Respuesta: No Entiendo - Base de Datos MySQL

<?php require_once('Connections/bluegreyconexion.php'); ?>
<?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;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO registro (nombres, apellido, usuario, password, email, sexo, edad, dirección, codpostal, provincia, localidad, telefono, telalternativo) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Nombres'], "text"),
GetSQLValueString($_POST['Apellidos'], "text"),
GetSQLValueString($_POST['Usuario'], "text"),
GetSQLValueString($_POST['Contrasea'], "text"),
GetSQLValueString($_POST['Email'], "text"),
GetSQLValueString($_POST['Sexo'], "text"),
GetSQLValueString($_POST['Edad'], "text"),
GetSQLValueString($_POST['Direccin'], "text"),
GetSQLValueString($_POST['Cdigo_Postal'], "text"),
GetSQLValueString($_POST['Provincia'], "text"),
GetSQLValueString($_POST['Localidad'], "text"),
GetSQLValueString($_POST['Telfono'], "text"),
GetSQLValueString($_POST['Alt_Telfono'], "text"));

mysql_select_db($database_bluegreyconexion, $bluegreyconexion);
$Result1 = mysql_query($insertSQL, $bluegreyconexion) or die(mysql_error());
}

?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>BlueGrey - Formulario de Registro</title>
<style>
body {
background:url(images/fondo-registro.jpg) no-repeat;
background-color:#000;
}
#form1 {
font:"Palatino Linotype", "Book Antiqua", Palatino, serif;
color:#999;
position:relative;
top:165px;
}
#enviar {
font-size:18px;
position:relative;
left:30px;
}

</style>
</head>
<body>

<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1" onSubmit="return validarPasswd()">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Nombre(s):</td>
<td><input type="text" name="Nombres" value="" size="32" style="background:#CCC; color:#000; border-color:#666" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Apellido(s):</td>
<td><input type="text" name="Apellidos" value="" size="32" style="background:#CCC; color:#000; border-color:#666"/></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Usuario:</td>
<td><input type="text" name="Usuario" value="" size="32" style="background:#CCC; color:#000; border-color:#666"/></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Contraseña:</td>
<td><input type="password" name="Contrasea" id="passwd" value="" size="32" style="background:#CCC; color:#000; border-color:#666"/></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Confirmar Contraseña:</td>
<td><input type="password" name="Contrasea" id="passwd2" size="32" style="background:#CCC; color:#000; border-color:#666"/></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">E-mail:</td>
<td><input type="text" name="Email" value="" size="32" style="background:#CCC; color:#000; border-color:#666"/><br /><br /><br /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Sexo:</td>
<td valign="baseline">
<table>
<tr>
<td><input type="radio" name="Sexo" value="Masculino" />
Masculino</td>
</tr>
<tr>
<td><input type="radio" name="Sexo" value="Femenino" />
Femenino</td>
</tr>
</table></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Edad:</td>
<td><input type="text" name="Edad" value="" size="32" style="background:#CCC; color:#000; border-color:#666"/><br /><br /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Dirección:</td>
<td><input type="text" name="Direccin" value="" size="32" style="background:#CCC; color:#000; border-color:#666"/></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Código Postal:</td>
<td><input type="text" name="Cdigo_Postal" value="" size="32" style="background:#CCC; color:#000; border-color:#666"/></td>
</tr>