[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/core/disposable/ -> disposable.php (source)

   1  <?php
   2      # Disposable Email Checker - a static php based check for spam emails
   3      # Copyright (C) 2007 Victor Boctor
   4      #
   5      #     http://www.futureware.biz/disposable
   6      #     http://www.mantisbt.org/
   7      #
   8      # This program is distributed under the terms and conditions of the LGPL
   9      # See the README and LICENSE files for details
  10      #
  11      # Version 1.0.1 - Release Date: 31-July-2007 
  12  
  13      # --------------------------------------------------------
  14      # $Id: disposable.php,v 1.2 2007-08-01 23:10:09 zakman Exp $
  15      # --------------------------------------------------------
  16  
  17  /**
  18   * A class that checks an email address and provides some facts about whether
  19   * it is a disposable, free web mail, etc.  The data that is used to make 
  20   * such decision is static as part of the class implementation, hence
  21   * avoiding a round trip to a remote service.  This makes the class much
  22   * more efficient in scenarios where performance is an issue.
  23   */      
  24  class DisposableEmailChecker
  25  {
  26      /**
  27       * Determines if the email address is disposable.
  28       * 
  29       * @param $p_email  The email address to validate.
  30       * @returns true: disposable, false: non-disposable.
  31       */                        
  32  	function is_disposable_email( $p_email ) {
  33          return (
  34              DisposableEmailChecker::is_forwarding_email( $p_email ) ||
  35              DisposableEmailChecker::is_trash_email( $p_email ) ||
  36              DisposableEmailChecker::is_time_bound_email( $p_email ) ||
  37              DisposableEmailChecker::is_shredder_email( $p_email ) );
  38      }
  39  
  40      /**
  41       * Determines if the email address is disposable email that forwards to
  42       * users' email address.  This is one of the best kind of disposable 
  43       * addresses since emails end up in the user's inbox unless the user
  44       * cancel the address.
  45       * 
  46       * @param $p_email  The email address to check.
  47       * @returns true: disposable forwarding, false: otherwise.
  48       */          
  49  	function is_forwarding_email( $p_email ) {
  50          $t_domain = DisposableEmailChecker::_get_domain_from_address( $p_email );
  51  
  52          switch ( $t_domain ) {
  53              case 'gishpuppy.com':
  54              case 'jetable.org':
  55              case 'spambob.net':
  56              case 'spamex.com':
  57              case 'spamgourmet.com':
  58              case 'spamhole.com':
  59              case 'spammotel.com':
  60              case 'trashmail.net':
  61              case 'despammed.com':
  62              case 'e4ward.com':
  63              case 'emailias.com':
  64              case 'hidemail.de':
  65              case 'kasmail.com':
  66              case 'mailfreeonline.com':
  67              case 'mailmoat.com':
  68              case 'mailnull.com':
  69              case 'mailshell.com':
  70              case 'mailzilla.com':
  71              case 'mintemail.com':
  72              case 'netzidiot.de':
  73              case 'punkass.com':
  74              case 'safersignup.de':
  75              case 'sneakemail.com':
  76              case 'spamslicer.com':
  77              case 'spamtrail.com':
  78              case 'temporaryforwarding.com':
  79              case 'xemaps.com':
  80              case 'xmaily.com':
  81              case 'fakemailz.com':
  82              case 'shiftmail.com':
  83              case '1chuan.com': 
  84              case '1zhuan.com': 
  85              case '4warding.com': 
  86              case '4warding.net': 
  87              case '4warding.org': 
  88              case 'imstations.com': 
  89                  return true;
  90          }
  91  
  92          return false;
  93      }
  94  
  95      /**
  96       * Determines if the email address is trash email that doesn't forward to
  97       * user's email address.  This kind of address can be checked using a 
  98       * web page and no password is required for such check.  Hence, data sent
  99       * to such address is not protected.  Typically users use these addresses
 100       * to signup for a service, and then they never check it again.
 101       * 
 102       * @param $p_email  The email address to check.
 103       * @returns true: disposable trash mail, false: otherwise.
 104       */                                            
 105  	function is_trash_email( $p_email ) {
 106          $t_domain = DisposableEmailChecker::_get_domain_from_address( $p_email );
 107  
 108          switch ( $t_domain ) {
 109              case '10minutemail.com':
 110              case 'bspamfree.org':
 111              case 'dodgeit.com':
 112              case 'ichimail.com':
 113              case 'mailinator.com':
 114              case 'no-spam.hu':
 115              case 'pookmail.com':
 116              case 'spambob.com':
 117              case 'spambog.com':
 118              case 'spam.la':
 119              case 'tempinbox.com':
 120              case 'discardmail.com':
 121              case 'dodgeit.com':
 122              case 'dontsendmespam.de':
 123              case 'emaildienst.de':
 124              case 'getonemail.com':
 125              case 'haltospam.com':
 126              case 'ipoo.org':
 127              case 'killmail.net':
 128              case 'link2mail.net':
 129              case 'lortemail.dk':
 130              case 'maileater.com':
 131              case 'mytrashmail.com':
 132              case 'nobulk.com':
 133              case 'noclickemail.com':
 134              case 'nospamfor.us':
 135              case 'oneoffemail.com':
 136              case 'oopi.org':
 137              case 'pookmail.com':
 138              case 'rejectmail.com':
 139              case 'shortmail.net':
 140              case 'sofort-mail.de':
 141              case 'spamavert.com':
 142              case 'spamfree24.com':
 143              case 'spamfree24.org':
 144              case 'spamfree24.net':
 145              case 'spaml.com':
 146              case 'tempemail.net':
 147              case 'temporaryinbox.com':
 148              case 'trashmail.net':
 149              case 'trash-mail.de':
 150              case 'twinmail.de':
 151              case 'willselfdestruct.com':
 152              case 'yopmail.com':
 153              case 'mailinator.com':
 154              case 'mailinator2.com': 
 155              case 'sogetthis.com': 
 156              case 'mailin8r.com': 
 157              case 'mailinator.net': 
 158              case 'klassmaster.com':
 159              case 'fastacura.com':
 160              case 'fastchevy.com':
 161              case 'fastchrysler.com': 
 162              case 'fastkawasaki.com':
 163              case 'fastmazda.com':
 164              case 'fastmitsubishi.com': 
 165              case 'fastnissan.com':
 166              case 'fastsubaru.com':
 167              case 'fastsuzuki.com':
 168              case 'fasttoyota.com':
 169              case 'fastyamaha.com':
 170              case '675hosting.com': 
 171              case '675hosting.net': 
 172              case '675hosting.org': 
 173              case '75hosting.com': 
 174              case '75hosting.net': 
 175              case '75hosting.org': 
 176              case 'ajaxapp.net': 
 177              case 'amiri.net': 
 178              case 'amiriindustries.com': 
 179              case 'emailmiser.com': 
 180              case 'etranquil.com': 
 181              case 'etranquil.net': 
 182              case 'etranquil.org': 
 183              case 'gowikibooks.com': 
 184              case 'gowikicampus.com': 
 185              case 'gowikicars.com': 
 186              case 'gowikifilms.com': 
 187              case 'gowikigames.com': 
 188              case 'gowikimusic.com': 
 189              case 'gowikinetwork.com': 
 190              case 'gowikitravel.com': 
 191              case 'gowikitv.com':
 192              case 'myspaceinc.com': 
 193              case 'myspaceinc.net': 
 194              case 'myspaceinc.org': 
 195              case 'myspacepimpedup.com': 
 196              case 'ourklips.com': 
 197              case 'pimpedupmyspace.com': 
 198              case 'rklips.com': 
 199              case 'turual.com': 
 200              case 'upliftnow.com': 
 201              case 'uplipht.com': 
 202              case 'viditag.com': 
 203              case 'viewcastmedia.com': 
 204              case 'viewcastmedia.net': 
 205              case 'viewcastmedia.org': 
 206              case 'wetrainbayarea.com': 
 207              case 'wetrainbayarea.org': 
 208              case 'xagloo.com': 
 209              case 'buyusedlibrarybooks.org':
 210              case 'mailquack.com':
 211              case 'mailslapping.com':
 212              case 'oneoffmail.com':
 213              case 'recyclemail.dk':
 214              case 'anonymail.dk':
 215              case 'trashdevil.com':
 216              case 'trashdevil.de':
 217              case 'whopy.com':
 218              case 'wilemail.com':
 219                  return true;
 220          }
 221  
 222          return false;
 223      }
 224  
 225      /**
 226       * Determines if the email address is a shredder email address.  Shredder
 227       * email address delete all received emails without forwarding them or 
 228       * making them available for a user to check.
 229       * 
 230       * @param $p_email  The email address to check.
 231       * @returns true: shredded disposable email, false: otherwise.
 232       */                                  
 233  	function is_shredder_email( $p_email ) {
 234          $t_domain = DisposableEmailChecker::_get_domain_from_address( $p_email );
 235  
 236          switch ( $t_domain ) {
 237              case 'spambob.org':
 238                  return true;
 239          }
 240  
 241          return false;
 242      }
 243  
 244      /**
 245       * Determines if the email address is time bound, these are the disposable
 246       * addresses that auto expire after a pre-configured time.  For example,
 247       * 10 minutes, 1 hour, 2 hours, 1 day, 1 month, etc.  These address can
 248       * also be trash emails or forwarding emails.
 249       * 
 250       * @param $p_email  The email address to check.
 251       * @returns true: time bound disposable email, false: otherwise.
 252       */                                       
 253  	function is_time_bound_email( $p_email ) {
 254          $t_domain = DisposableEmailChecker::_get_domain_from_address( $p_email );
 255  
 256          switch ( $t_domain ) {
 257              case '10minutemail.com':
 258              case 'jetable.org':
 259              case 'no-spam.hu':
 260              case 'spamhole.com':
 261              case 'trashmail.net':
 262              case 'despam.it':
 263              case 'dontreg.com':
 264              case 'emailto.de':
 265              case 'getonemail.com':
 266              case 'guerrillamail.com':
 267              case 'guerrillamail.net':
 268              case 'haltospam.com':
 269              case 'jetable.com':
 270              case 'jetable.net':
 271              case 'jetable.org':
 272              case 'kasmail.com':
 273              case 'link2mail.net':
 274              case 'mailexpire.com':
 275              case 'mailzilla.com':
 276              case 'mintemail.com':
 277              case 'noclickemail.com':
 278              case 'oneoffemail.com':
 279              case 'oopi.org':
 280              case 'pookmail.com':
 281              case 'shortmail.net':
 282              case 'spambox.us':
 283              case 'spamfree24.com':
 284              case 'spamfree24.org':
 285              case 'spamfree24.net':
 286              case 'spamify.com':
 287              case 'tempemail.net':
 288              case 'tempinbox.com':
 289              case 'temporarily.de':
 290              case 'temporaryinbox.com':
 291              case 'wh4f.org':
 292              case 'yopmail.com':
 293              case 'buyusedlibrarybooks.org':
 294              case 'dotmsg.com':
 295              case 'lovemeleaveme.com':
 296              case 'trashdevil.com':
 297              case 'trashdevil.de':
 298              case 'walala.org':
 299                  return true;
 300          }
 301  
 302          return false;
 303      }
 304  
 305      /**
 306       * Determines if the email address is a free email address.  These are
 307       * addresses that users can sign up for free.  They then has to login to
 308       * these address to get the emails.  These are not considered to be 
 309       * disposable emails, however, if the application is providing a free
 310       * trial for an expensive server, then users can signup for more accounts
 311       * to get further trials.
 312       * 
 313       * If applications are to block these addresses, it is important to be aware
 314       * that some users use free webmail as their primary email and that such
 315       * service providers include hotmail, gmail, and yahoo.
 316       */                                                  
 317  	function is_free_email( $p_email ) {
 318          $t_domain = DisposableEmailChecker::_get_domain_from_address( $p_email );
 319  
 320          switch ( $t_domain ) {
 321              case 'gmail.com':
 322              case 'googlemail.com':
 323              case 'hotmail.com':
 324              case 'yahoo.com':
 325              case 'msn.com':
 326              case 'hotmail.de':
 327              case 'hotmail.fr':
 328              case 'hotmail.it':
 329              case 'hotmail.co.uk':
 330              case 'msn.co.uk':
 331              case 'pancakemail.com':
 332              case 'gawab.com':
 333              case 'yahoo.com.au':
 334              case 'yahoo.com.cn':
 335              case 'yahoo.co.uk':
 336              case 'yahoo.com.hk':
 337              case 'yahoo.com.ar':
 338              case 'yahoo.com.br':
 339              case 'yahoo.com.mx':
 340              case 'yahoo.com.asia':
 341              case 'yahoo.co.jp':
 342              case 'yahoo.com.malaysia':
 343              case 'yahoo.com.ph':
 344              case 'yahoo.com.sg':
 345              case 'yahoo.com.tw':
 346              case 'yahoo.com.vn':
 347              case 'yahoo.com.es':
 348              case 'yahoo.fr':
 349              case 'yahoo.ie':
 350              case 'yahoo.de':
 351              case 'yahoo.ca':
 352              case 'talk21.com':
 353              case 'BTinternet.com':
 354              case 'lycos.co.uk':
 355              case 'lycos.it':
 356              case 'lycos.es':
 357              case 'lycos.de':
 358              case 'lycos.at':
 359              case 'lycos.nl':
 360              case 'caramail.com':
 361              case 'mail.com':
 362              case 'libero.it':
 363              case 'iol.it':
 364              case 'blu.it':
 365              case 'aol.com':
 366              case 'aim.com':
 367              case 'netscape.com':
 368              case 'netscape.net':
 369              case 'mail.ru':
 370              case 'inbox.ru':
 371              case 'bk.ru':
 372              case 'list.ru':
 373              case 'rediffmail.com':
 374              case 'hanmail.net':
 375              case 'webmail.co.za':
 376              case 'exclusivemail.co.za':
 377              case 'executive.co.za':
 378              case 'homemail.co.za':
 379              case 'magicmail.co.za':
 380              case 'mailbox.co.za':
 381              case 'ravemail.co.za':
 382              case 'starmail.co.za':
 383              case 'thecricket.co.za':
 384              case 'thegolf.co.za':
 385              case 'thepub.co.za':
 386              case 'therugby.co.za':
 387              case 'websurfer.co.za':
 388              case 'workmail.co.za':
 389                  return true;
 390          }
 391  
 392          return false;
 393      }
 394  
 395      /**
 396       * A debugging function that takes in an email address and dumps out the
 397       * details for such email.
 398       * 
 399       * @param $p_email  The email address to echo results for.  This must be a 
 400       *                  safe script (i.e. no javascript, etc).                          
 401       */                        
 402  	function echo_results( $p_email ) {
 403          echo 'email address = ', htmlspecialchars( $p_email ), '<br />';
 404          echo 'is_disposable_email = ', DisposableEmailChecker::is_disposable_email( $p_email ), '<br />'; 
 405          echo 'is_forwarding_email = ', DisposableEmailChecker::is_forwarding_email( $p_email ), '<br />'; 
 406          echo 'is_trash_email = ', DisposableEmailChecker::is_trash_email( $p_email ), '<br />'; 
 407          echo 'is_time_bound_email = ', DisposableEmailChecker::is_time_bound_email( $p_email ), '<br />'; 
 408          echo 'is_shredder_email = ', DisposableEmailChecker::is_shredder_email( $p_email ), '<br />'; 
 409          echo 'is_free_email = ', DisposableEmailChecker::is_free_email( $p_email ), '<br />'; 
 410      }
 411  
 412      //
 413      // Private functions, shouldn't be called from outside the class
 414      //
 415  
 416      /**
 417       * A helper function that takes in an email address and returns a lower case
 418       * domain.
 419       *
 420       * @param $p_email  The email address to extra the domain from.
 421       * @returns The lower case domain or empty string if email not valid.
 422       */                             
 423  	function _get_domain_from_address( $p_email ) {
 424          $t_domain_pos = strpos( $p_email, '@' );
 425          if ( $t_domain_pos === false ) {
 426              return '';
 427          }
 428  
 429          return strtolower( substr( $p_email, $t_domain_pos + 1 ) );
 430      }
 431  }
 432  ?>


Généré le : Thu Nov 29 09:42:17 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics