This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
H4X0RZ's profile picture

CcSQL (API for MySQL)

Started by H4X0RZ, 23 March 2014 - 05:45 PM
H4X0RZ #1
Posted 23 March 2014 - 06:45 PM
CcSQL is an API you can use to connect to REAL MySQL databases.
You need this JSON API and my CcSQL.


usage

os.loadAPI("ccSQL")
local sql = ccSQL.createCcSQL("host", nil, "db", "user", "password") --nil is the port, for now it is not used in the API
sql:prepareStatement("SELECT * FROM table")
local response = sql:sendStatement()
--now, response contains a table with the content of the selection.

Bugs
  • You can only use "localhost" as host for now, idk why other ones doesn't work D:
gknova61 #2
Posted 03 April 2014 - 12:34 AM
Can you release PHP source?
H4X0RZ #3
Posted 03 April 2014 - 10:16 AM
Can you release PHP source?
Oh, yea… forgot that xD
The PHP script is as simple as this.

BTW,
SpoilerIf you want, you can use this data to connect to a ftp server with almost the newest script.
Name: ccsql
password: ccsql
theoriginalbit #4
Posted 03 April 2014 - 11:52 AM
not a huge fan, I like what you're trying to do, but you might want to work on security issues; I'd not overly trust the data I store in my databases to be 'safe' in this case.
H4X0RZ #5
Posted 03 April 2014 - 12:21 PM
not a huge fan, I like what you're trying to do, but you might want to work on security issues; I'd not overly trust the data I store in my databases to be 'safe' in this case.
Yea, that's true. But how should I improve the security? D:
theoriginalbit #6
Posted 03 April 2014 - 12:51 PM
first and foremost take a look into prepared statements for the PHP side of things.
Shazz #7
Posted 07 April 2014 - 10:07 PM
I'm not exactly sure what the purpose of this is.
Are you trying to publish a program people can use to access a MySQL database on your server?
Or are you trying to provide people with a PHP script that they can put on their server so they can communicate with their database?

In either case, this implementation is very insecure.
Parzivail #8
Posted 08 April 2014 - 12:44 PM
not a huge fan, I like what you're trying to do, but you might want to work on security issues; I'd not overly trust the data I store in my databases to be 'safe' in this case.
Yea, that's true. But how should I improve the security? D:
Write an encryption library!
H4X0RZ #9
Posted 08 April 2014 - 02:52 PM
I'm not exactly sure what the purpose of this is.
Are you trying to publish a program people can use to access a MySQL database on your server?
Or are you trying to provide people with a PHP script that they can put on their server so they can communicate with their database?

In either case, this implementation is very insecure.
If people setup their MySQL server right, you can access it from my script. But I made this as a connection between computercraft and a MySQL server (not exactly mine).

not a huge fan, I like what you're trying to do, but you might want to work on security issues; I'd not overly trust the data I store in my databases to be 'safe' in this case.
Yea, that's true. But how should I improve the security? D:
Write an encryption library!

How would it improve the security?
Shazz #10
Posted 08 April 2014 - 09:20 PM
Write an encryption library!

It's a horrible idea to write your own encryption algorithm. I can understand it if you are writing one just for experimenting but homebrew encryption algorithms for use in a production environment is a bad idea.