lordphate Posted July 17, 2006 Share Posted July 17, 2006 Warning: Invalid argument supplied for foreach() in /home/*/public_html/order/EP_Dev_cPanel_API_PHP4.php on line 497 Okay...so here's the code 10 lines before and after...[code] $this->accountList = $accountList; } /** * Parse fetched account list for domain list, user package list, * and reseller list. */ function parseAccountList() { foreach($this->accountList as $reseller => $reseller_data) LINE ERROR! { foreach($reseller_data as $user => $user_data) { $this->domainList[$user] = $user_data['domain']; $this->userPackageList[$user] = $user_data['package']; $this->resellerList[$reseller][$user] = $user_data['domain']; } } }[/code] Link to comment https://forums.phpfreaks.com/topic/14891-confused-on-this/ Share on other sites More sharing options...
trq Posted July 17, 2006 Share Posted July 17, 2006 We need to see the accountList method. Link to comment https://forums.phpfreaks.com/topic/14891-confused-on-this/#findComment-59678 Share on other sites More sharing options...
lordphate Posted July 17, 2006 Author Share Posted July 17, 2006 Its for WHM auto-creation script..so it's using WHM functions Link to comment https://forums.phpfreaks.com/topic/14891-confused-on-this/#findComment-59681 Share on other sites More sharing options...
trq Posted July 17, 2006 Share Posted July 17, 2006 Cool. That helps heaps!Once again, we need to see the accountList method.PS: If this isn't your script your in the wrong forum, we have one especially for help with 3rd party scripts. Link to comment https://forums.phpfreaks.com/topic/14891-confused-on-this/#findComment-59683 Share on other sites More sharing options...
trq Posted July 17, 2006 Share Posted July 17, 2006 Actually... its not a method. At the very top of your code snippet you have the line....[code]$this->accountList = $accountList;[/code]Where is $accountList being created? Link to comment https://forums.phpfreaks.com/topic/14891-confused-on-this/#findComment-59684 Share on other sites More sharing options...
lordphate Posted July 17, 2006 Author Share Posted July 17, 2006 It is my script here's the accountList:[code] function fetchAccountList() { $result = $this->doCommand("/scripts/reslist"); $match = preg_match("/<html>.*?<tr class=\"tblheader\">.*?(<tr class=\"tblheader\">.*?)<\/table><\/html>/is", $result, $matches); if ($match) { $second_matches = explode("<tr class=\"tblheader\">", $matches[1]); foreach($second_matches as $key => $value) { unset($all_matches); // skip key 0 (empty) if ($key == 0) continue; if (preg_match_all("/.*?<b><u>(.*?)<\/u><\/b>.*?<b>.*?<\/b>.*?<b>(.*?)<\/b>(.*<\/tr>)/is", $value, $all_matches, PREG_SET_ORDER)) { for($i=0; $i<count($all_matches); $i++) { $reseller_username = $all_matches[$i][1]; $reseller_domain = $all_matches[$i][2]; $reseller_data = $all_matches[$i][3]; // set this intially... although it will likely be set again (but that doesn't matter) $accountList[$reseller_username][$reseller_username]['domain'] = $reseller_domain; $accountList[$reseller_username][$reseller_username]['package'] = "undefined"; if (preg_match_all("/<tr class=\"tdshade[12]+\"><td>(.*?)<\/td>.*?<td>(.*?)<\/td>.*?<td>(.*?)<\/td>.*?<\/tr>/is", $reseller_data, $reseller_matches, PREG_SET_ORDER)) { for($j=0; $j<count($reseller_matches); $j++) { $current_user = $reseller_matches[$j][1]; $current_domain = $reseller_matches[$j][2]; $current_package = $reseller_matches[$j][3]; $accountList[$reseller_username][$current_user]['domain'] = $current_domain; $accountList[$reseller_username][$current_user]['package'] = $current_package; } } } } } } $this->accountList = $accountList; } /** * Parse fetched account list for domain list, user package list, * and reseller list. */ function parseAccountList() { foreach($this->accountList as $reseller => $reseller_data) { foreach($reseller_data as $user => $user_data) { $this->domainList[$user] = $user_data['domain']; $this->userPackageList[$user] = $user_data['package']; $this->resellerList[$reseller][$user] = $user_data['domain']; } } } [/code] Link to comment https://forums.phpfreaks.com/topic/14891-confused-on-this/#findComment-59685 Share on other sites More sharing options...
trq Posted July 17, 2006 Share Posted July 17, 2006 Whatever... its pretty hard to say whats going on, but basically the error is saying that $this->accountList is not an array. What does....[code=php:0]print_r($this->accountList);[/code]produce? Link to comment https://forums.phpfreaks.com/topic/14891-confused-on-this/#findComment-59694 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.