Jump to content


Photo

Confused on this...


  • Please log in to reply
6 replies to this topic

#1 lordphate

lordphate
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts

Posted 17 July 2006 - 10:23 PM

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...
		$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'];
				}
			}
	}


#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 17 July 2006 - 10:45 PM

We need to see the accountList method.

#3 lordphate

lordphate
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts

Posted 17 July 2006 - 10:47 PM

Its for WHM auto-creation script..so it's using WHM functions

#4 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 17 July 2006 - 10:49 PM

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.

#5 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 17 July 2006 - 10:51 PM

Actually... its not a method. At the very top of your code snippet you have the line....

$this->accountList = $accountList;

Where is $accountList being created?

#6 lordphate

lordphate
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts

Posted 17 July 2006 - 10:52 PM

It is my script here's the accountList:
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'];
				}
			}
	}


#7 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 17 July 2006 - 11:42 PM

Whatever... its pretty hard to say whats going on, but basically the error is saying that $this->accountList is not an array. What does....

print_r($this->accountList);

produce?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users