Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validating email and username

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I'm trying to add somethig that checks the table if the username or email address exists when submitting a form. Can someone please help me do that?
 
What table are you talking about??? ...
Do you want to take the values from the form and use it to check in DB table??? If so I can help you...but I need more information Someone who has never served other is someone that has never lived...
 
I want to take the values of the form then check any matches for the username and email fields throughout the table. And if it returns false, I'll print an error message. I want to have an error message for each one (username/email verification).

Thanks alot.
 
Try something like this... Using sessions is better

$dominio = $GLOBALS['dominio']; //Var from the form
$password = $GLOBALS['password']; //Var from the form

//Hace la sesion si el login y password estan correctos
if (isset($dominio)) {
$sql = "select * from clientes where nombre_dominio='$dominio' and ";
$sql = $sql . "password='$password'";
$res = mysql_query($sql);
$n = mysql_num_rows($res);

//Si no existe dominio y/o password
if($n == 0) {
$error_login++;

//Existe dominio y password
} else {
$ses = mysql_fetch_object($res);
sesion_login($ses->clave_dominio);
//Segun el tipo de usuario abre aplicación clientes o administrador
if($id == 1) {
redirect_url("admin.php");
} else {
redirect_url("clientes.php");
}
}
}
Someone who has never served other is someone that has never lived...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top