Forum Moderators: coopster
I purchased a script called phpDomain [www.phpdomain.net]. Well the script is pretty buggy, and the company hasn't replied to emails. So I am hoping that my fellow webmasters will be able to lend some insite.
phpDomain is a php client for the Tucows OpenSRS domain registration system.
The part that isn't working (just happens to be the most important function of the app) is the part that allows users to renew/register domains.
Whenever I try to register a domain, I get the following errors:
Warning: Cannot use a scalar value as an array in /home/httpd/vhosts/domain.net/httpdocs/domain/docs/renew.php on line 171
Warning: Invalid argument supplied for foreach() in /home/httpd/vhosts/domain.net/httpdocs/domain/docs/renew.php on line 171
Does anybody have any ideas? I'm somewhat of a php newbie, so I believe this troubleshoot may be beyond my current abilities.
Any assistance is greatly appreciated!
Thanks,
Erik
if ($opensrs->get_extension($domain)!= '.ca')
{
////////////// This is line 171 the problem function
foreach ($results['attributes'] as $ikey=>$ival){
if ($ikey == 'contact_set'){
foreach ($ival as $k=>$v){
if (is_array($v)){
if ($k == 'owner'){
$initial='oc_';
}
else
{
if ($k == 'tech'){
$initial='tc_';
}
if ($k == 'billing'){
$initial='bc_';
}
else
{
continue;
}
}
foreach ($v as $key=>$val){
if ($key == 'postal_code'){$key='postcode';}
else if ($key == 'first_name'){$key='fname';}
else if ($key == 'last_name'){$key='lname';}
else if ($key == 'org_name'){$key='oname';}
$varname="$initial$key";
$$varname=$val;
//end value assignement routine
}
//end contact type loop
}
//end contact_set loop
}
//end if is contact set
}
//end of main foreach
}
}
else
{
//arrange contact info for .ca domains
$oc_fname=$bc_fname;
$oc_lname=$bc_lname;
$oc_oname=$bc_oname;
$oc_email=$bc_email;
$oc_address1=$bc_address1;
$oc_address2=$bc_address2;
$oc_address3=$bc_address3;
$oc_city=$bc_city;
$oc_state=$bc_state;
$oc_country=$bc_country;
$oc_postcode=$bc_postcode;
$oc_phone=$bc_phone;
$oc_fax=$bc_fax;
$tc_fname=$bc_fname;
$tc_lname=$bc_lname;
$tc_oname=$bc_oname;
$tc_email=$bc_email;
$tc_address1=$bc_address1;
$tc_address2=$bc_address2;
$tc_address3=$bc_address3;
$tc_city=$bc_city;
$tc_state=$bc_state;
$tc_country=$bc_country;
$tc_postcode=$bc_postcode;
$tc_phone=$bc_phone;
$tc_fax=$bc_fax;
}
I hope this helps.
Thanks!
$results['attributes']-- in your foreach loop that looks like it may possibly be the index of a database fetch, and if so, it won't be defined as an array, which in turn is giving PHP fits and you your error message. You'll need to further investigate to discover where the variable
$resultsis being created...
I've been trying to figure this thing about, but am starting to tear my hair out!
This is one of several scripts that make this app. All seem to work but this one - of course this script is a cruicial one!
Can anyone figure out what needs to be done to $results to make this thing not throw the error any more?
Instead of posting the whole script, here is a link to a .txt version
Thanks for your assistance!
[edited by: jatar_k at 3:46 am (utc) on Mar. 26, 2004]
[edit reason] no personal urls thanks [/edit]