Jump to content

Calendar Email Ban Help


pjohn323

Recommended Posts

Calendar does not provide for IP discovery nor specific email blocking.  I am getting bombed with Spammers, The code below is my attempt to prevent certain email domains from registering.  What am I doing wrong (red is my code edit)

 

Calendar register.php

function check_email ( $uemail ) {
  global $control, $error;

  if ( ! strlen ( $uemail ) ) {
    $error = translate ( 'Email address cannot be blank.' );
    return false;
  }
  $banned = array(
    '21cn',
    'tom',
    'siteposter',
  );
  foreach($banned as $ban){
    if (strpos(strtolower($uemail), "@$ban.")){
      $error .= '<li>' . 'Registration not permitted from these email providers.';
      return false;
    }
  $res = dbi_execute ( 'SELECT cal_email FROM webcal_user WHERE cal_email = ?',
    array ( $uemail ) );
  if ( $res ) {
    $row = dbi_fetch_row ( $res );
    if ( $row[0] == $uemail ) {
      $control = '';
      $error = translate ( 'Email address already exists.' );
      return false;
    }
  }
  return true;
}

Link to comment
https://forums.phpfreaks.com/topic/206324-calendar-email-ban-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.