Jump to content


Photo

Ezsql - A Simple, Easy Mysql Connector


  • Please log in to reply
39 replies to this topic

#1 Revel

Revel

    ɹǝqɯǝɯ ɔɯƃ

  • GMC Member
  • 4935 posts
  • Version:GM8

Posted 27 June 2009 - 11:04 PM

I made this really simple mysql connector that can be used to execute basic queries such as "SELECT" , "INSERT", "UPDATE", etc. I thought it would be a good idea to make a simple one since there are none available.


There are only 7 functions such as "EZsql_Query", "EZsql_LastErr" and more! The DLL is very small and powerful.


Download: Here


Please post your suggestions/problems.

Make sure to distribute mysqlpp.dll and libmySQL.dll alongside the MYSQLTest.dll.

Sorry for such a short post but I have to leave...
  • 0

#2 pokefan121

pokefan121

    GMC Member

  • GMC Member
  • 62 posts

Posted 28 June 2009 - 09:21 AM

works great 7/10

might use this in my game for highscores
  • 0
Only sado's tick Treat uninitialized variables as 0
Gm7/8 User for 5 years
According to the Sonic Quiz, I am a Posted Image. What are you?
I am looking for a team to make a Command and Conquer game!

#3 Mordi

Mordi

    Maker of Menus

  • New Member
  • 3635 posts

Posted 18 August 2009 - 01:13 PM

Error defining an external function.

Edit: Actually, I can't seem to run any DLLs in GM at the moment. Using vista. Anyone got a clue?

Edited by Mordi, 18 August 2009 - 02:40 PM.

  • 0

#4 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 18 August 2009 - 06:04 PM

Tell us exactly what you did to get that error. Step by step.
  • 0

#5 Mordi

Mordi

    Maker of Menus

  • New Member
  • 3635 posts

Posted 18 August 2009 - 06:34 PM

Tell us exactly what you did to get that error. Step by step.

Extract zip content to desktop --> Run .gmk in GM7.

That's all. Perhaps it will fix itself after a restart.
  • 0

#6 Revel

Revel

    ɹǝqɯǝɯ ɔɯƃ

  • GMC Member
  • 4935 posts
  • Version:GM8

Posted 18 August 2009 - 09:58 PM

Hmm.. It works on my old 32 bit XP, and it works on my new 64 bit Vista.. Did a restart help?
  • 0

#7 Caniac

Caniac

    The #1 Caniac

  • New Member
  • 2622 posts

Posted 18 August 2009 - 10:12 PM

Hmm.. It works on my old 32 bit XP, and it works on my new 64 bit Vista.. Did a restart help?

No, it didn't (I was talking to him a while ago, he said it didn't)
  • 0

#8 Mordi

Mordi

    Maker of Menus

  • New Member
  • 3635 posts

Posted 18 August 2009 - 10:50 PM

Nope, but I'm sure the problem is on my end, so let's not discuss that any further.
  • 0

#9 iFocus

iFocus

    GMC Member

  • New Member
  • 4 posts

Posted 17 September 2009 - 06:14 PM

Hey I am currently getting an Error defining an external function. whenever I start up the program. I have entered all of my database info and for some reason it just keeps giving me this error
  • 0

#10 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 20 September 2009 - 11:24 AM

I got "Error while defining external function" as well. I tried to run your example after I compiled it or by using program_directory, nothing worked.
Are you sure the functions are correctly defined in your example?
  • 0
GM 8.1 / GM:HTML5 User

#11 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 20 September 2009 - 12:29 PM

I got it too, it's definitely a problem with his DLL.
  • 0

#12 Timmo

Timmo

    GMC Member

  • New Member
  • 558 posts
  • Version:GM:HTML5

Posted 28 September 2009 - 12:02 PM

How secure is the data transmission, do you use some kind of a crypt system?
  • 0

Posted Image Posted Image


#13 newbie013

newbie013

    GMC Member

  • GMC Member
  • 96 posts
  • Version:GM8

Posted 04 October 2009 - 10:31 AM

mysql isn't secured >.> and if it doesn't work on your pc just download mingwm10.dll and put it in your folder with the other dlls and then it works fine :)
  • 1

#14 tim.vangehugten

tim.vangehugten

    GMC Member

  • GMC Member
  • 72 posts

Posted 15 November 2009 - 04:19 PM

do you have an example to count your rows???


I do this ;

EZsql_Query(HND,"SELECT COUNT(*) FROM testuser"));
num=EZsql_NumRows(HND);
show_message(num);

