PHP Installation
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Installation

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old January 10th, 2006, 08:18 PM
cuttysark cuttysark is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 1 cuttysark User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
can't get email textfield to recognize valid address

Windows OS
PHP4
No error msg...The code that validates the users email will not recognize any good or bad email address. The error is on the contact page...

URL
php Code:
Original - php Code
  1.  
  2. if($email) {
  3. if(isset($_POST['email']))
  4. {
  5. // $email = $email;
  6. // check to make sure email has been filled out with valid address
  7.  
  8. if (preg_match('/^[-!#$%&'*+\./0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+.)+([0-9A-Z]){2,4}$/i', trim($email))) {
  9. //do nothing the syntax looks good
  10. }
  11. else {$error .= "Your email address has a spelling error<BR>";
  12. }//set error code
  13. // check for valid domain name
  14. $ok = TRUE;
  15. $ok = eregi( "^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$", $email,
  16. $check);
  17. $ok = getmxrr(substr(strstr($check[0], '@'), 1), $dummy);
  18. if($ok === false)
  19. {
  20. $host = substr($email, strpos($email, '@') + 1);
  21. if(gethostbyname($host) != $host)
  22. {
  23. $ok = true;
  24. }
  25. if ($ok != true) {$error .= "That email address does not seem to be valid - please check<br>"; }
  26. // end of check
  27. }
  28. }} // end of email check

php Code:
Original - php Code
  1.  
  2. if(!empty($_POST)) extract($_POST);
  3. if (empty($email)) $error .= "You didn't enter your email address<br>";
  4. if (empty($text)) $error .= "You didn't include a message<br>";
  5. $str = $text; $text_len = strlen($str);
  6. if($text_len > 800) { $error .= "Sorry, you have used more than permitted 800 characters in your message. Total was $text_len - please shorten your message.<br>"; }
  7.  
  8. if($email) {
  9. if(isset($_POST['email']))
  10. {
  11. // $email = $email;
  12. // check to make sure email has been filled out with valid address
  13.  
  14. if (preg_match('/^[-!#$%&'*+\./0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+.)+([0-9A-Z]){2,4}$/i', trim($email))) {
  15. //do nothing the syntax looks good
  16. }
  17. else {$error .= "Your email address has a spelling error<BR>";
  18. }//set error code
  19. // check for valid domain name
  20. $ok = TRUE;
  21. $ok = eregi( "^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$", $email,
  22. $check);
  23. $ok = getmxrr(substr(strstr($check[0], '@'), 1), $dummy);
  24. if($ok === false)
  25. {
  26. $host = substr($email, strpos($email, '@') + 1);
  27. if(gethostbyname($host) != $host)
  28. {
  29. $ok = true;
  30. }
  31. if ($ok != true) {$error .= "That email address does not seem to be valid - please check<br>"; }
  32. // end of check
  33. }
  34. }} // end of email check
  35. if($error) {
  36. include("feedback.php");
  37. }
  38. else {
  39. include("feedbacksent.php");
  40. }

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Installation > can't get email textfield to recognize valid address


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway