Topic: Error trying to login and logout (Read 2152 times)
Google dot what?
Posts: 2
16 credits Members referred : 0
« on: Apr 01, 2009, 08:18:19 pm »
Hello
Im trying to install this class on my website but im getting some problemas, i got a login form and when the user login and click on submit the user is taken to: login.php?exito=1 and it supposed to the user sending to the main website becasue on login.php i got this:
Code:
if(!empty($_POST["usuario"])) { sleep(2); //only for debug
//Super rutina de seguridad para la comprobación de usuarios if($user->login($_POST['usuario'],$_POST['clave'],$_POST['recordar'] )) { echo "OK!"; //Dato clave, de esto depende el Formulario AJAX } else { echo "NO!"; //Dato clave, de esto depende el Formulario AJAX }
and also i got a problem trying to logout, i got headers already sent error, and i not sending anything...sorry my bad english hope you can help me.
« Last Edit: Apr 01, 2009, 08:21:55 pm by lucasvm »
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5778
46265 credits Members referred : 3
« Reply #1 on: Apr 02, 2009, 06:54:50 am »
The first part (that echoes OK or NO) is why no header can't be sent. Remove this, and if you still have problems please repost with your php.ini file. It seems that there is some kind of session problem with some strange configuration which we haven't found yet.
Google dot what?
Posts: 2
16 credits Members referred : 0
« Reply #2 on: Apr 02, 2009, 10:58:07 pm »
ok, error solved, there was a programing error...sorry, i got another question, in my register page y got this code:
Code:
if($_POST){ if((!$_POST['usuario'])OR(!$_POST['email'])OR(!$_POST['clave'])){ // Verificamos que no se quede ningun campo vacio... echo '<p>No deje ningun campo en blanco, intente de nuevo...</p>'; }else{ if(!eregi("^[a-z0-9_-]+$", $_POST['usuario'])){ // Verificamos que el usuario tenga solo letras, numeros y guiones... echo '<p>El usuario solo puede contener letras, numeros y guiones, intente de nuevo...</p>'; }else{ if(!eregi("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$", $_POST['email'])) { // Verificamos que el correo sea valido... echo '<p>El correo electronico no es valido, intente con un correo verdadero...</p>'; }else{ $data = array( 'usuario' => $_POST['usuario'], 'email' => $_POST['email'], 'clave' => $_POST['clave'], 'ubicacion' => $_POST['ubicacion'], 'web' => $_POST['web'], 'mensaje' => $_POST['mensaje'], 'usuario' => $_POST['usuario'], 'avatar' => $_POST['avatar'], 'msn' => $_POST['msn'], 'activacion' => 1 ); $userID = $user->insertUser($data);//The method returns the userID of the new user or 0 if the user is not added if ($userID==0) echo 'Usuario ya utilizado, intente con otro nombre';//user is allready registered or something like that else echo 'User registered with user id <ingresar.php>iniciar sesion</a>.</p>'.$userID; } $dest = $_POST['email']; $head = "From: no-contestar\r\n"; $head.= "To: ".$_POST['email']."\r\n"; $msg = "Te has registrado correctamente en nuestro sitio, estos son tus datos: \n"; $msg.= "Usuario: ".$_POST['usuario']." \n"; $msg.= "Clave: ".$_POST['clave']." \n"; $msg.= "Para iniciar sesion ve a ingresar.php \n"; mail($dest, "Confirmacion de registro", $msg, $head); } } // Termina verificacion de: $_POST['email'] } // Termina verificacion de: $_POST['usuario'] } // Termina verificacion de: $_POST['']
is there a way to know if the user is already register?, because if i register a user with the same name there is no error message or whatever and it record the user, and it shouldnt, what can i do?, any ideas?
I have made a great ajax user check to know if the user is already registered, it works fantastic but still the phpuserclass let me record the user, how can i do¿?
i got this ajax script that control:
Code:
include("conexio.php"); $nick=$_REQUEST['nick']; $consulta= mysql_query("SELECT * FROM table WHERE field='$nick'"); if(mysql_num_rows($consulta)>0) echo "$nick already in use"; else echo "Username Available";
This works great!!, it is possible to use it with phpuserclass? IT WOULD BE FANTASTIC
« Last Edit: Apr 02, 2009, 11:42:28 pm by lucasvm »
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=8638