Jump to content

Confused simple E-mail verification script


stopfocus

Recommended Posts

Very simple I don't see what im missing please help :( all the script is supposed to do is make sure that the email the some one submits has a '.' and ' @' symbol and is it the proper format but no matter what I do my function dosn't seem to operate correcrly.

 

I have ever tried feeding a string in the proper email format dirrectly to my function to make verify the function works correctly it dosn't.

 

Please help

 

(running on up to date LAMP server)

 

<form action="./validate_email.php" method="GET">

<input type="text" name="email" value="" />

<input type="text" name="emailval" value="" />

<input type="submit" name="sub" value="submit" />

</form>

 

<?php

function checkEmail($s){

$lastDot = strrpos($s,'.');

$ampersat=strrpos($s,'@');

$length=strlen($s);

 

 

if (($lastDot===false) ||

($ampersat===false) ||

($length===false) ||

($lasDot-$apmersat < 3) ||

($length-$lastDot<3))

{echo"invalid";}

else

{echo"valid";}

return $valid;

}

 

$email=$_GET['email'];

$emailval=$_GET['emailval'];

$mail='stop_and_focusyahoo.com';

$ok=checkEmail($mail);

print"$ok </br> $mail";

 

?>

 

<form action="./validate_email.php" method="GET">

 

Should be either

<form action="../validate_email.php" method="GET">

If its in the directory below

 

or

<form action="validate_email.php" method="GET">

for the same directory. try this then see what happens.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.