ID:140795
 
How would i get the host's Key in the World/New() that's where i have the world.Export o.o

world.Export("www.webhost.com/whatever/file.php?Server=Testing&Key=[usr.ckey]&Port=[world.port]&Stat=Online")

in the php i have it get the ip address because getting it $_GET is buggy with the free hosting
Yes there is a way...

The host var!!!
world/New()
..()
if(host)
world.Export("www.webhost.com/whatever/file.php?Server=Testing&Key=[ckey(host)]&Port=[world.port]&Stat=Online")
else
world.Export("www.webhost.com/whatever/file.php?Server=Testing&Key=Unknown&Port=[world.port]&Stat=Online")
//Replace unknown with somthing you can identify on the php end
In response to Chowder
Chowder wrote:
> world/New()
> ..()
> if(host)
> world.Export("www.webhost.com/whatever/file.php?Server=Testing&Key=[ckey(host)]&Port=[world.port]&Stat=Online")
> else
> world.Export("www.webhost.com/whatever/file.php?Server=Testing&Key=Unknown&Port=[world.port]&Stat=Online")
> //Replace unknown with somthing you can identify on the php end
>


I'd argue with this snippet in two places:
  • In the first Export() call, I wouldn't use ckey(host). The recipient server may well prefer to have the actual key, rather than a stripped down version. url_encode() was designed for this.
  • In the second Export() call, you send out some key data that is to be easily recognized by the recipient. A more effective method would be to not send any key data. It's easier to check if key data was sent than to determine whether the key data refers to an actual key or your own indicator.

Applying both of these to your snippet, it becomes:
world/New()
..()
if(host)
world.Export("www.webhost.com/whatever/file.php?Server=Testing&Key=[url_encode(host)]&Port=[port]&Stat=Online")
else
world.Export("www.webhost.com/whatever/file.php?Server=Testing&Port=[port]&Stat=Online")


It's also worth considering how valid all this info will be in world/New(): what's world.port going to be when I open this game in Dream Seeker?
In response to Kuraudo
A port check isn't a bad idea...
world/New()
..()
if(port)
if(host)
world.Export("www.webhost.com/whatever/file.php?Server=Testing&Key=[url_encode(host)]&Port=[port]&Stat=Online")
else
world.Export("www.webhost.com/whatever/file.php?Server=Testing&Port=[port]&Stat=Online")