Jump to content

php question


Tabris Daxter
 Share

You are about to reply to a thread that has been inactive for 4464 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

hey all,

this is not really a LSL question but it relates to a SL project i'm working on.

i'm using a free hosting company at the moment an even though it's no ads. inserted into the bottom of EVERY page is this code

<!-- www.000webhost.com Analytics Code -->
<script type="text/javascript" src="http://analytics.hosting24.com/count.php"></script>
<noscript><a href="http://www.hosting24.com/"><**Only uploaded images may be used in postings**://analytics.hosting24.com/count.php" alt="web hosting" /></a></noscript>
<!-- End Of Analytics Code -->

 and it doesn't show on a webpage but it does show in SL.

i'm using the example scripts from the wiki

key http_request_id;
 
default
{
    state_entry()
    {
        http_request_id = llHTTPRequest("url", [], "");
    }
 
    http_response(key request_id, integer status, list metadata, string body)
    {
        if (request_id == http_request_id)
        {
            llSetText(body, <0,0,1>, 1);
        }
    }
}

 and a bit of modded wiki code

<?PHP
	// Author Waster Skronski.
	// General Public License (GPL).
	// Mind that some headers are not included because they're either useless or unreliable.
	$USE_APACHE_HEADERS = TRUE; // switch to false if you need cgi methods
	if ($USE_APACHE_HEADERS)
	{
		$headers 	= apache_request_headers();
		$objectgrid 	= $headers["X-SecondLife-Shard"];
		$objectname 	= $headers["X-SecondLife-Object-Name"];
		$objectkey     	= $headers["X-SecondLife-Object-Key"];
		$objectpos 	= $headers["X-SecondLife-Local-Position"];
		$ownerkey     	= $headers["X-SecondLife-Owner-Key"];
		$ownername 	= $headers["X-SecondLife-Owner-Name"];
		$regiondata     = $headers["X-SecondLife-Region"];
		$regiontmp 	= explode ("(",$regiondata); // cut cords off 
		$regionpos 	= explode (")",$regiontmp[1]); //
		$regionname 	= substr($regiontmp[0],0,-1); // cut last space from simname
	} else {
		$db = $GLOBALS;
		$headers 		= $db['HTTP_ENV_VARS'];
		$objectgrid 	= $headers["HTTP_X_SECONDLIFE_SHARD"]; 
		$objectname 	= $headers["HTTP_X_SECONDLIFE_OBJECT_NAME"];
		$objectkey     	= $headers["HTTP_X_SECONDLIFE_OBJECT_KEY"];
		$ownerkey     	= $headers["HTTP_X_SECONDLIFE_OWNER_KEY"];
		$objectpos     	= $headers["HTTP_X_SECONDLIFE_LOCAL_POSITION"];
		$ownername 	= $headers["HTTP_X_SECONDLIFE_OWNER_NAME"];
		$regiondata     = $headers["HTTP_X_SECONDLIFE_REGION"];
		$regiontmp 	= explode ("(",$regiondata); 
		$regionpos 	= explode (")",$regiontmp[1]);
		$regionname 	= substr($regiontmp[0],0,-1);
	}
print "\n$regiondata\n$ownername\n$ownerkey\n$ownername";
?>

 Short of finding a new hosting service is there anyway in either LSL or PHP to not print the analytics code?

Link to comment
Share on other sites

This method would be ok for this case - in other cases, the added code could make the result to long to get sent to SL completely. This is also the reason why I wouldn't look for the complete sub string, but would insert some marker to the end of the information you want - e.g.:

print "\n$regiondata\n$ownername\n$ownerkey\n$ownername<END OF INFORMATION>";

 And then in SL get the part in front of the marker:

llGetSubString(body, 0, llSubStringIndex(body, "<END OF INFORMATION>"));

 

 

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4464 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...