|
You last visited: Today at 04:11
Advertisement
[Discuss] MySql for 5165 !
Discussion on [Discuss] MySql for 5165 ! within the CO2 Private Server forum part of the Conquer Online 2 category.
03/30/2010, 09:52
|
#1
|
elite*gold: 0
Join Date: Feb 2010
Posts: 492
Received Thanks: 222
|
[Discuss] MySql for 5165 !
Ok so on the [REL]ItemLock Saving/Loading we are going abit off-topic so I made this topic
So far....
1. Your gonna need a $con connection and the correct MySql connection codes so ....
So far we have the code(s)
add in the Database.cs
Code:
public class Database
{
public const string USER_NAME = "root";
public static string PASSWORD = "";
public const string SERVER = "";
public const string DATA_BASE = "";
static MySqlConnection conn = new MySqlConnection("Server=" + SERVER + ";Database='" + DATA_BASE + "';Username='"[COLOR=Red] + USER_NAME +[/COLOR] "';Password='" [COLOR=Red]+ PASSWORD +[/COLOR] "'");
static bool did = false;
public static MySqlConnection Connection
{
get
{
if (!did)
{ conn.Open(); did = true; conn.StateChange += new System.Data.StateChangeEventHandler(conn_StateChange); }
return conn;
}
}
static void conn_StateChange(object sender, System.Data.StateChangeEventArgs e)
{
if (e.CurrentState == System.Data.ConnectionState.Closed || e.CurrentState == System.Data.ConnectionState.Broken)
{
conn.Dispose();
conn = new MySqlConnection("Server=" + SERVER + ";Database='" + DATA_BASE + "';Username='" + [COLOR=Red][COLOR=Black]USER_NAME[/COLOR][/COLOR] + "';[COLOR=Black]Password[/COLOR]='" + PASSWORD + "'");
conn.Open();
conn.StateChange += new System.Data.StateChangeEventHandler(conn_StateChange);
}
HOWEVER the codes in red ARE very vulnerable!...careful with sql-injection guys... Thank you to who ever posted that
I will update this every 5 hours or so
}
|
|
|
03/30/2010, 10:10
|
#2
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
The username and password arnt vulnerable, since no one has access to it, injection occurs when you can pass a string to the database, so things like character names and server names are vulnerable, but only if you dont add protection against it.
|
|
|
03/30/2010, 10:19
|
#3
|
elite*gold: 0
Join Date: Feb 2010
Posts: 492
Received Thanks: 222
|
=o /facepalm myself o.O ok well surely there are codes out their to protect character name(s) ? but surely are people(s) character names really matter ?
EDIT: Well I just upgraded to Windows 7 Ultimate ( acitvated ) and just reinstalling C# and navicat/MySql along with the rikardo Updated so I can begin to work on the Mysql thing in about 30min
For the loading accounts in MySql can you still do that without changing the Character load or would I have to Change how everything loads ?
|
|
|
03/30/2010, 10:55
|
#4
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
Everything that previously loaded from a .ini file would need to be converted to load from SQL, you would also need to construct the entire database, tables, structures, from scratch, or write a fancy app to do it for you.
|
|
|
03/30/2010, 11:02
|
#5
|
elite*gold: 0
Join Date: Feb 2010
Posts: 492
Received Thanks: 222
|
Well I am not using .ini I am using the Flat-File trying to make it MySql so erm for now can I not just make the account load from MySql ?
EDIT: Can I make everything load from MySql just not the NPC(s) ? also has anybody got a 5165.sql for me to use ? or can I use the CoEmu one ?
|
|
|
03/30/2010, 11:05
|
#6
|
elite*gold: 0
Join Date: Mar 2008
Posts: 309
Received Thanks: 208
|
Yes.
|
|
|
03/30/2010, 11:06
|
#7
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
.ini is a type of flat-file database, i forgot that 5165 uses a binary flat-file system. But either way both are flat-file and both need to be fully converted to SQL.
|
|
|
03/30/2010, 11:13
|
#8
|
elite*gold: 0
Join Date: Feb 2010
Posts: 492
Received Thanks: 222
|
I think I could use the CoEmu V2.sql as a base for it but is there NO way I can make Npc(s) stay in a .cs ?
|
|
|
03/30/2010, 11:31
|
#9
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
Of course you can do that o.O
|
|
|
03/30/2010, 12:34
|
#10
|
elite*gold: 0
Join Date: Feb 2006
Posts: 550
Received Thanks: 82
|
Quote:
Originally Posted by Paralyzer[GM]
=o /facepalm myself o.O ok well surely there are codes out their to protect character name(s) ?
|
you could do checks your self, or use prepared statements.
|
|
|
03/30/2010, 13:02
|
#11
|
elite*gold: 0
Join Date: Feb 2010
Posts: 492
Received Thanks: 222
|
ah kool so all I have to do is leave the way NPC(s) load as they are even if accounts and everything else loads using MySql
|
|
|
03/30/2010, 13:36
|
#12
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
Indeed
|
|
|
04/01/2010, 01:39
|
#13
|
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
|
ye i had my lotf 5017 using mysql for half and flat for the other.
|
|
|
04/01/2010, 08:58
|
#14
|
elite*gold: 0
Join Date: Nov 2009
Posts: 129
Received Thanks: 45
|
Using features like MySqlCommandBuilder in C#, help prevent against injection, considering those functions escape any dangerous characters
|
|
|
04/01/2010, 17:13
|
#15
|
elite*gold: 0
Join Date: Apr 2009
Posts: 782
Received Thanks: 458
|
lol... easy thing to doo.... i have my 5165 source entire MySql system... i'll try to help out converting it : P
|
|
|
Similar Threads
|
[Release]MySql Databse 5165
04/22/2010 - CO2 PServer Guides & Releases - 7 Replies
New Source NewestCoSource Using MySql Database You Can Use it Free !
Sql Tabels :
accounts
characters
config
items
skills
cq_flowers
|
Files 5165 But in MySql with DB
04/06/2010 - Conquer Online 2 - 0 Replies
hi i need files 5165 but in mysql with DB, if any person have a link to download please post the link.
|
An Idea For Making 5165 With MySql
03/07/2010 - CO2 Private Server - 9 Replies
I Have An Idea.
That Making A 5165 Soure With MySql By Getting A 5095 MySql Source.
And Then Adding Hourse And Clan And Any Thing In The 5165 To Be Added To The 5095.
It Is Not A Bad Idea.
Plz Try And Thx.
|
5165 And Mysql
02/10/2010 - CO2 Private Server - 0 Replies
#request close
|
[Question] Mysql 5165
01/03/2010 - CO2 Private Server - 6 Replies
Is possivel put mysql in source 5165? is it is how i can do that?
|
All times are GMT +1. The time now is 04:12.
|
|