Zell Posted May 21, 2015 Group: Members Topic Count: 53 Topics Per Day: 0.01 Content Count: 412 Reputation: 266 Joined: 04/25/12 Last Seen: Wednesday at 10:37 PM Share Posted May 21, 2015 Hello, Is there a "easy" and safe way to make a application write in C# insert a value in DB? What I thought is to send the request to a PHP and the PHP on server make the insertion. But whow? Or its better send a socket/packet to emulator to make this? Quote Link to comment Share on other sites More sharing options...
Tokei Posted May 21, 2015 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 694 Reputation: 716 Joined: 11/12/12 Last Seen: 9 hours ago Share Posted May 21, 2015 I think is this, thanks Toekei, I will check for this when arrive home. But I have some doubts. Its safe to put this kind of connect directy by the application? And the server will give privileges to run the application execute the insert ? Because what I want is to change a value in DB that the emulator uses . Example: Player login on launcher (see the gif up), The application insert in my "ragnarok" db, launcher = 1 where login and password = used on launcher. I do not know if I was clear , and excuse me my English and grammar , I'm a little rusty . Thank you again. Ah, no, I thought this was for 'personal' use. You can't use this method in a launcher because the security risk is way too high. You have two options... Create a new packet to communicate with the server What you would have to do is create a connection with the server itself, probably read the clientinfo.xml, and then send the information you want to the server. In packets.h you would add a new packet that you can treat yourself. This is similar to what a WPE tool would do I guess. Keep using SQL You could stick with SQL... Create a new user with very limited access (only grant them the insert command). That way you could use the code above but by using that restricted account, they wouldn't be able to do anything even if they found out your connection username/password. The only abuse I can think of is that someone might end up spamming the DB with insert commands, but... this can happen with any other solution you come up with anyway. Quote Link to comment Share on other sites More sharing options...
Tokei Posted May 21, 2015 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 694 Reputation: 716 Joined: 11/12/12 Last Seen: 9 hours ago Share Posted May 21, 2015 (edited) Why not use C# to do this directly? First of, download and install the MySQL C# library : https://dev.mysql.com/downloads/connector/net/6.9.html and then add the MySql.Data reference to your project. I made a basic sample you can start with (attached files to this post), it's... really straightforward : _sql.Connect("127.0.0.1", "ragnarok", "username", "password", "3306"); _sql.Execute("SELECT `userid` FROM `login`"); For more information, you can go ahead and read this codeproject article : http://www.codeproject.com/Articles/43438/Connect-C-to-MySQL If this isn't what you're looking for, please clarify xD DemoSql.rar Edited May 21, 2015 by Tokei Quote Link to comment Share on other sites More sharing options...
Zell Posted May 21, 2015 Group: Members Topic Count: 53 Topics Per Day: 0.01 Content Count: 412 Reputation: 266 Joined: 04/25/12 Last Seen: Wednesday at 10:37 PM Author Share Posted May 21, 2015 (edited) What is it that you're trying to achieve? Cause I'm programming a Launcher/Auto Patcher/Shield, and I want to insert a value on DB to players only can login if by the launcher. When player logged I will check on sql if Launcher is = 1, and when log off, Launcher became = 0. http://i.imgur.com/k7WT06f.gifv Why not use C# to do this directly? First of, download and install the MySQL C# library : https://dev.mysql.com/downloads/connector/net/6.9.html and then add the MySql.Data reference to your project. I made a basic sample you can start with (attached files to this post), it's... really straightforward : _sql.Connect("127.0.0.1", "ragnarok", "username", "password", "3306"); _sql.Execute("SELECT `userid` FROM `login`"); For more information, you can go ahead and read this codeproject article : http://www.codeproject.com/Articles/43438/Connect-C-to-MySQL If this isn't what you're looking for, please clarify xD I think is this, thanks Toekei, I will check for this when arrive home. But I have some doubts. Its safe to put this kind of connect directy by the application? And the server will give privileges to run the application execute the insert ? Because what I want is to change a value in DB that the emulator uses . Example: Player login on launcher (see the gif up), The application insert in my "ragnarok" db, launcher = 1 where login and password = used on launcher. I do not know if I was clear , and excuse me my English and grammar , I'm a little rusty . Thank you again. Edited May 21, 2015 by Zell Quote Link to comment Share on other sites More sharing options...
Zell Posted May 21, 2015 Group: Members Topic Count: 53 Topics Per Day: 0.01 Content Count: 412 Reputation: 266 Joined: 04/25/12 Last Seen: Wednesday at 10:37 PM Author Share Posted May 21, 2015 I think is this, thanks Toekei, I will check for this when arrive home. But I have some doubts. Its safe to put this kind of connect directy by the application? And the server will give privileges to run the application execute the insert ? Because what I want is to change a value in DB that the emulator uses . Example: Player login on launcher (see the gif up), The application insert in my "ragnarok" db, launcher = 1 where login and password = used on launcher. I do not know if I was clear , and excuse me my English and grammar , I'm a little rusty . Thank you again. Ah, no, I thought this was for 'personal' use. You can't use this method in a launcher because the security risk is way too high. You have two options... Create a new packet to communicate with the server What you would have to do is create a connection with the server itself, probably read the clientinfo.xml, and then send the information you want to the server. In packets.h you would add a new packet that you can treat yourself. This is similar to what a WPE tool would do I guess. Keep using SQL You could stick with SQL... Create a new user with very limited access (only grant them the insert command). That way you could use the code above but by using that restricted account, they wouldn't be able to do anything even if they found out your connection username/password. The only abuse I can think of is that someone might end up spamming the DB with insert commands, but... this can happen with any other solution you come up with anyway. Hmm, the problem is that a person with high knowledge could insert cash points, or other values in DB, right? Or there is a way to give permission to note the all tables? Maybe I have to pick the first solution, more "safe", I think I will take a look at Openkore bots and see the connections maked by it. Quote Link to comment Share on other sites More sharing options...
Question
Zell
Hello, Is there a "easy" and safe way to make a application write in C# insert a value in DB?
What I thought is to send the request to a PHP and the PHP on server make the insertion. But whow?
Or its better send a socket/packet to emulator to make this?
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.