[advanced search]
Results from the most recent live auction are here.
16 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming > CODE
User Name
Password

Old 09-30-2005, 08:15 PM   · #1
SecondVersion
while ($awake){ code(); }
 
SecondVersion's Avatar
 


Name: Eric
Location: Kentucky
Trader Rating: (140)
Join Date: Mar 2005
Posts: 4,200
NP$: 1531.50 (Donate)
SecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond repute
Member of the Month
MOTM September 2005 Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Cancer Alzheimer's Protect Our Planet
Simple Contact Form

I've wrote a simple contact form/script. Email validation etc. Hope you like it.

contact.php
PHP Code:
<?php

/*
SVs SimpContact v1.0.0
Copyright © 2005 SecondVersion
http://www.secondversion.com
*/

echo 'You can use the following form to contact us.
<br>
All fields required.
<br>
<form method="post" action="contact.php">
Name:
<br>
<input type="text" name="name" size="20">
<br>
<br>
E-mail address:
<br>
<input type ="text" name="email" size="20">
<br>
<br>
Subject:
<br>
<input type ="text" name="sub" size="20">
<br>
<br>
Message:
<br>
<textarea rows="5" cols="35" name="message" wrap="virtual"></textarea>
<br>
<input type="submit" name="submit" value="Submit">
<br>
<br>
Powered by: <a target="_blank" href="http://www.secondversion.com">SVs SimpContact v1.0.0</a>.
</form>'
;

if(!empty(
$_POST['submit']))
{

$name = $_POST['name'];
$message = $_POST['message'];
$email = $_POST['email'];
$sub = $_POST['sub'];
$ip = $_SERVER['REMOTE_ADDR'];

//Check for a valid email..
$validate = eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}$", $email);

if(!
$validate)
{
echo(
"<br>" . $email . " is not a valid email.");
}
else
{
$e = $email;
}

//Required Fields, you can add or remove fields as neccessary.
//Did they leave them empty?

if(!$name || !$message || !$e)
{
echo
'<br>One or more required fields were left blank, please enter all required data.';
}
else
{

//Get the date...
$date = date("M d Y");

//What email do you want it sent to?
$youremail = "you@domain.com";

//What subject to do want the email to be?
$subject = "Subject";

//Send the data...
$name = stripslashes($name);
$subj = stripslashes($sub);
$message = stripslashes($message);
$msg = wordwrap($message, 70, "<br>");

$headers = 'From: '.$e.'';
$send = mail("$youremail", "$subject","

<b>Name:</b> $name

<b>E-mail address:</b> $e

<b>Subject:</b> $subj

<b>Message:</b>
$msg

<b>Message sent on:</b> $date
<b>IP:</b> $ip

"
, $headers);

if(
$send)
{
echo
'<br>Thanks for contacting us.';
}
else
{
echo
'<br>Seems to be a problem, please try again later.';
}
}
}
?>

</body>
</html>


Enjoy!

-Eric


Please register or log-in into NamePros to hide ads
__________________

SecondVersion.com - The Personal Blog of SecondVersion
Domain Name Portfolio - Get your free copy. - Version 1.0.1 now available!!
MetaCreator.com - Free Meta Tag Creator
CodingPlanet.com - Coming soon...

Last edited by SecondVersion : 10-06-2005 at 10:33 PM.
SecondVersion is offline   Reply With Quote
Old 09-30-2005, 08:20 PM   · #2
mholt
DNOA Member
 
Name: Matthew Holt
Location: 127.0.0.1
Trader Rating: (75)
Join Date: May 2004
Posts: 4,867
NP$: 17.21 (Donate)
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Nice and helpful, especially for beginners - great thing to learn from! Rep added!
__________________
FREE: Help With Code

Includes other technical topics:
programming, development, Windows, domain names, and Internet
mholt is offline   Reply With Quote
Old 09-30-2005, 08:48 PM   · #3
SecondVersion
while ($awake){ code(); }
 
SecondVersion's Avatar
 


Name: Eric
Location: Kentucky
Trader Rating: (140)
Join Date: Mar 2005
Posts: 4,200
NP$: 1531.50 (Donate)
SecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond repute
Member of the Month
MOTM September 2005 Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Cancer Alzheimer's Protect Our Planet
Originally Posted by compuXP
Nice and helpful, especially for beginners - great thing to learn from! Rep added!


Thanks. Yeah, I kept that in mind when writing it, wanted to keep it as simple as possible. And posted it in the hopes a beginner etc would take it learn/build on it. Hope it helps a few.


-Eric
__________________

SecondVersion.com - The Personal Blog of SecondVersion
Domain Name Portfolio - Get your free copy. - Version 1.0.1 now available!!
MetaCreator.com - Free Meta Tag Creator
CodingPlanet.com - Coming soon...
SecondVersion is offline   Reply With Quote
Old 09-30-2005, 08:55 PM   · #4
commes
Senior Member
 
commes's Avatar
 
Name: Jordan Lutz
Location: Regina, Sask, Canada
Trader Rating: (24)
Join Date: May 2005
Posts: 1,323
NP$: 12.15 (Donate)
commes is just really nicecommes is just really nicecommes is just really nicecommes is just really nice
i might use that when i make an about us page, thats if i ever get around to doing so lol
commes is offline   Reply With Quote
Old 09-30-2005, 10:10 PM   · #5
JoshHendo
Senior Member
 
JoshHendo's Avatar
 
Name: Joshua Henderson
Location: Australia
Trader Rating: (20)
Join Date: Apr 2005
Posts: 1,101
NP$: 1.30 (Donate)
JoshHendo is a jewel in the roughJoshHendo is a jewel in the roughJoshHendo is a jewel in the rough
Thanks
*sigh* why did i bother to code my own, I should know SV is going to write one *sigh*
__________________
JoshHendo is offline   Reply With Quote
Old 10-04-2005, 10:22 AM   · #6
unknowngiver
Senior Member
 
Name: Zubair
Location: Ontario Canada
Trader Rating: (53)
Join Date: May 2005
Posts: 2,746
NP$: 718.15 (Donate)
unknowngiver is a name known to allunknowngiver is a name known to allunknowngiver is a name known to allunknowngiver is a name known to allunknowngiver is a name known to allunknowngiver is a name known to all
Great work second
unknowngiver is offline   Reply With Quote
Old 10-04-2005, 11:05 AM   · #7
primacomputer
Senior Member
 
Trader Rating: (0)
Join Date: Mar 2004
Posts: 1,404
NP$: 2705.50 (Donate)
primacomputer is a jewel in the roughprimacomputer is a jewel in the roughprimacomputer is a jewel in the rough
Your email validation regex has some problems. There are a number of valid mailbox characters you haven't included. In particular the “+” which I've seen quite a few times.

I appreciate that you allow for a host name instead of limiting users to a mailbox and domain name like many broken scripts. However, while technically possible, I doubt you need to allow for hosts with an underscore, and certainly not a percent.
primacomputer is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Most dropped (expired) .us's today had THIS in the whois, what does it mean? OvenMitt Domain Newbies 4 07-18-2005 02:36 PM
Paypal Settlement CMachuca The Break Room 3 07-31-2004 10:14 PM
PAYPAL Litigation johnn Domain Name Discussion 6 07-31-2004 09:51 PM
Paypal Settlement Lord The Break Room 2 07-30-2004 09:30 PM
About a domain... axilant Domain Name Discussion 8 05-21-2004 01:34 AM

Site Sponsors
EscrowDNS Buy Flash Arcade Game Script Arcade Script
Advertise your business at NamePros
All times are GMT -7. The time now is 11:10 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0