Author Topic: RouncCube Captcha plugin  (Read 5340 times)

Offline system_owner

  • Newbie
  • *
  • Posts: 4
RouncCube Captcha plugin
« on: August 17, 2014, 11:14:31 PM »
Has anyone else run into this?

If we are hosting multiple domains on the same mail server so that you can go to:

www.domain1.com/webmail
www.domain2.com/webmail
www.domain3.com/webmail

and they all hit the same mail webserver, how can we get the RoundCube captcha module to keep track of what url/domain it came in on and then have the ability to add a captcha pub/priv key pair for each domain in the config.inc.php file and it choose the correct pair based on the incoming domain url with an If.....else if...else if..... statement?

Does anyone know which variable it is that holds the url of the incoming domain that is sent to verify the captcha and how it can be passed over to the config.inc.php file when pulling the pub/priv key pair so that it can determine which pair to use when running through the If..else lines??

Thanks.

Offline ABerglund

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 673
Re: RouncCube Captcha plugin
« Reply #1 on: August 18, 2014, 10:55:58 AM »
Not sure how your server is configured, but in Linux/Apache, it would be far simpler to have three separate installs of Roundcube on the server, each one answering one of the domains. All three instances could still share the same database (or they could have separate DBs), and point at the same IMAP server, but that way they're be no confusion over which domain the plugin should use.
Arne Berglund
SysAdmin, Internet Services
Lane Education Service District
Eugene, OR, USA

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,429
    • http://SKaero.com/
Re: RouncCube Captcha plugin
« Reply #2 on: August 18, 2014, 11:41:13 AM »
I can understand why you would want one install, you should be able to get the domain name in the global variable $_SERVER['HTTP_HOST']

Offline system_owner

  • Newbie
  • *
  • Posts: 4
Re: RouncCube Captcha plugin
« Reply #3 on: August 18, 2014, 03:08:04 PM »
Actually I found an article with the MyRoundCube site.  This code below does the trick.  Simply replace the code in the config.inc.php file where you normally put in the public and private keys with the code below.  I have it working for 11 domains already perfectly.

Thanks.

$domainkeys = array(
   'mydomain_1.tld'  => array(
   'publickey'  => '...publickey_1...',
   'privatekey' => '...privatekey_1...',
  ),
   'mydomain_2.tld'  => array(
   'publickey'  => '...publickey_2...',
   'privatekey' => '...privatekey_2...',
  ),
);
$domain = explode('.', $_SERVER['HTTP_HOST']);
if(count($domain) > 2){
  array_shift($domain);
}
$domain = implode('.', $domain);
$config['recaptcha_publickey']  = $domainkeys[$domain]['publickey'];
$config['recaptcha_privatekey'] = $domainkeys[$domain]['privatekey'];