nand
08-22-2004, 12:53 PM
How can I modify listaccts function from Accounting.php.inc so it would list accounts with a contact e-mail next to it somehow (for exaple you can use it to synchronize it with other db)
![]() | View Full Version : Cpanel - WHM Accounting.php.inc - modify listaccts nand 08-22-2004, 12:53 PM How can I modify listaccts function from Accounting.php.inc so it would list accounts with a contact e-mail next to it somehow (for exaple you can use it to synchronize it with other db) nand 08-23-2004, 05:03 PM any way to list that damn contact e-mails?? tehtech 08-23-2004, 08:17 PM I don't have access to the file at the moment. could you copy and paste the code into a php box? nand 08-24-2004, 08:43 AM thats the Accounting.php.inc listaccts funcion. global $cpanelaccterr; function listaccts ($host,$user,$accesshash,$usessl) { $result = whmreq("/scripts2/listaccts?nohtml=1&viewall=1",$host,$user,$accesshash,$usess$ if ($cpanelaccterr != "") { return; } $page = split("\n",$result); foreach ($page as $line) { list($acct,$contents) = split("=", $line); if ($acct != "") { $allc = split(",", $contents); $accts[$acct] = $allc; function whmreq ($request,$host,$user,$accesshash,$usessl) { $cleanaccesshash = preg_replace("'(\r|\n)'","",$accesshash); $authstr = $user . ":" . $cleanaccesshash; $cpanelaccterr = ""; if (function_exists("curl_init")) { $ch = curl_init(); if ($usessl) { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0); curl_setopt($ch, CURLOPT_URL, "https://${host}:2087" . $request); } else { curl_setopt($ch, CURLOPT_URL, "http://${host}:2086" . $request); } curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $curlheaders[0] = "Authorization: WHM $authstr"; curl_setopt($ch,CURLOPT_HTTPHEADER,$curlheaders); $data=curl_exec ($ch); curl_close ($ch); } elseif (function_exists("socket_create")) { if ($usessl) { $cpanelaccterr = "SSL Support requires curl"; } $service_port = 2086; $address = gethostbyname($host); $socket = socket_create (AF_INET, SOCK_STREAM, 0); if ($socket < 0) { $cpanelaccterr = "socket_create() failed"; return; } $result = socket_connect ($socket, $address, $service_port); if ($result < 0) { $cpanelaccterr = "socket_connect() failed"; return; } $in = "GET $request HTTP/1.0\n"; socket_write($socket,$in,strlen($in)); $in = "Connection: close\n"; socket_write($socket,$in,strlen($in)); $in = "Authorization: WHM $authstr\n\n\n"; socket_write($socket,$in,strlen($in)); $inheader = 1; while(($buf = socket_read($socket, 512)) != false) { if (!$inheader) { $data .= $buf; } if(preg_match("'\r\n\r\n$'s", $buf)) { $inheader = 0; } if(preg_match("'\n\n$'s", $buf)) { } if(preg_match("'\n\n$'s", $buf)) { $inheader = 0; } if(preg_match("'\r\n$'s", $buf)) { $inheader = 0; } } } else { $cpanelaccterr = "php not compiled with --enable-sockets OR curl"; return; } return $data; |