<?php
$ch = curl_init ("http://www.example.com/");
$fp = fopen ("example_homepage.txt", "w");
curl_setopt ($ch, CURLOPT_FILE, $fp);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_exec ($ch);
curl_close ($ch);
fclose ($fp);
?>
<?
require '/usr/local/cpanel/Cpanel/Accounting.php.inc';
$host = "servername.mydomain.ch";
$user = "root";
$accesshash ="578000b5df90234237972f5a3d3197ac
1d0abcac2bddff103ef4f8e370932e46
b8e7810359823464563c5001ebd1d26
ac432ec5683cbfa906e6f8993543814f
eef2be05ab1234421802c4d68eeef31
- cuted -
d5458fe6d4e0dffec77fbcebc5d7b584
27abfa35c73463fe6af1379e43db6a6e
717649c65ddb62e45a45671f8d7613d5";
$usessl = "1";
$acctdomain = "domain.com";
$acctuser = "username";
$acctpass = "pass";
$acctplan = "NovaLight";
$do = createacct ($host,$user,$accesshash,$usessl,$acctdomain,$acctuser,$acctpass,$acctplan);
print_r($do);
?>
You must put your remote key in one line without spaces.Originally posted by CoolMike
cPanel.net Support Ticket Number:Code:<? require '/usr/local/cpanel/Cpanel/Accounting.php.inc'; $host = "servername.mydomain.ch"; $user = "root"; $accesshash ="[/b]578000b5df90234237972f5a3d3197ac 1d0abcac2bddff103ef4f8e370932e46 b8e7810359823464563c5001ebd1d26 ac432ec5683cbfa906e6f8993543814f eef2be05ab1234421802c4d68eeef31 - cuted - d5458fe6d4e0dffec77fbcebc5d7b584 27abfa35c73463fe6af1379e43db6a6e 717649c65ddb62e45a45671f8d7613d5[b]"; $usessl = "1"; $acctdomain = "domain.com"; $acctuser = "username"; $acctpass = "pass"; $acctplan = "NovaLight"; $do = createacct ($host,$user,$accesshash,$usessl,$acctdomain,$acctuser,$acctpass,$acctplan); print_r($do); ?>
rvskin said:One thing I would like to warning you about this code. You are explosing security issue to your server. The essencial part is $accesshash now on php code which world readable. Any clients on your server could easily find them(if they know about how Cpanel works) and workaround to do with all your accounts.
cPanel.net Support Ticket Number:
<?php
if (eregi("cpconf.inc.php", $_SERVER['PHP_SELF'])) {
die("Nice try bub but you are not authorized to view this file!!");
}
$host = "localhost";
$user = "username";
$usessl = "1";
$accesshash = 'ACCESS HASH HERE
';
?>
Rubbish (you're on a roll today).However you are SORELY INCORRECT PHP IS NOT World readable it will always be executed AS PHP which means that all that happens is they will execute it if you have jail enabled they wont be able to even GET the code via SSH OR FTP because they are restricted to their respective directory
Are you using fedora core 2 by any chance? i had a lot of problems with these sort of proceedures until i updated (well downgraded) my shadow-utils.birkoss said:I was using the script to change the password I saw on this post, and it was working, now I move on another server, and it "works", but its very long to do, and it said :
The page cannot be displayed .... 2-3 minutes after, but it changed my password, what can do that ? Maybe the curl isn't configured correctly, or something else.
The script is :
function changer_password ($host,$user,$accesshash,$usessl,$acctpass,$acctuser)
{
$result = whmreq("/scripts/passwd?remote=1&nohtml=1&password=${acctpass}&domain=${acctuser}&user=${acctuser}&submit-domain=Change%0D%0A++++++Password",$host,$user,$accesshash,$usessl);
if ($cpanelaccterr != "") { return false; }
return $result;
}
Thanks
birkoss