Author Topic: Base Email Sigup  (Read 7754 times)

Offline anhvienls

  • Newbie
  • *
  • Posts: 4
Base Email Sigup
« on: August 18, 2007, 09:42:21 PM »
Only one file php. I find it in google, I think you will need so post to 4rum

 ;)

Code: [Select]
<?php
###############################################################
# cPanel Email Account Creator 1.2
###############################################################
# Visit [url]http://www.zubrag.com/scripts/[/url] for updates
############################################################### 
# You can pass following parameters in calling URL. They will
# override those specified below.
# user - new email user
# pass - password
# domain - email domain
# quota - email quota, Mb
# Example: cpemail.php?user=newuser&pass=password&quota=50
############################################################### 
// cPanel info
$cpuser 'prozone3'// cPanel username
$cppass 'prozone1'// cPanel password
$cpdomain 'prozone.name'// cPanel domain or IP
$cpskin 'x3'// cPanel skin. Mostly x or x2. 

// See following URL to know how to determine your cPanel skin
// [url]http://www.zubrag.com/articles/determine-cpanel-skin.php[/url]
// Default email info for new email accounts
// These will only be used if not passed via URL
$epass '123456'// email password
$edomain 'prozone.name'// email domain (usually same as cPanel domain above)
$equota 20// 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'$edomain);
$equota getVar('quota'$equota);
$msg '';

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

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


<html>
<head><title>cPanel Email Account Creator</title></head>
<body>
<?php echo $msg?>
<h1>cPanel Email Account Creator</h1>
<form name=&quot;frmEmail&quot; method=&quot;post&quot;>
<table width=&quot;400&quot; border=&quot;0&quot;>
<tr><td>Username:</td><td><input name=&quot;user&quot; size=&quot;20&quot; value=&quot;<?php echo htmlentities($euser); ?>&quot; /></td></tr>
<tr><td>Password:</td><td><input name=&quot;pass&quot; size=&quot;20&quot; type=&quot;password&quot; /></td></tr>
<tr><td colspan=&quot;2&quot; align=&quot;center&quot;><input name=&quot;submit&quot; type=&quot;submit&quot; value=&quot;Create Email Account&quot; /></td></tr>
</table>
</form>
</body>
</html>