[ANet] Internet Serverlist Beta

Posted By: Dark_samurai

[ANet] Internet Serverlist Beta - 01/02/11 21:21

Hi!

A lot of people asked for a internet serverlist solution the last days. So I started to rework the old internet serverlist template of ANet. The result is a much cleaner and easier to use template. Just download the .zip and open the .htm file in the documentation folder. The HowTo describes exaclty how it can be used and how you can setup a server. The whole template is open source!

The template also comes with a small example project (compiled):


Here is the link: Internet Serverlist Template (~3 MB)

Please notice that this is a public beta! So there might be some bugs or documentation mistakes.
You don't need to buy ANet to use this template. You can also use it with the free ANet Demo. For those who own ANet: The http feature is required so it does work with ANet Web and ANet Professional but not with the ANet Standard.

Please tell me if it is working for you and what you think laugh
Posted By: SchokoKeks

Re: [ANet] Internet Serverlist Beta - 03/25/11 13:22

Just took a look at the script, its very well commented and will hopefully save me a lot of time! It might be helpful for non-anet user too.

However, there is one important security issue:

Why are you letting the application send the mysql username and password over http-post to the server? That is something the application shouldn't even know! Everyone could either find it in the binary or spy the traffic with a sniffer and find it there.

Why not letting the user write it into a settings.php file that gets included into the other php files like other php/sql applications do it? I'm going to modify this script anyway and will do it this way, but I wanted to share this with you.
Posted By: Dark_samurai

Re: [ANet] Internet Serverlist Beta - 03/25/11 16:17

Yes you are right. I will change that!
Posted By: darkinferno

Re: [ANet] Internet Serverlist Beta - 03/27/11 15:16

have you changed it yet ?
Posted By: SchokoKeks

Re: [ANet] Internet Serverlist Beta - 03/27/11 15:27

Found another little problem:

My websever returns the REMOTE_ADDR as a kind of IPv6:
::fffff:255.255.255.255

So I needed another "explode" to get the last part, which is the usual IP. I also added an isset statement to check whether AddServer.php was called with a proper post statement containing the needed variables. Here is the modified code part:



Code:
//check for valid post
        if (!isset( $_POST['Port'], $_POST['Name'] )) die("ERROR: JUST FAIL");

        //gets the ip address from the host that called this script:
        $Ip_Addr = $_SERVER['REMOTE_ADDR'];
        //if the host is on the same machine as the serverlist server,
        //insert "127.0.0.1" (= localhost)
        if($Ip_Addr == "::1" || $Ip_Addr == "localhost") $Ip_Addr = "127.0.0.1";
        //converts the ip address into a 4 byte integer:
        $Ip_TempF = explode(":", $Ip_Addr);
        $Ip_Temp = explode(".", $Ip_TempF[3]);
        $Ip = ($Ip_Temp[0]<<24) + ($Ip_Temp[1]<<16) + ($Ip_Temp[2]<<8)
                        + ($Ip_Temp[3]);



@darkinferno: I have changed it to work that way, it only takes a few minutes. I can post the files if you want to, but there is another bug still remaining that makes the dll crash on some occasions.
Posted By: Dark_samurai

Re: [ANet] Internet Serverlist Beta V2.1 - 03/27/11 20:12

Here the new version: Beta V2.1

Changes:
+ removed the username and password from the lite-c script. You have to set it now directly in the php file.
+ added an isset() check of Port and Name like SchokoKeks did (Thanks!)

Bug fixes:
+ Bad HttpId error fixed
+ Memory problem with string fixed

Thanks for the report SchokoKeks! The problem was in ITemp_Get() where in two cases I closed the function without removing the httpResult string and freeing the HttpId. I hope that this caused the strange problems you had with str_remove().

Please test it and tell me if it's working for you now.
Posted By: SchokoKeks

Re: [ANet] Internet Serverlist Beta V2.1 - 03/27/11 21:26

The HttpId error is indeed fixed, but I'm still getting the "Invalid memory area STR" error on removal of a string used with http_post with warn_level = 6. I seem to get in on every http_post. If I'm using a global string, I will get this error on closing the engine. I guess there is something wrong within Anet..
Posted By: Dark_samurai

Re: [ANet] Internet Serverlist Beta V2.1 - 03/28/11 12:02

Hmmm.... I will take a look at this.
Posted By: Dark_samurai

Re: [ANet] Internet Serverlist Beta V2.1 - 03/28/11 12:20

Ok the problem is related to the http_get_result() function. If the string passed is to small it will cause this error.

Workaround:
Pass a string that is big enough for the data by replacing this part of the template:
Code:
STRING* httpResult = str_create("#10");
			var length = http_get_result(httpId, httpResult);
			if(length > 9)
			{
				str_remove(httpResult);
				httpResult = str_create(str_printf(NULL, "#%d", (long)length + 1));
				http_get_result(httpId, httpResult);
			}



With this one:
Code:
STRING* httpResult = str_create("#100");
			var length = http_get_result(httpId, httpResult);



This is how I will fix the bug:
http_get_result() will create and return a string, so it's not required to pass a string anymore. But the release of the new version will take some time (sorry).
Posted By: SchokoKeks

Re: [ANet] Internet Serverlist Beta V2.1 - 03/28/11 16:54

Sadly, this workaround doesn't really help.

I now get crashes in SYS and invalid memory area STR in other, totally unrelated code parts that work totally fine when no http_post is done.
The old version of Survive was pretty stable and the server would only crash very rarely, but this version currently is a mess.

Since I want to release the serverlist fast I guess I have to switch to GSTNet, sadly I need to urlencode the post myself, but I guess I can find some code for that.
EDIT: F***, in GSTNet the Post function doesn't seem to work at all (well, at least it doesn't crash). It doesn't send the post data at all, it seams.

Btw, is the AckNet.dll also using your code or is it made by conitec? I somehow remembered that it was based on your code, but i might be wrong here.
Posted By: Dark_samurai

Re: [ANet] Internet Serverlist Beta V2.1 - 03/28/11 17:27

It's based on the same code. If the workaround doesn't help and you realy need it that fast I will try my best to fix it. But this version won't include any new features then.
Posted By: SchokoKeks

Re: [ANet] Internet Serverlist Beta V2.1 - 03/28/11 17:38

I'm perfectly fine with the current features and would like to get the new version of survive out tonight or tomorrow, so i would be happy about a new beta.
If you don't have the time its okay too, I'll continue to try to get other plugins to work then (no luck so far, see edit above)
Posted By: SchokoKeks

Re: [ANet] Internet Serverlist Beta V2.1 - 03/30/11 18:14

Sadly, I'm having a lot of problems with the serverlist, it seems to crash with more than 6 servers in the list, in the development I get the error E1513:
Script crash in ITemp_GetList: SYS

The released version just crashes.

I had this with 3 servers once before.. I'm totally clueless on why this happens. I guess I'll have to modify the php script for now to only show 6 servers, but thats only a dirty hack..
Posted By: Dark_samurai

Re: [ANet] Internet Serverlist Beta V2.1 - 03/30/11 19:02

If I have time at the weekend I will look into it!
Posted By: darkinferno

Re: [ANet] Internet Serverlist Beta V2.1 - 05/03/11 14:51

so were all the errors with this fixed ? want to know before i start using it
Posted By: Dark_samurai

Re: [ANet] Internet Serverlist Beta V2.1 - 05/03/11 17:02

For me the latest version I sent to SchokoKeks works just fine. I don't know if he still has problems with it?
© 2024 lite-C Forums