You are here
Greetings,
Disclaimer.. I am new to servers, php and mySQL but am having fun esp with the LAMP appliance.
My dilema.
I play a browser based game that allows javascript to be run in-game to automate mundane tasks.
There is a limit to the size of the scripts that can be stored in the game so to get around this large scripts are added from outside the game like this which grabs the script and puts it ingame:
javascript:
function c(){
var name=window.game_data.player.name;
var a=(window.frames.length>0)?window.main.document:document;
var b=a.createElement('script');
b.type='text/javascript';
b.src='http://somehost/example.php?name='+name;';
a.getElementsByTagName('head')[0].appendChild(b)
}
c();
I have/had an account on a webhost that I was using to hold my javascripts and I set up an entry script on it like this to see if the javascript was being called from the game and then to check if the caller is on the members list:
<?php
/* script entry of example.php */
$na = $_GET['name'];
$ref=@$HTTP_REFERER;
$arr = parse_url($ref);
$hoster = $arr['host'];
if ($hoster=='en30.tribalwars.net')
{
//include php array of members
include("inc/the_tribe_members.php");
for ($I=0; $I<=$members; $I++)
{
if ($na==$cars[$I])
{
include("inc/sc_example.php");
break;
}
}
}
else
{
header("Location: http://someothersite");
}
?>
All was fine. The script (sc_example.php) was sent to the game and ran fine.
With my new Lamp (Bare metal is it called? It's a dedicated computer) I can not get this to work at all.
It appears that everything in my example.php is skipped, down to the else section and I get errors about the site the Location points to no matter which site. The code does not appear to be running at all.
I have looked into (for days now) SSI, php headers, apache document options, apache CGI programs, the webmin wiki/docs...
My code or way of doing things may not be the best way but I'm still learning and it did work on a different server so I am assuming I am missing a setting on my server?
Any thoughts, pointers, tips or even a link or two for further reading would be much appreciated.
Thanks,
Bel
Add new comment