Welcome, Guest!!
follow us on... rss

Author Topic: Noobie comments  (Read 5317 times)

devil

  • Newbie
  • *
  • Posts: 3
    • View Profile
Noobie comments
« on: June 28, 2009, 07:34:23 AM »
Hi!

Have installed BotScout on an SMF forum. A test run showed there was an unspecified error when a known bot user ID was used and the registration was aborted, without trace (not even in the error log).

However, I expected an email notification which didn't arrive. The instructions are ambiguous (it suggests on/off, when the code is preset to 'false'). I set it thus:

   // Send e-mail notices?
   $send_alerts = true;

Is this correct?

MysteryFCM

  • Moderator
  • Full Member
  • *****
  • Posts: 200
    • View Profile
    • I.T. Mate
Re: Noobie comments
« Reply #1 on: June 28, 2009, 07:39:09 AM »
That is correct, yes. Can you post the full error message and the code you are using please?

Please also, as far as the e-mail is concerned, check the SMTP server is set correctly (if applicable)
Regards
Steven Burn
I.T. Mate / hpHosts
it-mate.co.uk / hosts-file.net

Mike

  • Administrator
  • Sr. Member
  • *****
  • Posts: 300
    • View Profile
Re: Noobie comments
« Reply #2 on: June 28, 2009, 11:16:11 AM »
Please also, as far as the e-mail is concerned, check the SMTP server is set correctly (if applicable)

As MysteryFCM mentioned, check that SMTP is set correctly, and you might also check to make sure that the email isn't ending up in your spam folder.
Please don't PM me for assistance- post your questions in the forum where others can see them.

devil

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Noobie comments
« Reply #3 on: July 02, 2009, 11:05:33 PM »
Thanks! Error as shown:



I assume SMTP is OK. I receive other notifications correctly.

I always check the spam folder and I'm extra careful when expecting something like that. However, there is a remote chance that it got lost via my ISP, although I've never known their filtering to remove a wanted message: it lets through enough unwanted ones.

Code:
Quote
<?php

if (!defined('SMF'))
   die('Hacking attempt...');

function checkBotScout($username, $email)
{
   global $sourcedir, $txt, $webmaster_email;

   // Your optional API key (if you don't have one
   // you can get one here: http://botscout.com/)
   $APIKEY = '[REMOVED]';

   // Send e-mail notices?
   $send_alerts = true;

   $ip = $_SERVER['REMOTE_ADDR'];
   $email = urlencode($email);

   $query = 'http://botscout.com/test/?multi&mail=' . $email . '&ip=' . $ip . (!empty($APIKEY) ? '&key=' . $APIKEY : '');

   if (function_exists('curl_init'))
   {
      $ch = curl_init($query);
      curl_setopt($ch, CURLOPT_HEADER, 0);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      $returned_data = curl_exec($ch);
      curl_close($ch);
   }
   else
   {
      require_once($sourcedir . '/Subs-Package.php');

      $returned_data = fetch_web_data($query);
   }

   if(substr($returned_data, 0,1) == '!'){
      // if the first character is an exclamation mark, an error has occurred  
      $err_msg = fatal_lang_error($returned_data, true);
      exit;
   }

   if (empty($returned_data))
      return false;
   else
      $returned_data = explode('|', $returned_data);

      // sample 'MULTI' return string
      // Y|MULTI|IP|4|MAIL|26|NAME|30
      
      // $botdata[0] - 'Y' if found in database, 'N' if not found, '!' if an error occurred
      // $botdata[1] - type of test (will be 'MAIL', 'IP', 'NAME', or 'MULTI')
      // $botdata[2] - descriptor field for item (IP)
      // $botdata[3] - how many times the IP was found in the database
      // $botdata[4] - descriptor field for item (MAIL)
      // $botdata[5] - how many times the EMAIL was found in the database
      // $botdata[6] - descriptor field for item (NAME)
      // $botdata[7] - how many times the NAME was found in the database

   if ($returned_data[0] == 'Y' && $send_alerts)
   {
      require_once($sourcedir . '/Subs-Post.php');

      sendmail($webmaster_email, $txt['botscout_mail_subject'], sprintf($txt['botscout_mail_body'], $username, $email, $ip));
      fatal_lang_error('registration_disabled', false);
   }
   elseif ($returned_data[0] == 'Y')
      fatal_lang_error('registration_disabled', false);
   else
      return;
}

?>

Hope this helps!
« Last Edit: July 03, 2009, 05:36:32 AM by MysteryFCM »

MysteryFCM

  • Moderator
  • Full Member
  • *****
  • Posts: 200
    • View Profile
    • I.T. Mate
Re: Noobie comments
« Reply #4 on: July 03, 2009, 05:38:34 AM »
I've removed your key from the post (this should never be posted publicly)

I can't see anything wrong with the code. Can you tell me if the issue persists when you turn off $send_alerts ??
Regards
Steven Burn
I.T. Mate / hpHosts
it-mate.co.uk / hosts-file.net

devil

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Noobie comments
« Reply #5 on: July 03, 2009, 11:33:29 PM »
Thanks. I copy/pasted a random name and e-mail from your blacklist and tried to register it, with the $send_alerts set to false. It seemed to pass all tests, as you can see below, ringed in red. (I'll remove this registration).



If you wish to see for yourself, the forum URL is http://www.cypenv.org/smf/index.php (still set for false)

MysteryFCM

  • Moderator
  • Full Member
  • *****
  • Posts: 200
    • View Profile
    • I.T. Mate
Re: Noobie comments
« Reply #6 on: July 04, 2009, 08:04:06 AM »
That would seem to imply it's either not flagging it properly, or not processing it properly. Could you try replacing;

Code: [Select]
   if ($returned_data[0] == 'Y' && $send_alerts)
   {
      require_once($sourcedir . '/Subs-Post.php');

      sendmail($webmaster_email, $txt['botscout_mail_subject'], sprintf($txt['botscout_mail_body'], $username, $email, $ip));
      fatal_lang_error('registration_disabled', false);
   }
   elseif ($returned_data[0] == 'Y')
      fatal_lang_error('registration_disabled', false);
   else
      return;
}

With;

Code: [Select]
if ($returned_data[0] == 'Y' && $send_alerts)
{
require_once($sourcedir . '/Subs-Post.php');
      sendmail($webmaster_email, $txt['botscout_mail_subject'], sprintf($txt['botscout_mail_body'], $username, $email, $ip));
      fatal_lang_error('registration_disabled', false);
    }else{
$debug=false;
    if ($returned_data[0] == 'Y'){
fatal_lang_error('registration_disabled', false);
}else{
return;
}
if($debug==true){
die('DEBUG: '.$returned_data[0]);
}
}

If it does the same thing, change $debug=false; to true, then re-run it so we can see what it contains.

I notice btw, that the query URL doesn't seem to be sending the username, did you change this? If so, change it back to;

Code: [Select]
$query = 'http://botscout.com/test/?multi&mail=' . $email .'&name=' . $username . '&ip=' . $ip . (!empty($APIKEY) ? '&key=' . $APIKEY : '')
Regards
Steven Burn
I.T. Mate / hpHosts
it-mate.co.uk / hosts-file.net