Zubrag.com
August 25, 2019, 09:41:21 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: All in one?  (Read 17404 times)
enzoworld
Newbie
*
Posts: 6


« on: March 13, 2007, 02:54:22 AM »

Could be had one script all in one?
- Subdomains
- Database MySql
- Account ftp
- Email Forward

Please help me… : (

i'm italian....sorry for my english

Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #1 on: March 13, 2007, 06:54:34 AM »

Do you want script to create all those things?
- Subdomain
- Database MySql
- FTP Account
- Email Forward

it is possible to create such script by combining existing scripts. You'll need to download those 4 scripts, and create one more php script which would call them one by one. Lets say you name it newuser.php

<?php
$domain =  'cpanel-domain.com';

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

$subdomain = getVar('subdomain');
$dbname = getVar('dbname', $subdomain);  // will be the same as subdomain if not passed
$ftpuser = getVar('ftpuser',$subdomain); // will be the same as subdomain if not passed
$ftppassword = getVar('ftppass');
$ftpquota = getVar('ftpquota',50); // will be 50 if not passed
$ftphomedir = getVar('ftphomedir','/');  // will be root folder if not passed
$euser = getVar('euser',$subdomain);  // will be the same as subdomain if not passed
$eforward = getVar('eforward'); // Example: johny@site2.com

file_get_contents("http://example.com/cpanel_subdomains.php?cpaneluser={$cpaneluser}&cpanelpass={$cpanelpass}&domain={$domain}&subdomain={$subdomain}");
file_get_contents("http://example.com/cpanel_create_db.php?db={$dbname}");
file_get_contents("http://example.com/cpanel-add-ftp.php?domain={$domain}&fuser={$ftpuser}&fpass={$ftppassword}&fquota={$ftpquota}&fhomedir={$ftphomedir}");
file_get_contents("http://example.com/cpanel_email_forwarder.php?euser={$euser}&edomain={$domain}&eforward={$eforward}");
?>


Sample usage:
newuser.php?subdomain=test&dbname=testdb&ftpuser=test&ftppass=testpass&ftpquota=50&ftphomedir=/&euser=johny&eforward=johny@gmail.com

Please note you can omit some parameters and default values will be used.

If you run it like this
newuser.php?subdomain=test&ftppass=testpass&eforward=johny@gmail.com
dbname will be the same as subdomain name (i.e. test)
ftpuser will be the same as subdomain name (i.e. test)
ftpquota will be set to 50
ftphomedir will be set to root folder
euser will be the same as subdomain name (i.e. test)

Make sure you updated cpanel username / password in the settings section of those 4 downloaded scripts.

Also I did not test this, so it may not work as is and may need some tweaking.
Logged
enzoworld
Newbie
*
Posts: 6


« Reply #2 on: March 13, 2007, 08:38:23 AM »

 Cry Cry NOW THIS:

Warning: file_get_contents(cpanel_subdomains.php?cpaneluser=&cpanelpass=&domain=italiafree.org&subdomain=test) [function.file-get-contents]: failed to open stream: No such file or directory in /home/italiafr/public_html/newuser.php on line 20

Warning: file_get_contents(cpanel_create_db.php?db=testdb) [function.file-get-contents]: failed to open stream: No such file or directory in /home/italiafr/public_html/newuser.php on line 21

Warning: file_get_contents(cpanel-add-ftp.php?domain=italiafree.org&fuser=test&fpass=testpass&fquota=50&fhomedir=/) [function.file-get-contents]: failed to open stream: No such file or directory in /home/italiafr/public_html/newuser.php on line 22

Warning: file_get_contents(cpanel_email_forwarder.php?euser=johny&edomain=italiafree.org&eforward=johny@gmail.com) [function.file-get-contents]: failed to open stream: No such file or directory in /home/italiafr/public_html/newuser.php on line 23
Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #3 on: March 13, 2007, 08:42:28 AM »

Did you download those 4 scripts I mentioned before? They should be placed in the same folder with newuser.php. Note: you'll also have to update settings in those scripts (in the header of each script). At least set cpanel username and password in each script.

sub-domain creator
database creator
ftp creator
email forwarder creator

I'm going to rewrite all cpanel scripts to make it easier to "combine" them. But not sure when I have time for that. Maybe this weekend.
Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #4 on: March 13, 2007, 08:53:24 AM »

Are you on cPanel server? These scripts will only work if you are on cPanel managed server.
Logged
enzoworld
Newbie
*
Posts: 6


« Reply #5 on: March 13, 2007, 08:54:18 AM »

yes i'm on a cpanel X server
Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #6 on: March 13, 2007, 08:58:03 AM »

ok, so it still does not work? If so i'll need your cpanel login/password. You could send me a private message so I could update those programs and send them to you. Also I'll need your cpanel theme. Is it x or x2? Please check how to know cPanel skin.
Logged
enzoworld
Newbie
*
Posts: 6


« Reply #7 on: March 14, 2007, 07:17:51 AM »

Can you add forme the module???
Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #8 on: March 14, 2007, 02:45:04 PM »

You'll have to replace example.com with correct domain name below. Make sure you downloaded all 4 scripts (links provided above).
<?php

$domain = 'example.com';

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

$subdomain = getVar('subdomain');
$dbname = getVar('dbname', $subdomain);  // will be the same as subdomain if not passed
$ftpuser = getVar('ftpuser',$subdomain); // will be the same as subdomain if not passed
$ftppassword = getVar('ftppass');
$ftpquota = getVar('ftpquota',50); // will be 50 if not passed
$ftphomedir = getVar('ftphomedir','/');  // will be root folder if not passed
$euser = getVar('euser',$subdomain);  // will be the same as subdomain if not passed
$eforward = getVar('eforward'); // Example: johny@site2.com

if (trim($subdomain) != "") {
  file_get_contents("http://example.com/cpanel_subdomains.php?cpaneluser={$cpaneluser}&cpanelpass={$cpanelpass}&domain={$domain}&subdomain={$subdomain}");
  file_get_contents("http://example.com/cpanel_create_db.php?db={$dbname}");
  file_get_contents("http://example.com/cpanel-add-ftp.php?domain={$domain}&fuser={$ftpuser}&fpass={$ftppassword}&fquota={$ftpquota}&fhomedir={$ftphomedir}");
  file_get_contents("http://example.com/cpanel_email_forwarder.php?euser={$euser}&edomain={$domain}&eforward={$eforward}");

  die("Subdomain {$subdomain}.{$domain} created.");
 
}

?>
<center>
<div style="width:500px;">
<form>
Username: <input name="subdomain" size="20" /><br />
Password for FTP: <input name="ftppass" type="password" size="20" /><br />
Email Address: <input name="eforward" size="30" /><br />
<input type="submit" value="Submit">
</form>
</div>
</center>
Logged
smithster
Web Trade Pro
Newbie
*
Posts: 27


WWW
« Reply #9 on: March 20, 2007, 07:33:53 PM »

I am having a problem with this script, all worked fine.  I decided that I wanted to take away the email forwarding option and add in the email account creator option.  I tried to change variables so all matched up.  I don't know PHP all that well but I am understanding the way the script works.  For some reason, and I have played about with it as much as I can!!  I just cannot get it to set up an email account.  The script does everything else perfect.  Subdomain and FTP account is created.  No database is created but I will look into that later.

I have zipped up all required files and I have Private Messaged the link to you Zubrag.  I hope you don't mind, I just took your advice and I haven't posted the link on here!!

Please have a look if you can.  Thank you so much for your help.

Paul.
Logged

S
enzoworld
Newbie
*
Posts: 6


« Reply #10 on: March 24, 2007, 09:05:53 AM »

zubrag,
did you do the check script???
Logged
smithster
Web Trade Pro
Newbie
*
Posts: 27


WWW
« Reply #11 on: March 29, 2007, 07:54:10 AM »

If you need help with this I may be able to help as my scripts are fully working.  Just let me know.
Logged

S
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC