Author Topic: self registration script for Cpanel needs a little tweak but its easy to impliment in  (Read 2810 times)

Offline antonyf

  • Newbie
  • *
  • Posts: 6

Offline antonyf

  • Newbie
  • *
  • Posts: 6
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..

<?php
$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 '<h2>Incorrect antispam code entered.</h2>';
      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&quota=$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 "<h3>Your Email {$euser}@{$edomain} has been created.</h3>";

  
// Check result
  
while (!feof ($f)) {
    
$line fgets ($f1024);
    if (
ereg ("already exists"$line$out)) {
      
$msg "<h2>Email account {$euser}@{$edomain} already exists.</h2>";
      break;
    }
  }
  @
fclose($f);

  break;

}

?>
<html>
<head>
</head>
<body>
<?php echo '<div style="color:red;font-size:11px">'.$msg.'</div>'?>
<h4>Enter Name,domain and password for your email account.</h4>
<form name="frmEmail" method="post">
<table width="100%" height="125px" border="0" align="center"><tr>
<td><a href="https://www.domainone.com/folder" target="_blank">Access email</a></td>
<td><font color="#B4B4B4"#</font><a href="https://www.domainone.com/folder/nospamming.html">Logout</a></td></tr>
<tr><td>Username:</td><td><input name="user" size="20" value="" /></td></tr>
<tr><td>Domain:</td><td><select class=\"inputbox\" id="domain" name="domain"> 
            <option value="domainone.com">domainone.com</option>
            <option value="domainone.com">domainone.com</option>
            <option value="domainone.com">domainone.com</option>
            <option value="domainone.com">domainone.com</option>
            <option value="domainone.com">domainone.com</option>    
            <option value="domainone.com">domainone.com</option>        
            <option value="domainone.com">domainone.com</option>
            <option value="">More comming soon</option>
            </select></td>
            </tr>
<tr>
<td>Password:</td><td><input name="pass" size="20" type="password" /></td>
</tr>
<?php if ($antispam) { ?>
<tr>
<td><img src="antispam.php" alt="CAPTCHA" /></td><td><input name="anti_spam_code" size="20" /></td>
</tr>
<?php ?>
<tr>
<td colspan="2" align="center"><hr /><input name="submit" type="submit" value="Create Email Account" /></td>
</tr>
</table>
</form>
</body>
</html>

Offline antonyf

  • Newbie
  • *
  • Posts: 6
whats is required for Cpanel self registration
« Reply #2 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..
<?php
$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 '<h2>Incorrect antispam code entered.</h2>';
      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&quota=$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 "<h3>Your Email {$euser}@{$edomain} has been created.</h3>";

  
// Check result
  
while (!feof ($f)) {
    
$line fgets ($f1024);
    if (
ereg ("already exists"$line$out)) {
      
$msg "<h2>Email account {$euser}@{$edomain} already exists.</h2>";
      break;
    }
  }
  @
fclose($f);

  break;

}

?>
<html>
<head>
</head>
<body>
<?php echo '<div style="color:red;font-size:11px">'.$msg.'</div>'?>
<h4>Enter Name,domain and password for your email account.</h4>
<form name="frmEmail" method="post">
<table width="100%" height="125px" border="0" align="center"><tr>
<td><a href="https://www.domainone.com/folder" target="_blank">Access email</a></td>
<td><font color="#B4B4B4"#</font><a href="https://www.domainone.com/folder/nospamming.html">Logout</a></td></tr>
<tr><td>Username:</td><td><input name="user" size="20" value="" /></td></tr>
<tr><td>Domain:</td><td><select class=\"inputbox\" id="domain" name="domain"> 
            <option value="domainone.com">domainone.com</option>
            <option value="domainone.com">domainone.com</option>
            <option value="domainone.com">domainone.com</option>
            <option value="domainone.com">domainone.com</option>
            <option value="domainone.com">domainone.com</option>    
            <option value="domainone.com">domainone.com</option>        
            <option value="domainone.com">domainone.com</option>
            <option value="">More comming soon</option>
            </select></td>
            </tr>
<tr>
<td>Password:</td><td><input name="pass" size="20" type="password" /></td>
</tr>
<?php if ($antispam) { ?>
<tr>
<td><img src="antispam.php" alt="CAPTCHA" /></td><td><input name="anti_spam_code" size="20" /></td>
</tr>
<?php ?>
<tr>
<td colspan="2" align="center"><hr /><input name="submit" type="submit" value="Create Email Account" /></td>
</tr>
</table>
</form>
</body>
</html>

Offline antonyf

  • Newbie
  • *
  • Posts: 6
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

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Yes, I have coded a driver for my register plugin. Thanks to  Web Hosting : Professional Web Hosting from Just Host 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).
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline ragt1327

  • Newbie
  • *
  • Posts: 2
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.

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline ragt1327

  • Newbie
  • *
  • Posts: 2
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.