login  Naam:   Wachtwoord: 
Registreer je!
 Forum

mail controle fout

Offline zwobbel - 26/03/2005 18:37 (laatste wijziging 26/03/2005 18:37)
Avatar van zwobbelPHP gevorderde Er zit een fout op lijn 55 maar welke ? 
  1. <?php
  2. class mail_check_global
  3. {
  4. var $system_OS = "win"; // required for MX digging (win / linux)
  5. var $debug = 0; // self-explaining (0 - OFF, 1 - ON)
  6. var $recType = "MX"; // limitting dns query to Mail eXchange only
  7. var $email; // the goal! ;)
  8. var $hostName; // parent domain for address
  9. var $userName; // actually NOT used :)
  10. var $check_DNS_result; // debuging DNS check
  11. var $check_MAIL_result; // debuging SYNTAX check
  12.  
  13. // check if MX records in DNS server response (WINDOWS !!!):
  14. function checkDNS()
  15. {
  16. if ($this -> system_OS == "linux") // linuz
  17. {
  18. if (getmxrr($this -> hostName)) return TRUE;
  19. else return FALSE;
  20. } else { // windoz
  21. if(!empty($this -> hostName))
  22. {
  23. exec("nslookup -type=".$this->recType." ".$this -> hostName, $result);
  24. // check each line to find the one that starts with the host
  25. // name. If it exists then the function succeeded.
  26. foreach ($result as $line)
  27. {
  28. if(eregi("^".$this -> hostName,$line)) return true;
  29. }
  30. // otherwise there was no mail handler for the domain
  31. return false;
  32. }
  33. return false;
  34. }
  35. }
  36.  
  37. // brake address --> username & parent domain
  38. function check_email_dns()
  39. {
  40. list($this -> userName, $this -> hostName) = split("@", $this -> email);
  41. if (!$this -> checkDNS ($this -> hostName))
  42. {
  43. $this -> check_DNS_result = "Address domain MX DNS record could NOT be found";
  44. return FALSE;
  45. } else {
  46. $this -> check_DNS_result = "Address DNS MX is OK";
  47. return TRUE;
  48. }
  49. }
  50.  
  51. // check addresse's SYNTAX
  52. function check_email()
  53. {
  54. $this -> email = strtolower($this -> email);
  55. if (preg_match('/^[-!#$%&'*+./0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+.)+([0-9A-Z]){2,4}$/i', $this -> email))
  56. {
  57. $this -> check_MAIL_result = "Address syntax is OK";
  58. return TRUE;
  59. } else {
  60. $this -> check_MAIL_result = "Address syntax is WRONG";
  61. return FALSE;
  62. }
  63. }
  64.  
  65. // global check
  66. function final_mail_check()
  67. {
  68. if (!$this -> check_email_dns() OR !$this -> check_email()) return FALSE;
  69. else return TRUE;
  70. }
  71.  
  72. // debuging ONLY
  73. function debug_address()
  74. {
  75. if ($this -> debug == 1)
  76. {
  77. echo "<br>";
  78. echo "<b>DEBUG</b>:";
  79. echo "<br>";
  80. echo "<u>eMail</u>: ".$this -> email;
  81. echo "<br>";
  82. echo "<u>DNS</u>: ".$this -> check_DNS_result;
  83. echo "<br>";
  84. echo "<u>Syntax</u>: ".$this -> check_MAIL_result ;
  85. echo "<br>";
  86. }
  87. }
  88. }
  89. ?>

5 antwoorden

Gesponsorde links
Offline prorsoft - 26/03/2005 19:04 (laatste wijziging 26/03/2005 19:07)
Avatar van prorsoft PHP gevorderde oh, je moet op regel 55 ipv ' dubbele quotes neerzetten.
dus zo:
  1. if (preg_match("/^[-!#$%&'*+./0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+.)+([0-9A-Z]){2,4}$/i", $this -> email))


EDIT: te laat...
Offline haytjes - 26/03/2005 19:05 (laatste wijziging 26/03/2005 19:09)
Avatar van haytjes Gouden medailleGouden medaille

JS gevorderde
preg_match('/^[-!#$%&'*+./0- ....
je sluit je 'string' af: preg_match('...'...', '...')

moet dus \' zijn:p

[edit]
of zoals hierboven de ' in " veranderen

yep ik was eerst
^^
Offline prorsoft - 26/03/2005 19:07
Avatar van prorsoft PHP gevorderde haytjes, het is \' niet /'
Offline haytjes - 26/03/2005 19:09
Avatar van haytjes Gouden medailleGouden medaille

JS gevorderde
ja, klopt

(vlug nog veranderen)
Offline zwobbel - 27/03/2005 09:53
Avatar van zwobbel PHP gevorderde AA oke merci nu werkt het.
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.187s