Author Topic: Mod request: Ban free email accounts  (Read 6046 times)

0 Members and 1 Guest are viewing this topic.

Offline lakeside

  • Full Member
  • ***
  • Posts: 123
    • View Profile
Mod request: Ban free email accounts
« on: June 12, 2003, 02:52:37 AM »
I have the need to ban or rather not let anyone using a free email provider access to register on my site.

So I want to not allow hotmail freemail lycos etc etc etc etc etc.

The problem seems to be that people signup for multiple email accounts on places like hotmail and the only way I spoted this was because a user registered with a username that is almost the same as another registered user in that one might be dubulous and kubulous  and they both have hotmail accounts, so I'd rather just ban any further signups that use any of the free email accounts but allow the ones already registered to stay.

Has anyone done this, is doing this or can do this?

Thanks,

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Mod request: Ban free email accounts
« Reply #1 on: June 12, 2003, 03:06:50 AM »
omg...this is mass murder... :? j/k
and why ppl even do register more then ones? I always thought that its more difficult make ppl register...but do it twice... :?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline lakeside

  • Full Member
  • ***
  • Posts: 123
    • View Profile
Mod request: Ban free email accounts
« Reply #2 on: June 12, 2003, 03:08:15 AM »
I know I should be gratefull for someone wanting to add more than 25 photos to my site, but it just sits in my craw that they go to the trouble to circumvent the system I have in place now.

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Mod request: Ban free email accounts
« Reply #3 on: June 12, 2003, 03:28:03 AM »
Sorry, I don't have an answer for you.  Try searching hotscripts.com or google.com for a php script that does this.  

Here's one way to ensure users provide a valid email address during registration.

Open includes/functions.php

Replace:
Code: [Select]

function check_email($email) {
  return (preg_match('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i', $email)) ? 1 : 0;
}

with this:
Code: [Select]

function check_email($email) {
  return(!MailChek($email, 2));
}

function MailChek($Addr, $Level, $Timeout = 15000) {

//  Valid Top-Level Domains
    $gTLDs = "com:net:org:edu:gov:mil:int:arpa:aero:biz:coop:info:museum:name:";
    $CCs   = "ad:ae:af:ag:ai:al:am:an:ao:aq:ar:as:at:au:aw:az:ba:bb:bd:be:bf:".
             "bg:bh:bi:bj:bm:bn:bo:br:bs:bt:bv:bw:by:bz:ca:cc:cf:cd:cg:ch:ci:".
             "ck:cl:cm:cn:co:cr:cs:cu:cv:cx:cy:cz:de:dj:dk:dm:do:dz:ec:ee:eg:".
             "eh:er:es:et:fi:fj:fk:fm:fo:fr:fx:ga:gb:gd:ge:gf:gh:gi:gl:gm:gn:".
             "gp:gq:gr:gs:gt:gu:gw:gy:hk:hm:hn:hr:ht:hu:id:ie:il:in:io:iq:ir:".
             "is:it:jm:jo:jp:ke:kg:kh:ki:km:kn:kp:kr:kw:ky:kz:la:lb:lc:li:lk:".
             "lr:ls:lt:lu:lv:ly:ma:mc:md:mg:mh:mk:ml:mm:mn:mo:mp:mq:mr:ms:mt:".
             "mu:mv:mw:mx:my:mz:na:nc:ne:nf:ng:ni:nl:no:np:nr:nt:nu:nz:om:pa:".
             "pe:pf:pg:ph:pk:pl:pm:pn:pr:pt:pw:py:qa:re:ro:ru:rw:sa:sb:sc:sd:".
             "se:sg:sh:si:sj:sk:sl:sm:sn:so:sr:st:su:sv:sy:sz:tc:td:tf:tg:th:".
             "tj:tk:tm:tn:to:tp:tr:tt:tv:tw:tz:ua:ug:uk:um:us:uy:uz:va:vc:ve:".
             "vg:vi:vn:vu:wf:ws:ye:yt:yu:za:zm:zr:zw:";

//  The countries can have their own 'TLDs', e.g. mydomain.com.au
    $cTLDs = "com:net:org:edu:gov:mil:co:ne:or:ed:go:mi:aero:biz:coop:info:museum:name:";

    $fail = 0;

//  Shift the address to lowercase to simplify checking and trim
    $Addr = trim(strtolower($Addr));

//  Check for spaces
    if (ereg(" ", $Addr)) $fail = 1;

//  Split the Address into user and domain parts
    $UD = explode("@", $Addr);
    if (sizeof($UD) != 2 || !$UD[0]) $fail = 1;

//  Split the domain part into its Levels
    $Levels = explode(".", $UD[1]); $sLevels = sizeof($Levels);
    if (!$Levels[0] || !$Levels[1]) $fail = 1;

//  Get the TLD, strip off trailing ] } ) > and check the length
    $tld = $Levels[$sLevels-1];
    $tld = ereg_replace("[>)}]$|]$", "", $tld);
    if (strlen($tld) < 2
    || (strlen($tld) > 3 && !ereg(":$tld:", ":arpa:aero:coop:info:museum:name:"))) $fail = 1;

    $Level--;

//  If the string after the last dot isn't in the generic TLDs or country codes, it's invalid.
    if ($Level && !$fail) {
    $Level--;
    if (!ereg($tld.":", $gTLDs) && !ereg($tld.":", $CCs)) $fail = 2;
    }

//  If it's a country code, check for a country TLD; add on the domain name.
    if ($Level && !$fail) {
    $cd = $sLevels - 2; $domain = $Levels[$cd].".".$tld;
    if (ereg($Levels[$cd].":", $cTLDs)) { $cd--; $domain = $Levels[$cd].".".$domain; }
    }

//  See if there's an MX record for the domain
    if ($Level && !$fail) {
    $Level--;
    if (!getmxrr($domain, $mxhosts, $weight)) $fail = 3;
    }

//  Attempt to connect to port 25 on an MX host
    if ($Level && !$fail) {
    $Level--;
    while (!$sh && list($nul, $mxhost) = each($mxhosts))
      $sh = fsockopen($mxhost, 25);
    if (!$sh) $fail=4;
    }

//  See if anyone answers
    if ($Level && !$fail) {
    $Level--;
    set_socket_blocking($sh, false);
    $out = ""; $t = 0;
    while ($Timeout-- && !$out)
      $out = fgets($sh, 256);
    if (!ereg("^220", $out)) $fail = 5;
    }

    if ($sh) fclose($sh);

    return $fail;
}

Offline Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
Mod request: Ban free email accounts
« Reply #4 on: June 12, 2003, 11:36:25 AM »
If you don't want that members uploads so many pics, why don't u modify this mod - [Mod] User upload limits?

http://www.4homepages.de/forum/viewtopic.php?t=3607&highlight=limit

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Mod request: Ban free email accounts
« Reply #5 on: June 12, 2003, 11:45:07 AM »
Quote from: Lucifix1
If you don't want that members uploads so many pics, why don't u modify this mod - [Mod] User upload limits?

http://www.4homepages.de/forum/viewtopic.php?t=3607&highlight=limit

actualy that's the reason he needs restrict registration with "common" emails....;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)