Ver Mensaje Individual
  #17 (permalink)  
Antiguo 30/10/2008, 23:17
emilio_devoto
 
Fecha de Ingreso: octubre-2008
Mensajes: 21
Antigüedad: 15 años, 6 meses
Puntos: 1
Respuesta: email @midominio.com

haces lo siguiente.
recorda que el archivo cpemail.php está armado de esta manera.

<?php

################################################## #############
# cPanel Email Account Creator 1.3
################################################## #############
# Visit http://www.zubrag.com/scripts/ 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
################################################## #############

// Antispam image
// Show CAPTCHA - true, do not show - false
// In case you set this to true, you may want to update settings in the antispam.php
// Also when using this feature, fonts must exist on your system.
// By default antispam.php is setup to use arial.ttf
// For details see http://www.zubrag.com/scripts/antispam-image-generator.php
$antispam = false;

// cPanel info
$cpuser = 'elfuego'; // cPanel username
$cppass = 'civile99'; // cPanel password
$cpdomain = 'www.elfuegodehorcas.com.ar'; // cPanel domain or IP
$cpskin = 'x3'; // cPanel skin. Mostly x or x2.
// See following URL to know how to determine your cPanel skin
// http://www.zubrag.com/articles/determine-cpanel-skin.php

// Default email info for new email accounts
// These will only be used if not passed via URL
$epass = 'hispassword'; // email password
$edomain = 'elfuegodehorcas.com.ar'; // 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))
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&passwor d=$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 = "<h2>Bienvenido, tu email {$euser}@{$edomain} ya ha sido creado.</h2>";

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

break;

}

?>
<html>
<head><title>cPanel Email Account Creator</title></head>
<body>
<?php echo '<div style="color:red">'.$msg.'</div>'; ?>
<h1>cPanel Email Account Creator</h1>
<form name="frmEmail" method="post">
<table width="400" border="0">
<tr><td>Username:</td><td><input name="user" size="20" value="<?php echo htmlentities($euser); ?>" /></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>







bueno, separas el codigo de esta forma.

1º parte del codigo todo lo que esta antes de la etiqueta <html>, osea

<?php

################################################## #############
# cPanel Email Account Creator 1.3
################################################## #############
# Visit http://www.zubrag.com/scripts/ 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
################################################## #############

// Antispam image
// Show CAPTCHA - true, do not show - false
// In case you set this to true, you may want to update settings in the antispam.php
// Also when using this feature, fonts must exist on your system.
// By default antispam.php is setup to use arial.ttf
// For details see http://www.zubrag.com/scripts/antispam-image-generator.php
$antispam = false;

// cPanel info
$cpuser = 'xxxxxxxxxxxxx'; // cPanel username
$cppass = 'xxxxxxxxxx'; // cPanel password
$cpdomain = 'xxxxxxxxxxx'; // cPanel domain or IP
$cpskin = 'x3'; // cPanel skin. Mostly x or x2.
// See following URL to know how to determine your cPanel skin
// http://www.zubrag.com/articles/determine-cpanel-skin.php

// Default email info for new email accounts
// These will only be used if not passed via URL
$epass = 'hispassword'; // email password
$edomain = 'xxxxxxxxxxxxxxxxx'; // 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))
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&passwor d=$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 = "<h2>Bienvenido, tu email {$euser}@{$edomain} ya ha sido creado.</h2>";

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

break;

}

?>

----------------------------------------------------------------------------

2da parte del codigo, lo que imprime, osea lo que está entre las etiquetas <body> y </body> es decir:
<?php echo '<div style="color:red">'.$msg.'</div>'; ?>
<h1>cPanel Email Account Creator</h1>
<form name="frmEmail" method="post">
<table width="400" border="0">
<tr><td>Username:</td><td><input name="user" size="20" value="<?php echo htmlentities($euser); ?>" /></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>





si? bueno, ahora, recordando el codigo original, pero tomando el primer troso de codigo que hemos divivido, lo insertas en el mismo lugar que estaba, pero con la salvedad de que lo estaras haciendo en tu propia pag. es decir.

tomas el primer fragmento del codigo del archivo cpemail.php y lo insertas antes de la etiqueta <html> de TU seccion webmail.

luego tomas el segundo trozo del codigo y lo pegas en donde quieres que aparezca el formulario.

cuando ya has insertado todo el codigo en tu pagina, guardala como cpemail.php, peroojo, procura de hacerte una copia del cpemail.php original por si las moscas.