Jump to content

Must be a string? Huh, what? HELP?


EsOne

Recommended Posts

with the following script, I get

Fatal error: Property name must be a string in /home/content/e/s/o/esone/html/test/123.php on line 24

 

Anyone maybe know what is causing it?

 

<?php
function seconds2HMS($inputval){
$hh = intval($inputval / 3600);
$ss_remaining = ($inputval - ($hh * 3600));
$mm = intval($ss_remaining / 60);
$ss = ($ss_remaining - ($mm * 60));	
if($hh<10){
	$hh='0'.$hh;
}
if($mm<10){
	$mm='0'.$mm;
}
if($ss<10){
	$ss='0'.$ss;
}
return $hh.':'.$mm.':'.$ss;
}
function checkTank($tankId){
$aquVs=118;//the current game version number
$hay=json_decode(file_get_contents("http://www.gaiaonline.com/chat/gsi/index.php?v=json&m=[[6500%2C[1]]%2C[6510%2C[\"".$tankId."\"%2C0%2C1]]%2C[6511%2C[\"".$tankId."\"%2C0]]%2C[6512%2C[\"".$tankId."\"%2C0]]%2C[107%2C[\"null\"]]]&X=".time()));
$gaiaT=$hay[0][2]->{'gaia_curr_time'};
$aquaN=$hay[1][2]->{$tankId}->{'name'};
$userN=$hay[1][2]->{$tankId}->{'user_id'};
$glowT=$hay[1][2]->{$tankId}->{'game_info'}->{1}->{"open_time"};
$play=$hay[1][2]->{$tankId}->{'game_info'}->{1}->{"player_count"};
if($glowT){
	if($glowT<=$gaiaT){
		if($glowT+720>$gaiaT){
			if($play<34){
				return 'Glowing for '.seconds2HMS($gaiaT-$glowT).' <a target="_blank" href="http://www.gaiaonline.com/tank/'.$userN.'/?userEnvironmentId='.$tankId.'&gsiUrl=www&isInEdit=false&firstTime=&location=popUp&quality=low&version='.$aquVs.'&graphicsServer=http://s.cdn.gaiaonline.com/images/Gaia_Flash/aquarium/&isGameActive=true">[Open Aquarium Link]</a>';
			}
			else{
				return 'Full';
			}
		}
		else{
			return 'Glowed '.seconds2HMS($gaiaT-$glowT).' ago.';
		}
	}
	else{
		return 'Glowing in '.seconds2HMS($glowT-$gaiaT).' <a target="_blank" href="http://www.gaiaonline.com/tank/'.$userN.'/?userEnvironmentId='.$tankId.'&gsiUrl=www&isInEdit=false&firstTime=&location=popUp&quality=low&version='.$aquVs.'&graphicsServer=http://s.cdn.gaiaonline.com/images/Gaia_Flash/aquarium/&isGameActive=true">[Open Aquarium Link]</a>';
	}
}
else{
	return 'Not Glowing';
}
}
?>

Link to comment
Share on other sites

It would help if you pointed out which line line 24 is.

 

But my guess would be

$glowT=$hay[1][2]->{$tankId}->{'game_info'}->{1}->{"open_time"};

 

you are using the number 1 as some classes attribute name. As the error pointed out, property names must be strings. I don't know how that class is structured tho, so I can't be much more help than that

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.