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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.