E-Mail Validator. PLEASE HELP.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

E-Mail Validator. PLEASE HELP.

Post 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".
} 
?>
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Re: E-Mail Validator. PLEASE HELP.

Post 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.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post 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.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

can anyone help?
Last edited by tecktalkcm0391 on Mon May 29, 2006 10:47 am, edited 1 time in total.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post 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". 
}
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

thanks.
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post 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.
Post Reply