Roundcube Community Forum

Third Party Contributions => API Based Plugins => Topic started by: antonyf on September 06, 2011, 04:13:19 PM

Title: self registration script for Cpanel needs a little tweak but its easy to impliment in
Post by: antonyf on September 06, 2011, 04:13:19 PM
Title: self registration script for Cpanel needs a little tweak but its easy to impliment in
Post by: antonyf on September 09, 2011, 06:04:59 AM
i just wanted to add this piece here: to make an actual plugin for the Roundcubemail you only need this code below. it is the mail.php without the password protect file..

$antispam = false;

// cPanel info
$cpuser = 'maincontrol panel username'; // cPanel username
$cppass = 'control panel password here'; // cPanel password
$cpdomain = 'main hosting domain ex: domain.com'; // cPanel domain or IP
$cpskin = 'x3';  
$epass = 'hispassword'; // email password leave this as is..
$equota = 300; // amount of space in megabytes

###############################################################
# END OF SETTINGS
###############################################################

function getVar($name, $def = '') {
  if (isset($_REQUEST[$name]))
    return $_REQUEST[$name];
  else
    return $def;
}

// check if overrides passed
$euser = getVar('user', '');
$epass = getVar('pass', $epass);
$edomain = getVar('domain','');
$equota = getVar('quota', $equota);

                   
$msg = '';

if (!empty($euser))
while(true) {

  if ($antispam) {
    @session_start(); // start session if not started yet
    if ($_SESSION['AntiSpamImage'] != $_REQUEST['anti_spam_code']) {
      // set antispam string to something random, in order to avoid reusing it once again
      $_SESSION['AntiSpamImage'] = rand(1,9999999);
 
      // let user know incorrect code entered
      $msg = '

Incorrect antispam code entered.

';
      break;
    }
    else {
      // set antispam string to something random, in order to avoid reusing it once again
      $_SESSION['AntiSpamImage'] = rand(1,9999999);
    }
  }

  // Create email account
  $f = fopen ("http://$cpuser:$cppass@$cpdomain:2082/frontend/$cpskin/mail/doaddpop.html?email=$euser&domain=$edomain&password=$epass"a=$equota", "r");
  if (!$f) {
    $msg = 'Cannot create email account. Possible reasons: "fopen" function allowed on your server, PHP is running in SAFE mode';
    break;
  }

  $msg = "

Your Email {$euser}@{$edomain} has been created.

";

  // Check result
  while (!feof ($f)) {
    $line = fgets ($f, 1024);
    if (ereg ("already exists", $line, $out)) {
      $msg = "

Email account {$euser}@{$edomain} already exists.

";
      break;
    }
  }
  @fclose($f);

  break;

}

?>




'.$msg.''; ?>

Enter Name,domain and password for your email account.








           











Access emailLogout
Username:
Domain:
Password:
"CAPTCHA"




Title: whats is required for Cpanel self registration
Post by: antonyf on September 09, 2011, 06:07:04 AM
i just wanted to add this piece here: to make an actual plugin for the Roundcubemail you only need this code below. it is the mail.php without the password protect file..
$antispam = false;

// cPanel info
$cpuser = 'maincontrol panel username'; // cPanel username
$cppass = 'control panel password here'; // cPanel password
$cpdomain = 'main hosting domain ex: domain.com'; // cPanel domain or IP
$cpskin = 'x3';  
$epass = 'hispassword'; // email password leave this as is..
$equota = 300; // amount of space in megabytes

###############################################################
# END OF SETTINGS
###############################################################

function getVar($name, $def = '') {
  if (isset($_REQUEST[$name]))
    return $_REQUEST[$name];
  else
    return $def;
}

// check if overrides passed
$euser = getVar('user', '');
$epass = getVar('pass', $epass);
$edomain = getVar('domain','');
$equota = getVar('quota', $equota);

                   
$msg = '';

if (!empty($euser))
while(true) {

  if ($antispam) {
    @session_start(); // start session if not started yet
    if ($_SESSION['AntiSpamImage'] != $_REQUEST['anti_spam_code']) {
      // set antispam string to something random, in order to avoid reusing it once again
      $_SESSION['AntiSpamImage'] = rand(1,9999999);
 
      // let user know incorrect code entered
      $msg = '

Incorrect antispam code entered.

';
      break;
    }
    else {
      // set antispam string to something random, in order to avoid reusing it once again
      $_SESSION['AntiSpamImage'] = rand(1,9999999);
    }
  }

  // Create email account
  $f = fopen ("http://$cpuser:$cppass@$cpdomain:2082/frontend/$cpskin/mail/doaddpop.html?email=$euser&domain=$edomain&password=$epass"a=$equota", "r");
  if (!$f) {
    $msg = 'Cannot create email account. Possible reasons: "fopen" function allowed on your server, PHP is running in SAFE mode';
    break;
  }

  $msg = "

Your Email {$euser}@{$edomain} has been created.

";

  // Check result
  while (!feof ($f)) {
    $line = fgets ($f, 1024);
    if (ereg ("already exists", $line, $out)) {
      $msg = "

Email account {$euser}@{$edomain} already exists.

";
      break;
    }
  }
  @fclose($f);

  break;

}

?>




'.$msg.''; ?>

Enter Name,domain and password for your email account.








           











Access emailLogout
Username:
Domain:
Password:
"CAPTCHA"




Title: self registration script for Cpanel needs a little tweak but its easy to impliment in
Post by: antonyf on September 14, 2011, 10:35:36 AM
hi.
I think that Rosali has made a Cpanel login plugin from portions of the code above... i would recommend just waiting a day or two until it is released...
best regards
Antony
Title: self registration script for Cpanel needs a little tweak but its easy to impliment in
Post by: rosali on September 14, 2011, 11:21:06 PM
Yes, I have coded a driver for my register plugin. Thanks to  Web Hosting : Professional Web Hosting from Just Host (http://www.justhost.com) for contributions by setting up a cPanel test environment for free.

The driver is included into MyRoundcube plugins bundle (Roundcube 0.6-rc bundle v.1.2).
Title: self registration script for Cpanel needs a little tweak but its easy to impliment in
Post by: ragt1327 on October 22, 2011, 11:13:40 AM
Dear rosali

I have checked the roundcube 0.6 but unable to see any such driver or plugin for cPanel Registration. Can u explain with little brief.
Title: self registration script for Cpanel needs a little tweak but its easy to impliment in
Post by: rosali on October 22, 2011, 11:15:49 PM
You are looking for _register_ plugin (myroundcube - RoundCube Plugins - Google Project Hosting (http://myroundcube.googlecode.com)).
Title: self registration script for Cpanel needs a little tweak but its easy to impliment in
Post by: ragt1327 on December 20, 2011, 11:40:06 AM
We are unable to get screen for User Registration in RC0.7. And also which we found is for Hmail server only. It will be a gr8 help for us if we found a plugin or scripts for cPanel.