Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 609 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
[ANET] HTTP Send Score #295357
10/24/09 17:32
10/24/09 17:32
Joined: Jun 2008
Posts: 428
Rasch Offline OP
Senior Member
Rasch  Offline OP
Senior Member

Joined: Jun 2008
Posts: 428
Hi iīve tried to send scores to my mysql server. Everything works and it also says that itīs sended. But nothing get written in the database what did i wrong?

I took the template code. The sql server runs on my own machine and i can see the php pages. but they just give me back -1

I created the database like in the manual and also created the needed rows and so on. And how i said it says that itīs "Gesendet" but nothing changes in the database.

Code:
function send()
{
	
	player_points ī+= random(49)+5;

	STRING* http_url = "#100";
	STRING* http_data = "#250";
	STRING* http_result = "#10";
	var httpID;

	//URL:
	str_cpy(http_url,"http://localhost/php_scripts/game_to_onlinelist.php");
	//Data:
	inkey_playername.flags = VISIBLE;
	inkey(http_playername);
	inkey_playername.flags &= ~VISIBLE;

	str_cpy(http_data,"svn=");
	str_cat(http_data,http_playername);
	str_cat(http_data,"&pw=");
	str_cat(http_data,player_points);

	httpID = http_post(http_url,http_data);
	while(http_get_status(httpID) == 0) {wait(1);}
	if(http_get_status(httpID) == 1)
	{
		http_get_result(httpID,http_result);
		error("Gesendet!");
	}
	else 
	{
		error("Nicht gesendet!");
	}

	http_free(httpID);
}



Re: [ANET] HTTP Send Score [Re: Rasch] #295365
10/24/09 19:27
10/24/09 19:27

F
Fear411
Unregistered
Fear411
Unregistered
F



maybe there is an error in your php file.

Re: [ANET] HTTP Send Score [Re: ] #295366
10/24/09 19:46
10/24/09 19:46
Joined: Jun 2008
Posts: 428
Rasch Offline OP
Senior Member
Rasch  Offline OP
Senior Member

Joined: Jun 2008
Posts: 428
This php file is from the creator of anet. I cant believe it depends on the .php file. Do you know php?

What would be the best way to write the playername and the score in a mysql database? Do you have some example code?

Re: [ANET] HTTP Send Score [Re: Rasch] #295378
10/24/09 21:04
10/24/09 21:04

F
Fear411
Unregistered
Fear411
Unregistered
F



I will post an example tomorrow, cause i am not at the pc now. Whats inside the php file, if you are allowed to post it?

Re: [ANET] HTTP Send Score [Re: ] #295383
10/24/09 21:41
10/24/09 21:41
Joined: Jun 2008
Posts: 428
Rasch Offline OP
Senior Member
Rasch  Offline OP
Senior Member

Joined: Jun 2008
Posts: 428
Omg i found out what the problem was.

In the php script there was:

$change = "UPDATE gamelist Set servername = '$servername', password = '$pw',
gametyp = '$gametyp', map = '$map', serverip = '$serverip',
lastupdate= '$timestamp', players='$players', ping='$ping',
id = '$id' WHERE row = '$entry_row'";
mysql_query($change);

and i changed to

mysql_query("INSERT INTO gamelist (row, servername, password, id) VALUES ('$entry_row', '$servername', '$pw', '$id')");

the update function didnt work it had to be inputed

Re: [ANET] HTTP Send Score [Re: Rasch] #295435
10/25/09 10:01
10/25/09 10:01
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline
Serious User
Dark_samurai  Offline
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
Why do you use the internet-serverlist php code for an online highscore?

Btw. if you want to create an internet-serverlist, use the template and read through the howto. Then there should be no problem.


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version
Re: [ANET] HTTP Send Score [Re: Dark_samurai] #295523
10/25/09 20:21
10/25/09 20:21
Joined: Jun 2008
Posts: 428
Rasch Offline OP
Senior Member
Rasch  Offline OP
Senior Member

Joined: Jun 2008
Posts: 428
What else shall i use? I need to save the score anywhere.

I tried the template but why ever it says that i cant use this template with my anet version. Itīs the same termplate file whcih was sended with the professional edition.

Re: [ANET] HTTP Send Score [Re: Rasch] #295581
10/26/09 09:55
10/26/09 09:55
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline
Serious User
Dark_samurai  Offline
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
You should write such a snippet yourselfe. Creating a online highscore in php is really easy. If you need help, you can ask on a php forum or here.

The template tells you that you are not allowed to use it? That's strange, can you post a screenshot?


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version
Re: [ANET] HTTP Send Score [Re: Dark_samurai] #295759
10/27/09 13:03
10/27/09 13:03
Joined: Aug 2005
Posts: 1,230
M
MichaelGale Offline
Serious User
MichaelGale  Offline
Serious User
M

Joined: Aug 2005
Posts: 1,230
And while you are at it, read a good article about SQL injection attacks.


Your friendly mod is at your service.
Re: [ANET] HTTP Send Score [Re: MichaelGale] #295972
10/28/09 20:00
10/28/09 20:00
Joined: Jun 2008
Posts: 428
Rasch Offline OP
Senior Member
Rasch  Offline OP
Senior Member

Joined: Jun 2008
Posts: 428
i got it but have no defend against sql injections at the moment but i will see what i can do laugh

Thanks

Page 1 of 2 1 2

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1