Warning: mysql_query(): A link to the server could not be established in /usr/home/chesteral/public_html/p/registrar.php on line 17
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /usr/home/chesteral/public_html/p/registrar.php on line 18
Warning: mysql_query(): Access denied for user: 'mark@localhost' (Using password: NO) in /usr/home/chesteral/public_html/p/registrar.php on line 30
Warning: mysql_query(): A link to the server could not be established in /usr/home/chesteral/public_html/p/registrar.php on line 30
Registro exitoso!
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /usr/home/chesteral/public_html/p/registrar.php on line 33
Warning: mysql_close(): no MySQL-Link resource supplied in /usr/home/chesteral/public_html/p/registrar.php on line 39
Aqui va el Code
Código PHP:
<?php
require ("aut_config.inc.php"); // incluir configuracion.
function quitar($mensaje)
{
$mensaje = str_replace("<","<",$mensaje);
$mensaje = str_replace(">",">",$mensaje);
$mensaje = str_replace("\'","'",$mensaje);
$mensaje = str_replace('\"',""",$mensaje);
$mensaje = str_replace("\\\\","\",$mensaje);
return $mensaje;
}
if(trim($HTTP_POST_VARS["nick"]) != "" && trim($HTTP_POST_VARS["email"]) != "")
{
$sql = "SELECT id FROM usuarios WHERE nick='".quitar($HTTP_POST_VARS["nick"])."'";
$result = mysql_query($sql);
if($row = mysql_fetch_array($result))
{
echo "Error, nick escogido por otro usuario";
}
else
{
$sql = "INSERT INTO usuarios (nick,password,nombre,email) VALUES (";
$sql .= "'".quitar($HTTP_POST_VARS["nick"])."'";
$sql .= ",'".quitar($HTTP_POST_VARS["password"])."'";
$sql .= ",'".quitar($HTTP_POST_VARS["nombre"])."'";
$sql .= ",'".quitar($HTTP_POST_VARS["email"])."'";
$sql .= ")";
mysql_query($sql);
echo "Registro exitoso!";
}
mysql_free_result($result);
}
else
{
echo "Debe llenar como minimo los campos de email y password";
}
mysql_close();
?>