PHP reading lines from file and compare them -
I am trying to read all the rows from a file and try to see if what is in the given string None of these have row.
My code
$ mail = file ('blacklist.txt'); $ Email = "hendrik@anonbox.net"; $ Fail = False; Forex Currency ($ Mail $ as Mail) {If (SRPO ($ Email, $ Mail)> 0) {$ fail = true; }} If ($ failed) {echo "unsuccessful"; } And {echo "you can use it"; } blacklist.txt can be found here. I hope there will be a status returned for stops black list has at least one string, but it is not. I'm guessing that I am not generating any kind of values within $ mails because I hope. Edit it print_r ($ mails) EDIT2 Some explanations: I have to check whether a domain is inside email, even if in the mail is subdomain.domain.teed . And I got the & gt; Instead of ! Tried using the == incorrect ; 0 which achieved the same result.
Checking the domain of the email address, if there is blacklist inside it Example: $ email = "hendrik@foo.anonbox.net"; If (filter_var ($ email, FILTER_VALIDATE_EMAIL)) {preg_match ('/@.*? ([^.] + [.] \ W {3} | [^.]) $ /', $ Email, $ matches); If (! Empty ($ matches) & amp; amp;; ($ matches [1])) {$ domain = $ matches [1]; } And {// no good email exit; } // is for this sample, I know that you are using the file () $ blacklist = explosion ("\ n", file_get_contents ('http://pastebin.com/raw.php?i=aJyVkcNx ')); Forex currency (blacklist as $ email $) {if (strip ($ email, $ domain)! == incorrect) {resonant 'you are in black list'; Go out; }}} / / His email is OK Continue
Comments
Post a Comment