Zubrag.com
May 24, 2019, 07:58:11 AM *
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: how do i add a contact email when creating whm package?  (Read 13717 times)
minadreapta
Newbie
*
Posts: 5


« on: April 16, 2007, 03:24:25 PM »

when one creates a new account in whm there are several fields required: domain,username,password,plan, email.

i used your script "cPanel/WHM Account Creator for Reseller" to create accounts and it works fine except it doesn't add a contact email to the account.

any ideea how to add it?

normally i should add another field to the form with the name "email" but what's the function or variable in Accounting.php.inc that parses the contact email and adds it to whm?

thanks.

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


WWW
« Reply #1 on: April 17, 2007, 01:42:59 AM »

Currently I'm not aware of how to do that with php. Unfortunately WHM documentation is scarce, only basic functionality listed. Have one idea, but do not have WHM access. If somebody could provide WHM access so I could try...  No guarantee I resolve this issue though.
Logged
minadreapta
Newbie
*
Posts: 5


« Reply #2 on: April 18, 2007, 01:56:26 AM »

can you share this ideea? unfortunately i cannot provide you with whm access due to security issues...very sorry about that.

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


WWW
« Reply #3 on: April 18, 2007, 02:17:45 AM »

I understand, not a problem. The idea is email could be passed as last parameter to the createacct function. You could try that. I will need to analyze Accounting.inc.php if it really accepts email parameter. Maybe will find another way of doing that.
Logged
minadreapta
Newbie
*
Posts: 5


« Reply #4 on: April 18, 2007, 05:20:46 AM »

i tried this, it doesn't work. i think the function createaccount is accepting only 8 parameters but i am not 100% about this....
Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #5 on: April 18, 2007, 10:09:34 AM »

What is your cPanel version? Could you send me Accounting.inc.php via pm? It contains no sensitive info, but maybe I'll find some code for contact email setup.
Logged
minadreapta
Newbie
*
Posts: 5


« Reply #6 on: April 18, 2007, 11:25:01 AM »

cpanel version: 10.9.0-RELEASE 118

i am a hosting reseller, i think i don't have access to Accounting.php.inc because i don't own the server...
Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #7 on: April 19, 2007, 04:36:30 AM »

Please try this updated script. Does it work ok?

Code:
<?php

###############################################################
# cPanel WHM Account Creator 1.1
###############################################################
# Visit http://www.zubrag.com/scripts/ for updates
###############################################################
# Required parameters:
# - domain - new account domain
# - user - new account username
# - password - new account password
# - package - new account hosting package (plan)
# - email - contact email
#
# Sample run: create-whm-account.php?domain=reseller.com&user=hosting&password=manager&package=unix_500&email=my@email.com
#
# If no parameters passed then input form will be shown to enter data.
#
# This script can also be run from another PHP script. This may
# be helpful if you have some user interface already in place and 
# want to automatically create WHM accounts from there.
# In this case you have to setup following variables instead of
# passing them as parameters:
# - $user_domain - new account domain
# - $user_name - new account username
# - $user_pass - new account password
# - $user_plan - new account hosting package (plan)
# - $user_email - contact email
#
###############################################################

///////  YOUR WHM LOGIN DATA
$whm_user   "root";      // reseller username
$whm_pass   "password";  // the password you use to login to WHM

#####################################################################################
##############          END OF SETTINGS. DO NOT EDIT BELOW    #######################
#####################################################################################

$whm_host   $_SERVER['HTTP_HOST'];

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

// Domain name of new hosting account
// To create subdomain just pass full subdomain name
// Example: newuser.zubrag.com
if (!isset($user_domain)) {
  
$user_domain getVar('domain');
}

// Username of the new hosting account
if (!isset($user_name)) {
  
$user_name getVar('user');
}

// Password for the new hosting account
if (!isset($user_pass)) {
  
$user_pass getVar('password');
}

// New hosting account Package
if (!isset($user_plan)) {
  
$user_plan getVar('package');
}

// Contact email
if (!isset($user_email)) {
  
$user_email getVar('email');
}

// if parameters passed then create account
if (!empty($user_name)) {

  
// create account on the cPanel server
  
$script "http://{$whm_user}:{$whm_pass}@{$whm_host}:2086/scripts/wwwacct";
  
$params "?plan={$user_plan}&domain={$user_domain}&username={$user_name}&password={$user_pass}&contactemail={$user_email}";
  
$result file_get_contents($script.$params);

  
// output result
  
echo "RESULT: " $result;
}
// otherwise show input form
else {
$frm = <<<EOD
<html>
<head>
  <title>cPanel/WHM Account Creator</title>
  <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
  <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</head>
<body>
  <style>
    input { border: 1px solid black; }
  </style>
<form method="post">
<h3>cPanel/WHM Account Creator</h3>
<table border="0">
<tr><td>Domain:</td><td><input name="domain" size="30"></td><td>Subdomain or domain, without www</td></tr>
<tr><td>Username:</td><td><input name="user" size="30"></td><td>Username to be created</td></tr>
<tr><td>Password:</td><td><input name="password" size="30"></td><td></td></tr>
<tr><td>Package:</td><td><input name="package" size="30"></td><td>Package (hosting plan) name. Make sure you cpecify existing package</td></tr>
<tr><td>Contact Email:</td><td><input name="email" size="30"></td><td></td></tr>
<tr><td colspan="3"><br /><input type="submit" value="Create Account"></td></tr>
</table>
</form>
</body>
</html>
EOD;
echo 
$frm;
}

?>
Logged
minadreapta
Newbie
*
Posts: 5


« Reply #8 on: April 19, 2007, 04:42:01 AM »

it worked like a charm,

thank you so much.
Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #9 on: April 19, 2007, 05:11:40 AM »

I've replaced previous version of the WHM account creator with this one. Thanks for your help!
Logged
Pages: [1]
  Print  
 
Jump to:  

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