|
|
|
Gepost op: 01 september 2004 - 14:14 |
|
|
|
PHP ver gevorderde

|
de emailcheck werkt bij mij niet.
als ik het emailadres bla12346qsdf@hotmail.com invul dan zegt hij dat dit correct is, maar dat is helemaal niet zo |
|
|
|
|
Gepost op: 03 september 2004 - 20:53 |
|
|
|
Nieuw lid

|
toppertje
Joël kan je de smileys weer uploaden ?!? ty (de oude die bij het gastenboek horen, 20x20) |
|
|
|
|
Gepost op: 03 september 2004 - 22:04 |
|
|
|
Intern Manager

|
Citaat: [I][B]webstab[/B] schreef op 01 September 2004 - 14:14[/I]
de emailcheck werkt bij mij niet.
als ik het emailadres bla12346qsdf@hotmail.com invul dan zegt hij dat dit correct is, maar dat is helemaal niet zo Het checkt enkel of het e-mailadres juist is ingevuld, niet of dat bestaat, dat kan je jammer genoeg niet  |
|
|
|
|
Gepost op: 04 september 2004 - 13:19 |
|
|
|
Onbekend

|
Dan weet ik meer dan jou Joël . Met de volgende code kan je perfect je email checken of hij bestaat ofniet!
<?php
class mail_check_global
{
var $system_OS = "win"; // required for MX digging (win / linux)
var $debug = 0; // self-explaining (0 - OFF, 1 - ON)
var $recType = "MX"; // limitting dns query to Mail eXchange only
var $email; // the goal! ;)
var $hostName; // parent domain for address
var $userName; // actually NOT used :)
var $check_DNS_result; // debuging DNS check
var $check_MAIL_result; // debuging SYNTAX check
// check if MX records in DNS server response (WINDOWS !!!):
function checkDNS()
{
if ($this -> system_OS == "linux") // linuz
{
if (getmxrr($this -> hostName)) return TRUE;
else return FALSE;
} else { // windoz
if(!empty($this -> hostName))
{
exec("nslookup -type=".$this->recType." ".$this -> hostName, $result);
// check each line to find the one that starts with the host
// name. If it exists then the function succeeded.
foreach ($result as $line)
{
if(eregi("^".$this -> hostName,$line)) return true;
}
// otherwise there was no mail handler for the domain
return false;
}
return false;
}
}
// brake address --> username & parent domain
function check_email_dns()
{
list($this -> userName, $this -> hostName) = split("@", $this -> email);
if (!$this -> checkDNS ($this -> hostName))
{
$this -> check_DNS_result = "Address domain MX DNS record could NOT be found";
return FALSE;
} else {
$this -> check_DNS_result = "Address DNS MX is OK";
return TRUE;
}
}
// check addresse's SYNTAX
function check_email()
{
$this -> email = strtolower($this -> email);
if (preg_match('/^[-!#$%&'*+./0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+.)+([0-9A-Z]){2,4}$/i', $this -> email))
{
$this -> check_MAIL_result = "Address syntax is OK";
return TRUE;
} else {
$this -> check_MAIL_result = "Address syntax is WRONG";
return FALSE;
}
}
// global check
function final_mail_check()
{
if (!$this -> check_email_dns() OR !$this -> check_email()) return FALSE;
else return TRUE;
}
// debuging ONLY
function debug_address()
{
if ($this -> debug == 1)
{
echo "<br>";
echo "<b>DEBUG</b>:";
echo "<br>";
echo "<u>eMail</u>: ".$this -> email;
echo "<br>";
echo "<u>DNS</u>: ".$this -> check_DNS_result;
echo "<br>";
echo "<u>Syntax</u>: ".$this -> check_MAIL_result ;
echo "<br>";
}
}
} ?>
<?php class mail_check_global { var $system_OS = "win"; // required for MX digging (win / linux) var $debug = 0; // self-explaining (0 - OFF, 1 - ON) var $recType = "MX"; // limitting dns query to Mail eXchange only var $email; // the goal! ;) var $hostName; // parent domain for address var $userName; // actually NOT used :) var $check_DNS_result; // debuging DNS check var $check_MAIL_result; // debuging SYNTAX check // check if MX records in DNS server response (WINDOWS !!!): function checkDNS() { if ($this -> system_OS == "linux") // linuz { if (getmxrr($this -> hostName)) return TRUE; else return FALSE; } else { // windoz if(!empty($this -> hostName)) { exec("nslookup -type=".$this->recType." ".$this -> hostName, $result); // check each line to find the one that starts with the host // name. If it exists then the function succeeded. foreach ($result as $line) { if(eregi("^".$this -> hostName,$line)) return true; } // otherwise there was no mail handler for the domain return false; } return false; } } // brake address --> username & parent domain function check_email_dns() { list($this -> userName, $this -> hostName) = split("@", $this -> email); if (!$this -> checkDNS ($this -> hostName)) { $this -> check_DNS_result = "Address domain MX DNS record could NOT be found"; return FALSE; } else { $this -> check_DNS_result = "Address DNS MX is OK"; return TRUE; } } // check addresse's SYNTAX function check_email() { if (preg_match('/^[-!#$%&'*+./0-9=?A -Z^_` {|}~ ]+@([-0-9A -Z ]+.)+([0-9A -Z ]){2,4}$ /i ', $this -> email)) { $this -> check_MAIL_result = "Address syntax is OK"; return TRUE; } else { $this -> check_MAIL_result = "Address syntax is WRONG"; return FALSE; } } // global check function final_mail_check() { if (!$this -> check_email_dns() OR !$this -> check_email()) return FALSE; else return TRUE; } // debuging ONLY function debug_address() { if ($this -> debug == 1) { echo "<br>"; echo "<b>DEBUG</b>:"; echo "<br>"; echo "<u>eMail</u>: ".$this -> email; echo "<br>"; echo "<u>DNS</u>: ".$this -> check_DNS_result; echo "<br>"; echo "<u>Syntax</u>: ".$this -> check_MAIL_result ; echo "<br>"; } } } ?>
<?php $check = new mail_check_global; // initiate class
$check -> email = "root@yahoo.com"; // REQUIRED --> address to check
$check -> debug = 1; // OPTIONAL --> default is 0; values: 0 / 1
$check -> system_OS = "win"; // OPTIONAL --> default is WINDOWS; values: win / linux
// USE: if($check -> final_mail_check()) ------------------ your action here --------;
// USE example:
if ($check -> final_mail_check()) echo "<font style=\"color:green; font-weight:bold\">Email address IS VALID!</font>";
else echo "<font style=\"color:red; font-weight:bold\">The address is NOT VALID!</font>";
$check -> debug_address(); // debuging purposes
?>
<?php $check = new mail_check_global; // initiate class $check -> email = "root@yahoo.com"; // REQUIRED --> address to check $check -> debug = 1; // OPTIONAL --> default is 0; values: 0 / 1 $check -> system_OS = "win"; // OPTIONAL --> default is WINDOWS; values: win / linux // USE: if($check -> final_mail_check()) ------------------ your action here --------; // USE example: if ($check -> final_mail_check()) echo "<font style=\"color:green; font-weight:bold\">Email address IS VALID!</font>"; else echo "<font style=\"color:red; font-weight:bold\">The address is NOT VALID!</font>"; $check -> debug_address(); // debuging purposes ?>
|
|
|
|
|
Gepost op: 05 september 2004 - 22:49 |
|
|
|
Nieuw lid

|
|
hmm ik wil hem include zodra hij bij de volgende pagina beland laat hij het weergeven zonder layout kan iemand mij helpen ? |
|
|
|
|
Gepost op: 05 september 2004 - 23:56 |
|
|
|
Intern Manager

|
|
Start maar een forumbericht wat het probleem is, met wat uitleg a.u.b. |
|
|
|
|
Gepost op: 26 september 2004 - 20:22 |
|
|
|
Nieuw lid

|
heej
als ik een bericht heb getypt in schrijven en dan op verzenden druk hoort die normaal automatisch naar lezen te gaan maar hij blijft bij mij met een leeg beeld hangen in schrijven, als ik dan net zovaak op vorige druk tot ik weer bij home ben en dan weer naar lezen ga dan staat hij er wel in, wat kan het probleem zijn.
ps: verder ist een cool script ;) |
|
|
|
|
Gepost op: 26 september 2004 - 21:57 |
|
|
|
Intern Manager

|
header ("location: lezen.php");
Deze code leest hij normaal als je een bericht verstuurt. Ik weet niet direct wat het probleem kan zijn. |
|
|
|
|
Gepost op: 28 september 2004 - 20:09 |
|
|
|
Nieuw lid

|
tis al gelukt hij doet het bedankt he jojo |
|
|
|
|
Gepost op: 08 oktober 2004 - 22:48 |
|
|
|
PHP ver gevorderde

|
ik heb uit dit gastenboek de emailcheck gehaald:
function check_email($address) {
list($local, $host) = explode("@", $address);
$pattern_local = "^([0-9a-z]*([-|_]?[0-9a-z]+)*)(([-|_]?)\.([-|_]?)[0-9a-z]*([-|_]?[0-9a-z]+)+)*([-|_]?)$";
$pattern_host = "^([0-9a-z]+([-]?[0-9a-z]+)*)(([-]?)\.([-]?)[0-9a-z]*([-]?[0-9a-z]+)+)*\.[a-z]{2,4}$";
$match_local = eregi($pattern_local, $local);
$match_host = eregi($pattern_host, $host);
if($match_local && $match_host) {
return 1;
} else {
return 0;
}
}
function check_email($address) { $pattern_local = "^([0-9a-z]*([-|_]?[0-9a-z]+)*)(([-|_]?)\.([-|_]?)[0-9a-z]*([-|_]?[0-9a-z]+)+)*([-|_]?)$"; $pattern_host = "^([0-9a-z]+([-]?[0-9a-z]+)*)(([-]?)\.([-]?)[0-9a-z]*([-]?[0-9a-z]+)+)*\.[a-z]{2,4}$"; $match_local = eregi($pattern_local, $local); $match_host = eregi($pattern_host, $host); if($match_local && $match_host) { return 1; } else { return 0; } }
wnr het een goed emailadres is dan doet hij het goed,wnt het een fout is dan zeg hij dat het fout is(wat ook goed is) maar er komt dan ook onder: undefined offset : 1 |
|
|
| Enkel aanvullende informatie, vragen en antwoorden op vragen zijn welkom. |
|
|
|