Commit | Line | Data |
---|---|---|
bc13d5d6 H |
1 | <?php |
2 | /* | |
3 | * Email.inc 1.00 2001/03/08 | |
4 | * | |
5 | * Copyright 2001 Czech On Line a.s. All Rights Reserved. | |
6 | */ | |
7 | ||
8 | ||
9 | ||
10 | /** | |
11 | * see class.html.mime.mail.inc for more details about | |
12 | * send email functions | |
13 | */ | |
14 | class Email { | |
15 | ||
16 | function Email() { | |
17 | } | |
18 | ||
19 | /** | |
20 | * is e-mail address valid ? | |
21 | * | |
22 | * @param email e-mail addess | |
23 | * | |
24 | * @return true or false | |
25 | */ | |
26 | function isValidEmail($email) { | |
27 | // valid e-mail address must contain @ | |
28 | if (strpos($email,'@') == 0) { | |
29 | return false; | |
30 | } | |
31 | // validace domeny proti DNS | |
32 | if (getmxrr($domain.".",$null) == false) return false; | |
33 | ||
34 | return true; | |
35 | } | |
36 | ||
37 | /** | |
38 | * Validate e-mail address | |
39 | * tries to correct invalid e-mail | |
40 | * | |
41 | * @param email e-mail addess | |
42 | * | |
43 | * @return the original e-mail address or modified e-mail address | |
44 | */ | |
45 | function validateEmail($email) { | |
46 | ||
47 | // replace .cy to .cz | |
48 | $email = eregi_replace("\.cy$",".cz",$email); | |
49 | ||
50 | // domain doen't contain ., let's add .cz | |
51 | $domain = substr($email,strpos($email,"@")+1,1024); | |
52 | if (strpos($domain,".") == 0) { | |
53 | $domain.=".sk"; | |
54 | $email.=".sk"; | |
55 | } | |
56 | return $email; | |
57 | } | |
58 | ||
59 | function isEmailRegexpValid($email) { | |
60 | if (eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,4}$", $email)) { | |
61 | return TRUE; | |
62 | } else { | |
63 | return FALSE; | |
64 | } | |
65 | } | |
66 | ||
67 | } | |
68 | ?> |