and it returns nothing...

the rest works fine, thank you :)

Edited by tim.vangehugten, 15 November 2009 - 04:19 PM.

  • 0

#15 lollola

lollola

    GMC Member

  • New Member
  • 56 posts

Posted 15 November 2009 - 08:45 PM

Things like this are dangerous to use. Anybody with a little skill can capture the mysql password and user info and use them to do what they want with the database.
Instead there should be something in between like a PHP page. It isn't that hard to do such a thing. For example:

<?php

//Prevent caching
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past

//Retrieve and set the variables
$name = $_GET['name'];
$score = $_GET['score'];

//-----------------------------------------------------------------
// Lets start a MySQL connection.
//-----------------------------------------------------------------

$connection = mysql_connect (mysql_server, mysql_username, mysql_password);
if (!$connection) 
	{
	echo 'x'; //print an "x" and exit the script. This will tell the program there was a problem connecting.
	exit;
	}
 
$db = mysql_select_db(mysql_database,$connection);
if (!$db) 
	{
	echo 'x'; //print an "x" and exit the script. This will tell the program there was a problem connecting.
	exit;
	}
 
///////////////////////////////////////////
//  ADD STUFF TO THE DATABASE: //
///////////////////////////////////////////

//Prevent injections
$name = mysql_real_escape_string( trim ( stripslashes( $name )));
$score = mysql_real_escape_string( trim ( stripslashes( $score )));

$sql= "INSERT INTO highscores (name, score) VALUES ('$name','$score')";
mysql_query($sql);
 
echo 'o'; //echo o for ok

mysql_close($connection); 

?>

Then you use for example netread dll to connect to the PHP script:

var data, tries;
tries=0;
data = "";
url = 'http://mygamedomain.com/highscores.php?name=' +string(name) + '&score=' + string(score);
while (data == "" && tries<3)
	  {	  
	  data = netread(url,1);
	  tries++;
	  }

if (data=="x" )
	{
	show_message("I7 41n7 W0RK1N5 noob!"); // TELL THE USER IT DIDN'T WORK!
	}
else
   {
   // TELL THE USER THE HIGHSCORE WAS SENDED
   }

But this is only a simple example and it is also very easy to hack as the highscore is not encrypted etc..
Also retrieving the scores is not covered here.
Making it really safe is almost impossible.. Even Halo 2 or 3 was hacked and the leaderboards were then closed.

Other thing is if the DLL is only used on a central server (like it could be with many RPG's) to which the players have no direct access.
Then it's a great thing to have and simplify things.
  • 0

#16 tim.vangehugten

tim.vangehugten

    GMC Member

  • GMC Member
  • 72 posts

Posted 15 November 2009 - 08:49 PM

the script is running server sided so dont worry about the security.
Thanks for your quick reply btw :)

Ill take a look at the php script

grtz

Edited by tim.vangehugten, 15 November 2009 - 08:49 PM.

  • 0

#17 ash47

ash47

    O_o

  • GMC Member
  • 1347 posts

Posted 16 November 2009 - 11:22 AM

Mysql isn't safe in gamemaker! People can decompile (though it's not legal) games, and get people's usernames + passwords, i personally wouldn't use this, i'd just use a PHP file which does controlled mysql commands ;)

Just my thoughts though ;)

- Ash47
  • 0
Posted Image

Rate this topic: 0 | 1 | 2 | 3 | 4 | 5

PRESS IT
\/


#18 tim.vangehugten

tim.vangehugten

    GMC Member

  • GMC Member
  • 72 posts

Posted 16 November 2009 - 11:24 PM

Mysql isn't safe in gamemaker! People can decompile (though it's not legal) games, and get people's usernames + passwords, i personally wouldn't use this, i'd just use a PHP file which does controlled mysql commands ;)

Just my thoughts though :)

- Ash47


Thats why you should use it serversided... ;)
  • 0

#19 D1g1talAli3n

D1g1talAli3n

    BoyGenius

  • GMC Member
  • 965 posts
  • Version:GM8

Posted 04 January 2010 - 03:16 AM

The dll shows the error because it wasn't compiled with mingw. You could either compile the .cpp using mingw (or Revel could do that for us), or use that dll that newbie013 said.
  • 0

Posted Image


#20 Squiddle

Squiddle

    GMC Member

  • New Member
  • 116 posts

Posted 05 January 2010 - 01:17 AM

I'm looking at it, and it looks absolutely epic. I've been needing something like this for so long :whistle:. I will have to try it soon.
  • 0
