Jump to content


Photo

Email Validation


  • Please log in to reply
2 replies to this topic

#1 Terfanda

Terfanda
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 20 June 2006 - 05:16 AM

function emailcheck($Email)
{
if (eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $Email))
{
$ans1=FALSE;
}
else
{
$ans1= TRUE;
}
return $ans1;

}




Hello agian I will be very thankfull if someone help I am using this function up it seems it is wrong can someone tells me where is my mistake

i am calling it here:::::: $acc=emailcheck("$Email");

and i am using this if condition to give me a final answer::::: if (($acc==TRUE)AND($acc1==TRUE))


I will be very greatfull if someone helps me thank you


#2 hackerkts

hackerkts
  • Members
  • PipPipPip
  • Advanced Member
  • 593 posts
  • LocationSingapore
  • Age:18

Posted 20 June 2006 - 07:08 AM

This is what I did, hope you know where you went wrong.
<?php

function validateEmail($email)
{
    $email_pattern = '^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$';
    if (eregi ($email_pattern, $email) )
    {
        $ans1 = TRUE;
    }
    else
    {
        $ans1 = FALSE;
    }
    return $ans1;
}

if (validateEmail("hackerkts@gmail.com") == TRUE) {
    echo "TRUE";
    } else {
        echo "FALSE";
        }
?>


Regards,
hackerkts

To be a coder, you must learn how to think and not to give up so easily.


#3 Terfanda

Terfanda
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 20 June 2006 - 07:29 AM

[!--quoteo(post=385892:date=Jun 20 2006, 10:08 AM:name=hackerkts)--][div class=\'quotetop\']QUOTE(hackerkts @ Jun 20 2006, 10:08 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
This is what I did, hope you know where you went wrong.
<?php

function validateEmail($email)
{
    $email_pattern = '^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$';
    if (eregi ($email_pattern, $email) )
    {
        $ans1 = TRUE;
    }
    else
    {
        $ans1 = FALSE;
    }
    return $ans1;
}

if (validateEmail("hackerkts@gmail.com") == TRUE) {
    echo "TRUE";
    } else {
        echo "FALSE";
        }
?>
[/quote]


[!--quoteo(post=385887:date=Jun 20 2006, 08:16 AM:name=Terfanda)--][div class=\'quotetop\']QUOTE(Terfanda @ Jun 20 2006, 08:16 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
function emailcheck($Email)
{
if (eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $Email))
{
$ans1=FALSE;
}
else
{
$ans1= TRUE;
}
return $ans1;

}

Hello agian I will be very thankfull if someone help I am using this function up it seems it is wrong can someone tells me where is my mistake

i am calling it here:::::: $acc=emailcheck("$Email");

and i am using this if condition to give me a final answer::::: if (($acc==TRUE)AND($acc1==TRUE))
I will be very greatfull if someone helps me thank you
[/quote]


Thank You
I understood it and i will try it




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users