Mirage Source http://web.miragesource.net/forums/ |
|
[Download] MS4 MySQL [Updated] http://web.miragesource.net/forums/viewtopic.php?f=193&t=5375 |
Page 1 of 1 |
Author: | phelpsy [ Mon Apr 06, 2009 1:23 pm ] |
Post subject: | [Download] MS4 MySQL [Updated] |
well i just basicly made it mysql Npcs are mysql users are mysql charlist is mysql shops are mysql items are mysql and spells are mysql so mysql yea ? ok so someone said would be a good idea to have the data in separate columns so i have done just that and now all but things like inventory and tile data are in separate columns. enjoy. Files: Mysql ODBC: Just download and install http://dev.mysql.com/downloads/connector/odbc/3.51.html Mirage Source 4 Mysql: http://rapidshare.com/files/219917435/MS4MySQL.zip please post any bugs |
Author: | Rian [ Mon Apr 06, 2009 3:18 pm ] |
Post subject: | Re: [Download] MS4 MySQL ;P |
This is great man, nice work. You should make a tutorial |
Author: | Sh4rk [ Mon Apr 06, 2009 4:50 pm ] |
Post subject: | Re: [Download] MS4 MySQL ;P |
Yes ! It's very nice :O You have do a good job |
Author: | Asrrin29 [ Mon Apr 06, 2009 7:11 pm ] |
Post subject: | Re: [Download] MS4 MySQL ;P |
Did you do this by hand or copy the code from 3.0.7? Because if you did it by hand, you have to make sure of a few things that may not seem like a big deal but are. You have to make sure to add SQL cleansing code to prevent injection attacks against the database, and it wouldn't be a bad idea to hash user's passwords with an encrypt/decrypt function. 3.0.7 does all this by default, so if you don't have it consider looking at the code |
Author: | phelpsy [ Mon Apr 06, 2009 7:43 pm ] |
Post subject: | Re: [Download] MS4 MySQL ;P |
Asrrin29 wrote: Did you do this by hand or copy the code from 3.0.7? Because if you did it by hand, you have to make sure of a few things that may not seem like a big deal but are. You have to make sure to add SQL cleansing code to prevent injection attacks against the database, and it wouldn't be a bad idea to hash user's passwords with an encrypt/decrypt function. 3.0.7 does all this by default, so if you don't have it consider looking at the code well i didnt use 3.0.7 you would see that if you downloaded it |
Author: | Asrrin29 [ Mon Apr 06, 2009 9:20 pm ] |
Post subject: | Re: [Download] MS4 MySQL ;P |
I see you've put alot of work into it, but it looks like you've handled things a bit inefficiently. It would be faster to use individual columns for each variable under the different types, instead of putting them in a single blob column and using a split string function. you are really hurting performance using strings like that. Also, like I said, it appears as if you have no code to clean injection attacks from any strings you pass to the DB, so the server is very vulnerable to that. I'd heavily recommend taking a look at the 3.0.7 source and see how Shan originally did it. I use that as a basis for my MySQL server, and it works like a charm. Good attempt at MySQL, it's more then most have done, and please don't take offense, but rather use my constructive criticism and make it better! |
Author: | phelpsy [ Mon Apr 06, 2009 9:29 pm ] |
Post subject: | Re: [Download] MS4 MySQL ;P |
Asrrin29 wrote: I see you've put alot of work into it, but it looks like you've handled things a bit inefficiently. It would be faster to use individual columns for each variable under the different types, instead of putting them in a single blob column and using a split string function. you are really hurting performance using strings like that. Also, like I said, it appears as if you have no code to clean injection attacks from any strings you pass to the DB, so the server is very vulnerable to that. I'd heavily recommend taking a look at the 3.0.7 source and see how Shan originally did it. I use that as a basis for my MySQL server, and it works like a charm. Good attempt at MySQL, it's more then most have done, and please don't take offense, but rather use my constructive criticism and make it better! ok thanks and the reason i used one big blob is because you end up with alot of lag from the mysql server if you do to many queries so like every time you save the map youll get aload of lag xD mine is alot different to 3.0.7 ill look into it Code: Public Function Cleanse(Dirty As String) As String '**************************************************************** '* WHEN WHO WHAT '* ---- --- ---- '* 11/15/2003 Shannara Created Function '**************************************************************** 'THIS FUNCTION WILL ESCAPE ALL SINGLE QUOTE CHARACTERS IN AN EFFORT 'TO PREVENT SQL INJECTION ATTACKS. IT IS RECCOMENDED THAT ALL TAINTED DATA BE 'PASSED THROUGH THIS FUNCTION PRIOR TO BEING USED IN DYNAMIC SQL QUERIES. ' '******************************************* 'NOTE: YOUR BROWSER MAY SHOW SPACES IN THE STRINGS (I.E. " ' " ) THERE SHOULD BE NO WHITESPACES IN ANY OF THE STRINGS '******************************************* ' 'WRITTEN BY: MIKE HILLYER 'LAST MODIFIED: 14JUN2003 Cleanse = Replace(Dirty, "'", "\'") 'CLEVER HACKERS COULD PASS \' TO THIS FUNCTION, WHICH WOULD BECOME \\' ' \\' GETS INTERPRETED AS \', WITH THE \ BEING IGNORED AND THE ' GETTING 'INTERPRETED, THUS BYPASSING THIS FUNCTION, SO WE SHALL LOOP UNTIL WE ARE LEFT 'WITH JUST \' WHICH ESCAPES THE QUOTE, LOOP IS NEEDED BECAUSE A HACKER COULD TYPE ' \\\' IF WE SIMPLY CHECKED FOR \\' AFTER DOING THE INITIAL REPLACE. Do While InStr(Cleanse, "\\'") Cleanse = Replace(Cleanse, "\\'", "\'") Loop End Function this it ? |
Author: | Asrrin29 [ Mon Apr 06, 2009 9:51 pm ] |
Post subject: | Re: [Download] MS4 MySQL ;P |
Maps, character inventory, and character spell lists are the only things in 3.0.7 to be stored in blobs. If you optimize the database for single user queries, it can be very fast, especially on a SATA drive or solid state. Having things in seperate columns also makes it much easier to administer individuals, such as editing things server side. |
Author: | phelpsy [ Mon Apr 06, 2009 9:55 pm ] |
Post subject: | Re: [Download] MS4 MySQL ;P |
Asrrin29 wrote: Maps, character inventory, and character spell lists are the only things in 3.0.7 to be stored in blobs. If you optimize the database for single user queries, it can be very fast, especially on a SATA drive or solid state. Having things in seperate columns also makes it much easier to administer individuals, such as editing things server side. well ill probly have a go at that Cleanse thing and get it more secure as for changing the way accounts are i might*** do that xD |
Author: | ExoShox [ Wed Apr 08, 2009 7:59 pm ] |
Post subject: | Re: [Download] MS4 MySQL ;P |
YOu should also make each data value go in a seperate column like a clolumn for the name, etc |
Author: | Doomy [ Wed Apr 08, 2009 8:26 pm ] |
Post subject: | Re: [Download] MS4 MySQL ;P |
Here are alternate download links Provided via me http://rapidshare.com/files/219025275/MS4MySQL.zip.html http://www.mediafire.com/?yywdnd1mnnf http://www.megaupload.com/?d=ES8CCM3T http://www.sendspace.com/file/y8t3tj http://www.savefile.com/files/2070929 http://www.filefactory.com/file/agab18a/n/MS4MySQL_zip http://www.1filesharing.com/download/G4 ... 4MySQL.zip http://www.filesavr.com/ms4mysql http://www.filedropper.com/ms4mysql http://www.fileqube.com/file/xCgDsI187045 |
Author: | ExoShox [ Wed Apr 08, 2009 9:28 pm ] |
Post subject: | Re: [Download] MS4 MySQL ;P |
lol |
Author: | Doomy [ Wed Apr 08, 2009 9:36 pm ] |
Post subject: | Re: [Download] MS4 MySQL ;P |
i was bored |
Author: | ExoShox [ Wed Apr 08, 2009 10:34 pm ] |
Post subject: | Re: [Download] MS4 MySQL ;P |
well then. im doing my own suggestion. >:O meanies! jkjk |
Author: | Nean [ Thu Apr 09, 2009 12:14 am ] |
Post subject: | Re: [Download] MS4 MySQL ;P |
Doomy wrote: i was bored Way too much free time. |
Author: | phelpsy [ Thu Apr 09, 2009 10:52 am ] |
Post subject: | Re: [Download] MS4 MySQL ;P |
Senseika wrote: YOu should also make each data value go in a seperate column like a clolumn for the name, etc yea iv done that for characters and might do with some others |
Author: | ExoShox [ Fri Apr 10, 2009 12:47 am ] |
Post subject: | Re: [Download] MS4 MySQL ;P |
Code: Public Sub SaveNpc(ByVal NpcNum As Long) Dim FileName As String Dim NPCName As String * 20 Dim NPCSay As String * 100 Dim NPCSprite As Integer Dim NPCSpawnSecs As Long Dim NPCBehavior As Byte Dim NPCRange As Integer Dim NPCDropChance As Integer Dim NPCDropItem As Byte Dim NPCDropItemValue As Integer Dim NPCStat(1 To Stats.Stat_Count - 1) As Byte Dim NewData As String Dim CharOne As String Dim CharTwo As String Dim F As Long Dim a As Long CharOne = Chr(1) CharTwo = Chr(2) If MySQLEnable = True Then NewData = NewData & Trim$(Npc(NpcNum).Name) & CharSplit NewData = NewData & Trim$(Npc(NpcNum).AttackSay) & CharSplit NewData = NewData & Npc(NpcNum).Sprite & CharSplit NewData = NewData & Npc(NpcNum).SpawnSecs & CharSplit NewData = NewData & Npc(NpcNum).Behavior & CharSplit NewData = NewData & Npc(NpcNum).Range & CharSplit NewData = NewData & Npc(NpcNum).DropChance & CharSplit NewData = NewData & Npc(NpcNum).DropItem & CharSplit NewData = NewData & Npc(NpcNum).DropItemValue & CharSplit NewData = NewData & CharOne NPCName = Trim$(Npc(NpcNum).Name) NPCSay = Trim$(Npc(NpcNum).AttackSay) NPCSprite = Npc(NpcNum).Sprite NPCSpawnSecs = Npc(NpcNum).SpawnSecs NPCBehavior = Npc(NpcNum).Behavior NPCRange = Npc(NpcNum).Range NPCDropChance = Npc(NpcNum).DropChance NPCDropItem = Npc(NpcNum).DropItem NPCDropItemValue = Npc(NpcNum).DropItemValue For a = 1 To (Stats.Stat_Count - 1) NPCStat(a) = Npc(NpcNum).Stat(a) NewData = NewData & Npc(NpcNum).Stat(a) & CharSplit Next a NewData = NewData & CharOne If MySQLExists("SELECT id FROM Npcs WHERE id = '" & NpcNum & "'") = False Then MySQLCreate ("INSERT INTO Npcs (id, Data, Name, Say, Sprite, SpawnSecs, Behavior, Range, DropChance, DropItem, DropItemValue, Stat(1), Stat(2), Stat(3), Stat(4)) VALUES ('" & NpcNum & "', '" & NewData & "', '" & NPCName & "', '" & NPCSay & "', '" & NPCSprite & "', '" & NPCSpawnSecs & "', '" & NPCBehavior & "', '" & NPCRange & "', '" & NPCDropChance & "', '" & NPCDropItem & "', '" & NPCDropItemValue & "', '" & NPCStat(1) & "', '" & NPCStat(2) & "', '" & NPCStat(3) & "', '" & NPCStat(4) & "')") Else 'MsgBox NewData 'MsgBox NPCRange & vbCrLf & Npc(NpcNum).Range MySQLWrite ("UPDATE Npcs SET Data = '" & NewData & "', Name = '" & NPCName & "', Say = '" & NPCSay & "', Sprite = '" & NPCSprite & "', SpawnSecs = '" & NPCSpawnSecs & "', Behavior = '" & NPCBehavior & "' WHERE id = '" & NpcNum & "'") MySQLWrite ("UPDATE Npcs SET Range = '" & NPCRange & "', DropChance = '" & NPCDropChance & "', DropItem = '" & NPCDropItem & "', DropItemValue = '" & NPCDropItemValue & "', Stat1 = '" & NPCStat(1) & "', Stat2 = '" & NPCStat(2) & "', Stat3 = '" & NPCStat(3) & "', Stat4 = '" & NPCStat(4) & "' WHERE id = '" & NpcNum & "'") End If Else FileName = App.Path & "\Data\npcs\npc" & NpcNum & ".dat" F = FreeFile Open FileName For Binary As #F Put #F, , Npc(NpcNum) Close #F End If End Sub Ok, so far I was working on the NPC table and everything in SaveNPC except the "NPCRange" to column "Range" works. NPCRange and NPCBehavior are the same data-types, so it theoretically should work in my opinion. The SQL script is this: Code: CREATE TABLE IF NOT EXISTS `npcs` ( `id` int(11) NOT NULL AUTO_INCREMENT, `Data` text NOT NULL, `Name` text(20) NOT NULL, `Say` text(100) NOT NULL, `Sprite` smallint(6) signed NOT NULL, `SpawnSecs` int(11) signed NOT NULL, `Behavior` tinyint(3) signed NOT NULL, `Range` tinyint(3) signed NOT NULL, `DropChance` smallint(6) signed NOT NULL, `DropItem` tinyint(3) signed NOT NULL, `DropItemValue` smallint(6) signed NOT NULL, `Stat(1)` tinyint(3) signed NOT NULL, `Stat(2)` tinyint(3) signed NOT NULL, `Stat(3)` tinyint(3) signed NOT NULL, `Stat(4)` tinyint(3) signed NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; Also, I have narrowed down the problem to the Range, so everything after isn't the problem. When I check the SQL Database, everything saves properly if it isn't in the same query as the NPCRange. If you figure something out I would greatly appreciate it. |
Author: | phelpsy [ Fri Apr 10, 2009 9:54 pm ] |
Post subject: | Re: [Download] MS4 MySQL ;P |
Senseika wrote: Code: Public Sub SaveNpc(ByVal NpcNum As Long) Dim FileName As String Dim NPCName As String * 20 Dim NPCSay As String * 100 Dim NPCSprite As Integer Dim NPCSpawnSecs As Long Dim NPCBehavior As Byte Dim NPCRange As Integer Dim NPCDropChance As Integer Dim NPCDropItem As Byte Dim NPCDropItemValue As Integer Dim NPCStat(1 To Stats.Stat_Count - 1) As Byte Dim NewData As String Dim CharOne As String Dim CharTwo As String Dim F As Long Dim a As Long CharOne = Chr(1) CharTwo = Chr(2) If MySQLEnable = True Then NewData = NewData & Trim$(Npc(NpcNum).Name) & CharSplit NewData = NewData & Trim$(Npc(NpcNum).AttackSay) & CharSplit NewData = NewData & Npc(NpcNum).Sprite & CharSplit NewData = NewData & Npc(NpcNum).SpawnSecs & CharSplit NewData = NewData & Npc(NpcNum).Behavior & CharSplit NewData = NewData & Npc(NpcNum).Range & CharSplit NewData = NewData & Npc(NpcNum).DropChance & CharSplit NewData = NewData & Npc(NpcNum).DropItem & CharSplit NewData = NewData & Npc(NpcNum).DropItemValue & CharSplit NewData = NewData & CharOne NPCName = Trim$(Npc(NpcNum).Name) NPCSay = Trim$(Npc(NpcNum).AttackSay) NPCSprite = Npc(NpcNum).Sprite NPCSpawnSecs = Npc(NpcNum).SpawnSecs NPCBehavior = Npc(NpcNum).Behavior NPCRange = Npc(NpcNum).Range NPCDropChance = Npc(NpcNum).DropChance NPCDropItem = Npc(NpcNum).DropItem NPCDropItemValue = Npc(NpcNum).DropItemValue For a = 1 To (Stats.Stat_Count - 1) NPCStat(a) = Npc(NpcNum).Stat(a) NewData = NewData & Npc(NpcNum).Stat(a) & CharSplit Next a NewData = NewData & CharOne If MySQLExists("SELECT id FROM Npcs WHERE id = '" & NpcNum & "'") = False Then MySQLCreate ("INSERT INTO Npcs (id, Data, Name, Say, Sprite, SpawnSecs, Behavior, Range, DropChance, DropItem, DropItemValue, Stat(1), Stat(2), Stat(3), Stat(4)) VALUES ('" & NpcNum & "', '" & NewData & "', '" & NPCName & "', '" & NPCSay & "', '" & NPCSprite & "', '" & NPCSpawnSecs & "', '" & NPCBehavior & "', '" & NPCRange & "', '" & NPCDropChance & "', '" & NPCDropItem & "', '" & NPCDropItemValue & "', '" & NPCStat(1) & "', '" & NPCStat(2) & "', '" & NPCStat(3) & "', '" & NPCStat(4) & "')") Else 'MsgBox NewData 'MsgBox NPCRange & vbCrLf & Npc(NpcNum).Range MySQLWrite ("UPDATE Npcs SET Data = '" & NewData & "', Name = '" & NPCName & "', Say = '" & NPCSay & "', Sprite = '" & NPCSprite & "', SpawnSecs = '" & NPCSpawnSecs & "', Behavior = '" & NPCBehavior & "' WHERE id = '" & NpcNum & "'") MySQLWrite ("UPDATE Npcs SET Range = '" & NPCRange & "', DropChance = '" & NPCDropChance & "', DropItem = '" & NPCDropItem & "', DropItemValue = '" & NPCDropItemValue & "', Stat1 = '" & NPCStat(1) & "', Stat2 = '" & NPCStat(2) & "', Stat3 = '" & NPCStat(3) & "', Stat4 = '" & NPCStat(4) & "' WHERE id = '" & NpcNum & "'") End If Else FileName = App.Path & "\Data\npcs\npc" & NpcNum & ".dat" F = FreeFile Open FileName For Binary As #F Put #F, , Npc(NpcNum) Close #F End If End Sub Ok, so far I was working on the NPC table and everything in SaveNPC except the "NPCRange" to column "Range" works. NPCRange and NPCBehavior are the same data-types, so it theoretically should work in my opinion. The SQL script is this: Code: CREATE TABLE IF NOT EXISTS `npcs` ( `id` int(11) NOT NULL AUTO_INCREMENT, `Data` text NOT NULL, `Name` text(20) NOT NULL, `Say` text(100) NOT NULL, `Sprite` smallint(6) signed NOT NULL, `SpawnSecs` int(11) signed NOT NULL, `Behavior` tinyint(3) signed NOT NULL, `Range` tinyint(3) signed NOT NULL, `DropChance` smallint(6) signed NOT NULL, `DropItem` tinyint(3) signed NOT NULL, `DropItemValue` smallint(6) signed NOT NULL, `Stat(1)` tinyint(3) signed NOT NULL, `Stat(2)` tinyint(3) signed NOT NULL, `Stat(3)` tinyint(3) signed NOT NULL, `Stat(4)` tinyint(3) signed NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; Also, I have narrowed down the problem to the Range, so everything after isn't the problem. When I check the SQL Database, everything saves properly if it isn't in the same query as the NPCRange. If you figure something out I would greatly appreciate it. allready done this but thanks anyway i have now done users/characters, spells and npcs been busy with somthing else. anyway the next one i will release will have separate columns for the main things like name and all that and everything else like inventory will be put in one column. ill be finished soon |
Author: | ExoShox [ Mon Apr 20, 2009 11:19 pm ] |
Post subject: | Re: [Download] MS4 MySQL [Updated] |
Am i drunk or did you put POKEMON into the npcs? Please tell me im drunk. Otherwise, please tell me what will happen if i delete it? Nvm It works fine, and im adding new SQL Stuff (Classes and Bans, Email, IP Logs, Cheat Logs, etc.) |
Author: | phelpsy [ Fri Apr 24, 2009 6:24 pm ] |
Post subject: | Re: [Download] MS4 MySQL [Updated] |
ExoShox wrote: Am i drunk or did you put POKEMON into the npcs? Please tell me im drunk. Otherwise, please tell me what will happen if i delete it? Nvm It works fine, and im adding new SQL Stuff (Classes and Bans, Email, IP Logs, Cheat Logs, etc.) kl if theres any pokemon stuff in there you can just delete its from my pokemon game i was making |
Author: | FrankJScott [ Mon Mar 04, 2024 10:59 pm ] |
Post subject: | High Rated Product Blog |
Please try Google before asking about Best Product Blog fc2b2eb |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |