Page 1 of 1

E-Mail Validator. PLEASE HELP.

Posted: Mon May 29, 2006 2:05 am
by tecktalkcm0391
Can you tell me how to make this work:

Code: Select all

<?php
$check_email = @mysql_query("SELECT MAIL FROM user_auth ");
	$check_email = mysql_fetch_array($check_email);
	$check_email = check_email ['MAIL]; 

if($check_email == $email){
 return "An error has occured. Sorry, but that E-mail has already been used".
} 
?>

Re: E-Mail Validator. PLEASE HELP.

Posted: Mon May 29, 2006 2:25 am
by jmut
tecktalkcm0391 wrote:Can you tell me how to make this work:

Code: Select all

<?php
$check_email = @mysql_query("SELECT MAIL FROM user_auth ");
	$check_email = mysql_fetch_array($check_email);
	$check_email = check_email ['MAIL]; 

if($check_email == $email){
 return "An error has occured. Sorry, but that E-mail has already been used".
} 
?>
Obviously you have a syntax error.

Code: Select all

$check_email = check_email ['MAIL];      //this is not valid syntax
I don't see where $email comes from also.

Posted: Mon May 29, 2006 7:49 am
by tecktalkcm0391
Ok I didn't catch that, and the email comes from another part of the pages code.

What I am trying to get it to do is to go to the database search the table users and the column MAIL and see how many times the user's email has been used. If the users' email has been used more than 3 times. They it doesn't allow that e-mail, but if it come back under 3 times used. then they can use that e-mail to signup.

Posted: Mon May 29, 2006 9:38 am
by tecktalkcm0391
can anyone help?

Posted: Mon May 29, 2006 10:19 am
by Ambush Commander
What you're doing right now is pulling every single email row from the database with your query.

Try... (untested)

Code: Select all

$mysql_email = mysql_real_escape_string($email);
$sql = "SELECT `MAIL` FROM `userauth` WHERE `MAIL`= '$mysql_email'";
$result = mysql_query($sql);
$number_of_rows_returned = mysql_num_rows();
if ($number_of_rows_returned >= 3) {
  return "An error has occured. Sorry, but that E-mail has already been used". 
}

Posted: Mon May 29, 2006 10:47 am
by tecktalkcm0391
thanks.

Posted: Mon May 29, 2006 10:52 am
by hawleyjr
tecktalkcm0391 wrote:can anyone help?

Last edited by tecktalkcm0391 on Mon May 29, 2006 11:47 am; edited 1 time in total
tecktalkcm0391,

I added the do not bump warning for a reason. Please don't remove it.

[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:4. All users of any level are restricted to bumping (as defined here) any given thread within twenty-four (24) hours of its last post. Non-trivial posts are not considered bumping. A bump post found in violation will be deleted, and you may or may not recieve a warning. Persons bumping excessively be considered as spammers and dealt with accordingly.