Reply
php mail() validation
Old 08-26-2009, 09:44 AM php mail() validation
Banned

Posts: 2
Name: Shaitan Singh
Location: India
Trades: 0
Hello friends please can any one help me how where mail() validation put in this code for short form.

Code here:-

Quote:
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail("info@yoursitesite.com", "$subject",
$message, "From: $email" );
echo "Thank you for using our mail form";
}
else
//if "email" is not filled out, display the form
{
echo "<form method='post' action='inquiry.php'>
Email: <input name='email' type='text' /><br />
Subject: <input name='subject' type='text' /><br />
Message:<br />
<textarea name='message' rows='15' cols='40'>
</textarea><br />
<input type='submit' />
</form>";
}
?>
CheapSEO is offline
Reply With Quote
View Public Profile Visit CheapSEO's homepage!
 
 
When You Register, These Ads Go Away!
Old 08-26-2009, 11:58 AM Re: php mail() validation
prasanthmj's Avatar
Average Talker

Posts: 27
Name: Prasanth
Trades: 0
not clear what do you meant by "how where mail() validation put in this code"

if you meant email validation here is the code:
PHP Code:
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"$email)){ 
          echo 
"Error: You have NOT entered the correct email address. "
      } 
if you want to validate against email injection, here is the code
PHP Code:
if (ereg"[\r\n]"$email ) ) { 
echo 
"error!";

prasanthmj is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to php mail() validation
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.10512 seconds with 13 queries