Hola...
xq no usas el
Autentificator de Cluster... ???
como identificador de usuarios va muy bien,, y ante cualquier duda aqui hay un post abierto sobre el tema...
EDITADO --> disculpa.. confundi registro por auntentificar usuarios en la web...

aunque bueno... echale un ojo q = te sirve...
he seguido un poko el tema.. parece ser q el error lo tienes al principio
pruba asi a ver q tal...
Código PHP:
<?
if($_POST[enviar]) {
require 'config.php' ;
function quitar($texto) {
$texto = trim($texto) ;
$texto = htmlspecialchars($texto) ;
$texto = str_replace(chr(160),'',$texto);
}//fin funcion
}//fin IF
?>
o asi... no ser como va...
Código PHP:
<?
if($_POST[enviar]) { require 'config.php' ;} //fin IF
function quitar($texto) {
$texto = trim($texto) ;
$texto = htmlspecialchars($texto) ;
$texto = str_replace(chr(160),'',$texto);
}//fin funcion
?>
codigo entero:
Código PHP:
if($_POST[enviar]) {
require 'config.php' ;
function quitar($texto) {
$texto = trim($texto) ;
$texto = htmlspecialchars($texto) ;
$texto = str_replace(chr(160),'',$texto) ; //Elimina espacios que no pueden ser borrados por trim()
return $texto ;
} //fin funcion
$nick = quitar($_POST[nick]) ;
$email = quitar($_POST[email]) ;
$con = mysql_query("select count(id) from usuarios where nick='$nick' or email='$email'") ;
if(mysql_result($con,0,0)) {
echo 'El nick ya existe en la base de datos o ya está registrado el email. Haz click <a href="javascript:history.back()">aquí</a> para regresar.' ;
} else {
$fecha = time() ; $contrasena = md5(md5(quitar($_POST[contrasena]))) ;
$sexo = quitar($_POST[sexo]) ;
mysql_query("insert into usuarios (fecha,nick,contrasena,email,sexo,ip) values ('$fecha','$nick','$contrasena','$email','$sexo','$_SERVER[REMOTE_ADDR]')") ;
echo 'Has sido registrad@. Haz click aquí <a href="index.php">aquí</a> para regresar a la página principal.' ;
} //fin if mysql_result
} //fin if post[enviar]
saludos