Testing with a Real Time Strategy, working really well ^.^.




#21 DefuzionGames

DefuzionGames

    GMC Member

  • GMC Member
  • 1460 posts
  • Version:Unknown

Posted 08 January 2010 - 08:14 PM

Mysql isn't safe in gamemaker! People can decompile (though it's not legal) games, and get people's usernames + passwords, i personally wouldn't use this, i'd just use a PHP file which does controlled mysql commands :(

Just my thoughts though :blink:

- Ash47

you can decompile anything these days. even windows is not safe from hackers so what chance do small time game developers?? the only reason they dont get hacked is cos the hackers dont see the point.
  • 0

#22 Axeon

Axeon

    GMC Member

  • New Member
  • 50 posts

Posted 09 January 2010 - 02:27 PM

I get a error message that the program cannot be started because mingwm10.dll not could be found. How do I fix this?
  • 0

#23 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 02 February 2010 - 10:55 AM

5.52 MB for one darn DLL!! This is not for practical use =\.

Mysql isn't safe in gamemaker! People can decompile (though it's not legal) games, and get people's usernames + passwords, i personally wouldn't use this, i'd just use a PHP file which does controlled mysql commands
That's why you use an authentication server.
  • 0

Posted Image


#24 tuntis

tuntis

    GMC Member

  • New Member
  • 1839 posts

Posted 03 February 2010 - 06:16 PM

5.52 MB for one darn DLL!! This is not for practical use =\.

The only situation where you'd use this DLL would be when writing a server in GM, so what does filesize matter?
  • 0

#25 ze1

ze1

    GMC Member

  • GMC Member
  • 153 posts
  • Version:GM:Studio

Posted 07 February 2010 - 03:23 AM

Doesn't work...
I get this (strange) error saying "MySQL has gone away" whenever it tries to do something with the database. It happens even in the example given.
I have no idea what's happening since there's NO DOCUMENTATION anywhere... =(
  • 0

#26 pokemonxs

pokemonxs

    GMC Member

  • New Member
  • 247 posts

Posted 09 July 2010 - 06:04 PM

mingwm10.dll could not be found.

EDIT: http://www.nodevice..../item11330.html

Edited by pokemonxs, 09 July 2010 - 06:11 PM.

  • 0
-Talented

#27 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 09 July 2010 - 08:18 PM

I wouldn't suggest this DLL for use, Revel will most likely not be updating his DLLs soon. If you're going to be using MySQL, you should be experienced enough to make your server in C++ (or another language).
  • 0

#28 rahro

rahro

    GMC Member

  • New Member
  • 4 posts

Posted 09 January 2011 - 09:17 AM

I want connect to a mysql that is on a host!
this DLL can do it?!
how?!
  • 0

#29 Cro172

Cro172

    GMC Member

  • GMC Member
  • 52 posts

Posted 07 June 2011 - 12:55 AM

Does this work in Game Maker 8.1?
  • 0

#30 POC0bobPOC

POC0bobPOC

    GMC Member

  • New Member
  • 41 posts

Posted 12 October 2011 - 06:51 PM

i cant get it to work D: i filled all the info and i'm still getting errors... i downloaded the mingwm10.dll i put everything in one folder, then i first tryed your example, and it didn't work then i put all my server info and it still gets an error...
  • 0

#31 rater193

rater193

    GMC Member

  • GMC Member
  • 127 posts
  • Version:GM:Studio

Posted 12 September 2012 - 12:25 PM

I'm looking at it, and it looks absolutely epic. I've been needing something like this for so long :whistle:. I will have to try it soon.


OMG! THANK YOU! I CAN FINALLY USE MY DATABASE TO LINK MY WEBSITE WITH MY GAME! :D:D:D:D
  • 0

Click this to find out what you are!

Posted Image


#32 rater193

rater193

    GMC Member

  • GMC Member
  • 127 posts
  • Version:GM:Studio

Posted 12 September 2012 - 12:30 PM

5.52 MB for one darn DLL!! This is not for practical use =\.

Mysql isn't safe in gamemaker! People can decompile (though it's not legal) games, and get people's usernames + passwords, i personally wouldn't use this, i'd just use a PHP file which does controlled mysql commands
That's why you use an authentication server.


Just use an "Anti Decompiler" on your game maker game, and it will fix that problem :), also 5.52 MB is small, so it IS gr8 for praticle use :)

Edited by rater193, 12 September 2012 - 01:20 PM.

  • 0

