This is a discussion on PHP:Tutorial - Email Verification within the PHP Programming forums, part of the Web Development category; The first thing we are going to do is create a new php file and starte a new function that ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| The first thing we are going to do is create a new php file and starte a new function that accepts an email parameter. Code: PHP Code:
<?php
function EmailValidation($email) {
}
?> Code: PHP Code:
<?php
function EmailValidation($email) {
$email = htmlspecialchars(stripslashes(strip_tags($email))); //parse unnecessary characters to prevent exploits
}
?> Code: PHP Code:
<?php
function EmailValidation($email) {
$email = htmlspecialchars(stripslashes(strip_tags($email))); //parse unnecessary characters to prevent exploits
if ( eregi ( '[a-z||0-9]@[a-z||0-9].[a-z]', $email ) ) { //checks to make sure the email address is in a valid format
}
}
?> Code: PHP Code:
<?php
function EmailValidation($email) {
$email = htmlspecialchars(stripslashes(strip_tags($email))); //parse unnecessary characters to prevent exploits
if ( eregi ( '[a-z||0-9]@[a-z||0-9].[a-z]', $email ) ) { //checks to make sure the email address is in a valid format
$domain = explode( "@", $email ); //get the domain name
if ( @fsockopen ($domain[1],80,$errno,$errstr,3)) {
//if the connection can be established, the email address is probabley valid
return true;
}
}
?> Code: PHP Code:
<?php
function EmailValidation($email) {
$email = htmlspecialchars(stripslashes(strip_tags($email))); //parse unnecessary characters to prevent exploits
if ( eregi ( '[a-z||0-9]@[a-z||0-9].[a-z]', $email ) ) { //checks to make sure the email address is in a valid format
$domain = explode( "@", $email ); //get the domain name
if ( @fsockopen ($domain[1],80,$errno,$errstr,3)) {
//if the connection can be established, the email address is probabley valid
return true;
/*
GENERATE A VERIFICATION EMAIL
*/
} else {
return false; //if a connection cannot be established return false
}
} else {
return false; //if email address is an invalid format return false
}
}
?> Code: PHP Code:
<?php
function EmailForm(){
if(empty($_POST['email'])){
echo "<form action=".$_SERVER['PHP_SELF']." method='post'>
<table border='0'>
<tr>
<td>Email</td>
<td><input name='email' type='text' id='email' /></td>
</tr>
<tr>
<td> </td>
<td><input type='submit' name='Submit' value='Validate' /></td>
</tr>
</table>
</form>";
} elseif(isset($_POST['email'])) {
if(EmailValidation($_POST['email'])) {
echo "An email has been sent to you. Please follow the instructions to activate your account.";
} else {
echo "Your email address appears to be invalid. Please try again.";
}
} else {
echo "An error has occured, please contact the administrator.";
}
}
?> Code: PHP Code:
<?php
function EmailValidation($email) {
$email = htmlspecialchars(stripslashes(strip_tags($email))); //parse unnecessary characters to prevent exploits
if ( eregi ( '[a-z||0-9]@[a-z||0-9].[a-z]', $email ) ) { //checks to make sure the email address is in a valid format
$domain = explode( "@", $email ); //get the domain name
if ( @fsockopen ($domain[1],80,$errno,$errstr,3)) {
//if the connection can be established, the email address is probabley valid
return true;
/*
GENERATE A VERIFICATION EMAIL
*/
} else {
return false; //if a connection cannot be established return false
}
} else {
return false; //if email address is an invalid format return false
}
}
function EmailForm(){
if(empty($_POST['email'])){
echo "<form action=".$_SERVER['PHP_SELF']." method='post'>
<table border='0'>
<tr>
<td>Email</td>
<td><input name='email' type='text' id='email' /></td>
</tr>
<tr>
<td> </td>
<td><input type='submit' name='Submit' value='Validate' /></td>
</tr>
</table>
</form>";
} elseif(isset($_POST['email'])) {
if(EmailValidation($_POST['email'])) {
echo "An email has been sent to you. Please follow the instructions to activate your account.";
} else {
echo "Your email address appears to be invalid. Please try again.";
}
} else {
echo "An error has occured, please contact the administrator.";
}
}
EmailForm();
?> |
| Sponsored Links |
| |||
| PHP is a computer scripting language. Originally designed for producing dynamic web pages, it has evolved to include a command line interface capability and can be used in standalone graphical applications. jack ____________________________________ fear of flying cowboy boots |
| |||
| hi nice read, thanks for the tut. |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Formal verification method | Shanthi | Software Testing | 0 | 01-14-2008 04:31 AM |
| What is the verification testing Strategies? | sundarraja | Software Testing | 2 | 01-14-2008 03:23 AM |
| Email Verification in ASP.NET | oxygen | C# Programming | 1 | 09-07-2007 08:44 AM |
| What is verification? validation? | devarajan.v | Software Testing | 2 | 07-17-2007 07:56 AM |
| Verification & Validation | vadivelanvaidyanathan | Quality Engineering and Methodologies | 0 | 04-18-2007 04:06 AM |