B Tutorial Other Webserver as database for warband

Users who are viewing this thread

Hello,
Big up now  :twisted:

I've an issue with the send_message_to_url function : nothing happened.

Code:
(try_begin),				
					(send_message_to_url, "@http://alphas-projects.com/content/ng_stats.php?unique_id={reg2}&local_id={reg0}&username={s2}&event=0"),

I need some help with that, does the function still exist ?
 
Yes, the operation still exists.

Idk what the problem could be. Start debugging step by step to see what fails where:
1. make sure that send_message_to_url gets executed. Put (display_message, "@Sent stuffs to webserver") after send_message...; if the message appears in game or in server's console, then this is not what failed; if no message appears, then you are not calling scripts or stuffs
2. make sure that the webserver receives the request; look into webserver's logs for recent access; if you don't have access to the logs, then modify ng_stats.php to create a file when it is accessed. If the file gets created after you see the debug message, then this is not what failed. If no file is created, then here is your problem. Make sure that your server's ip has access to ng_stats.php. If it still fails, then idk. Try debugging using a normal web browser.
3. make sure that the php file should do what you want it to do. Test it using a web browser. If the php returns values, manually check them if they are good (they should appear in the web browser)
 
The_dragon said:
Yes, the operation still exists.

Idk what the problem could be. Start debugging step by step to see what fails where:
1. make sure that send_message_to_url gets executed. Put (display_message, "@Sent stuffs to webserver") after send_message...; if the message appears in game or in server's console, then this is not what failed; if no message appears, then you are not calling scripts or stuffs
2. make sure that the webserver receives the request; look into webserver's logs for recent access; if you don't have access to the logs, then modify ng_stats.php to create a file when it is accessed. If the file gets created after you see the debug message, then this is not what failed. If no file is created, then here is your problem. Make sure that your server's ip has access to ng_stats.php. If it still fails, then idk. Try debugging using a normal web browser.
3. make sure that the php file should do what you want it to do. Test it using a web browser. If the php returns values, manually check them if they are good (they should appear in the web browser)

Thanks for your answer.
I've created a simply value in a databse which is incrementing for each time the page is loaded. So if the script send a request to this page I will be able to see the number was increased.
I'm going to debug. I keep u informed.

Regards,
Alpha
 
PitchPL said:
Hey I have issue with this script

When I do same code , working database I got this in server logs after player joined.

https://pastebin.com/M62DqDqi


Some logs from httpd acces logs


https://pastebin.com/wcF9ZpkM

Make sure to encode the request before sending it (there is a MSYS operation for that, can't remember which one) so it replaces characters such as "_" with properly formatted sequences.
As a fast-fix, you can try changing the "unique_id" GET param with "uniqueid".
 
Ra'Jiska said:
PitchPL said:
Hey I have issue with this script

When I do same code , working database I got this in server logs after player joined.

https://pastebin.com/M62DqDqi


Some logs from httpd acces logs


https://pastebin.com/wcF9ZpkM

Make sure to encode the request before sending it (there is a MSYS operation for that, can't remember which one) so it replaces characters such as "_" with properly formatted sequences.
As a fast-fix, you can try changing the "unique_id" GET param with "uniqueid".


unfortunately fast fix doesn't work . Can you teach me how I can use encode operation in my case? I never use this.



I found only this in modsys

str_encode_url                  = 2355 # (str_encode_url, <string_register>),

send_message_to_url                  = 380 # (send_message_to_url, <string_id>, <encode_url>), #result will be returned to script_game_receive_url_response
 
PitchPL said:
unfortunately fast fix doesn't work . Can you teach me how I can use encode operation in my case? I never use this.



I found only this in modsys

str_encode_url                  = 2355 # (str_encode_url, <string_register>),

send_message_to_url                  = 380 # (send_message_to_url, <string_id>, <encode_url>), #result will be returned to script_game_receive_url_response

The `str_encode_url` is the one. But if the quick fix doesn't work, there is little chance the encode fix does the trick.
You may want to catch the full HTTP request for debugging.
 
Ra'Jiska said:
PitchPL said:
unfortunately fast fix doesn't work . Can you teach me how I can use encode operation in my case? I never use this.



I found only this in modsys

str_encode_url                  = 2355 # (str_encode_url, <string_register>),

send_message_to_url                  = 380 # (send_message_to_url, <string_id>, <encode_url>), #result will be returned to script_game_receive_url_response

The `str_encode_url` is the one. But if the quick fix doesn't work, there is little chance the encode fix does the trick.
You may want to catch the full HTTP request for debugging.



https://pastebin.com/GRQDXsBy
 
Ra'Jiska said:
PitchPL said:

There are still spaces in your HTTP message.
I've been trying a sample HTTP request with space between params and I ended up, just like you, with a 400 status code.



Now code is clean but when I join to server I dont see anything new in my MySQL

https://pastebin.com/vXshKBmJ



I have same logs even if I turn of MySQL





Current progres : mySQL base work good , gold are shown on phpmyadmin . Probably last bug - I have 250 gold on database but after reconnect I gave 1 gold in game/on database ;c
 
PitchPL said:
Now code is clean but when I join to server I dont see anything new in my MySQL

https://pastebin.com/vXshKBmJ

I have same logs even if I turn of MySQL





Current progres : mySQL base work good , gold are shown on phpmyadmin . Probably last bug - I have 250 gold on database but after reconnect I gave 1 gold in game/on database ;c

For these questions it's all up to you and how you've coded your system.
 
Also, does this work for online rented servers or just dedicated servers? Everything seems to work fine, but Gold isn't showing up when I rejoin. Any possible fixes?
 
Thank you ! this is very god job :grin:

but how to open php files ? i have not using usbwebserver but i have web server and i dont know how to open php files example.php on my phpmyserver in mywebserver
and Thanks !
 
If you are going to mod anything, edit php and other files that are warband-related, notepad++ saves the day!

The tutorial should still work and is very handy for beginners.
However, if you are planning to put yourself out there with your own server and go public with that webserver
be advised that the given tutorial is prone to various attacks and exploits that could be executed with little to no hacking knowledge nowadays.
Still a great functional tutorial!

usbwebserver isn't mandatory. I used xampp, which comes with phpmyadmin mysql and apache preconfigured.
Generally speaking you need:
- some kind of webserver (hosting programm) apache2 is widely used, nginx would be an alternative
- some kind of database to store data in (e.g. mysql database)
- php installed on your apache2 webserver
-phpmyadmin is just a grafical interface to make your life easier
 
Back
Top Bottom