Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.
Help with checking valid email
if($_POST['verif'] == SniDecrypt($_POST['code'])) {
if($_POST['pass'] == $_POST['confirm']) {
$ip = $_SERVER['REMOTE_ADDR'];
$email = $_POST['email'];
mysql_connect("localhost", "root", SniDecrypt("My Password")) or die(mysql_error());
mysql_select_db("webauth") or die(mysql_error());
$userip = mysql_query("SELECT * FROM user_pwd WHERE ip ='$ip'");
$rows = mysql_num_rows($userip);
$useremail = mysql_query("SELECT * FROM user_pwd WHERE email = '$email'");
$rows2 = mysql_num_rows($useremail);
if ($rows == 0) {
if($rows2 == 0) {
$user = $_POST['user'];
$pass = $_POST['pass'];
$ip = $_SERVER['REMOTE_ADDR'];
$email = $_POST['email'];
mysql_connect("localhost", "root", SniDecrypt("My password")) or die(mysql_error());
mysql_query("INSERT INTO `webauth`.`user_pwd` (`name`, `pass`, `email`, `ip`) VALUES ('$user',SHA1('$pass'),'$email','$ip');") or die(mysql_error());
echo "Registration Succesful!";
} else {
echo "Email has already been registered!";
}
} else {
echo "You have already registered on this computer!";
}
} else {
echo "Passwords do not match!";
}
} else {
echo "Your code you entered does not match the image!";
}
}
function checkEmailAddress($mail) {
$regex = "/^[a-z]+[a-z0-9]*[\.|\-|_]?[a-z0-9]+
@([a-z]+[a-z0-9]*[\.|\-]?[a-z]+[a-z0-9]*[a-z0-9]+){1,4}
\.[a-z]{2,4}$/";
if (preg_match($regex, $mail)) {
return true;
} else {
return false;
}
} ```
How should I insert the checkEmailAddress function?
Just put the value when echoing the email (that what i understand from you)… Here's an example:
<? //sql and rest of code…. $email = $_POST["email"];
function validateEmail($email) { global $continueSubmit ;
if (ereg ("^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$", $email))
{
echo "Thank You";
}
else
{
$continueSubmit = false;
echo "Invalid Email Address";
}
}
echo validateEmail($email); ?>
<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="POST"> <input type="text" name="email"><br /> <input type="submit"> </form>
It will check wheather the email address is valid or not..