Click this to find out what you are!

Posted Image


#33 Drara

Drara

    GMC Member

  • GMC Member
  • 325 posts

Posted 12 September 2012 - 04:38 PM

Just use an "Anti Decompiler" on your game maker game, and it will fix that problem :), also 5.52 MB is small, so it IS gr8 for praticle use :)

Ehm there is not working Anti-Decompiler für GM 8.1 as far as I know. do you know one? o:
And that's indeed a huge Dll o-o It's as big as an entire 3D graphics engine (GM Ogre), lol. But of coruse the functionalism is more important.

Edited by Drara, 12 September 2012 - 04:38 PM.

  • 0

#34 SyncViews

SyncViews

    GMC Member

  • GMC Member
  • 392 posts

Posted 12 September 2012 - 07:13 PM

Also an anti decompiler would not protect user names and passwords and otherwise prevent someone to manipulate your database. Do not keep such details on the client in any form.
  • 0

#35 rater193

rater193

    GMC Member

  • GMC Member
  • 127 posts
  • Version:GM:Studio

Posted 13 September 2012 - 03:12 PM

I have made a tutorial for this engine, you can view the tutorial here
Ezsql Tutorial

  • 0

Click this to find out what you are!

Posted Image


#36 Fireball16

Fireball16

    Indie Developer

  • GMC Member
  • 1015 posts
  • Version:GM:Studio

Posted 02 December 2012 - 06:58 PM

Hi, when I launch the test gmk I get an error saying that the mingwm10.dll is missing... What does that mean?
  • 0

twitter128x12832.pngbrowser128x12832.pngandroid128x12832.pngskype128x12832.png


#37 Mayhem Games

Mayhem Games

    Proud Kiwi

  • GMC Member
  • 959 posts
  • Version:GM:Studio

Posted 04 December 2012 - 08:45 AM

Hi, when I launch the test gmk I get an error saying that the mingwm10.dll is missing... What does that mean?

:whistle: (The emote is a link :thumbsup: )

Edited by Mayhem Games, 04 December 2012 - 08:46 AM.

  • 0

For a long time it puzzled me how something so expensive, so leading edge, could be so useless, and then it occurred to me that a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a dangerously perfect match. ~ Bill Bryson


#38 Fireball16

Fireball16

    Indie Developer

  • GMC Member
  • 1015 posts
  • Version:GM:Studio

Posted 09 December 2012 - 03:56 PM

Hi, when I launch the test gmk I get an error saying that the mingwm10.dll is missing... What does that mean?

:whistle:/> (The emote is a link :thumbsup:/> )

This may sound stupid, but does this mean that only people with the mingwm10.dll will be able to play the game once its been exported?
  • 0

twitter128x12832.pngbrowser128x12832.pngandroid128x12832.pngskype128x12832.png


#39 Mayhem Games

Mayhem Games

    Proud Kiwi

  • GMC Member
  • 959 posts
  • Version:GM:Studio

Posted 10 December 2012 - 02:06 AM

Hi, when I launch the test gmk I get an error saying that the mingwm10.dll is missing... What does that mean?

:whistle: (The emote is a link :thumbsup: )

This may sound stupid, but does this mean that only people with the mingwm10.dll will be able to play the game once its been exported?


Sort of, it's not a major issue though just include it in your games main directory.
  • 0

For a long time it puzzled me how something so expensive, so leading edge, could be so useless, and then it occurred to me that a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a dangerously perfect match. ~ Bill Bryson


#40 GothSeiDank

GothSeiDank

    GMC Member

  • GMC Member
  • 285 posts
  • Version:GM:Studio

Posted 10 December 2012 - 02:20 AM

Things like this are dangerous to use. Anybody with a little skill can capture the mysql password and user info and use them to do what they want with the database.
Instead there should be something in between like a PHP page. It isn't that hard to do such a thing. For example:

Spoiler


But this is only a simple example and it is also very easy to hack as the highscore is not encrypted etc..
Also retrieving the scores is not covered here.
Making it really safe is almost impossible.. Even Halo 2 or 3 was hacked and the leaderboards were then closed.

Other thing is if the DLL is only used on a central server (like it could be with many RPG's) to which the players have no direct access.
Then it's a great thing to have and simplify things.


You know, if you talk about security, then you should not use raw mysql functions in a php script.
Use PDO.

Edited by GothSeiDank, 10 December 2012 - 02:21 AM.

  • 0

Code posted by me in this forum is Public Domain. Do with it whatever you want, I don't care.