x


Unity to PHP/MySQL: password and username security

Hello everyone!, Im making a connection between a Unity webplayer and a PHP/MySQL database.

Where should i place my database info such as the password and username(the ones that you need to log-in into a database)?

Should i put it directly into my PHP script? what if someone found out the URL, is it possible for them to sneak into the PHP codes?.

or I should put the info in the Webplayer Build as a public variable(enter the value through Inspector)?

more ▼

asked Nov 28 '10 at 01:11 AM

Albert gravatar image

Albert
323 18 19 26

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

If you put it in the php code, it doesn't leave the server.

Use the mysql_connect("localhost", username, password); command to create a connection to your database in a php script. I use a seperate connect.php file, which you can then include in any php script that needs to connect to the database.

Putting the database connection info in the webplayer or stand-alone would be a very bad idea. This would mean that you have to transfer that information from the clients machine to the webserver. Anyone using your build and anyone able to intercept the connection would be able to sniff out your database login.

more ▼

answered Nov 28 '10 at 07:35 AM

Badger gravatar image

Badger
104 6 8 15

yes, but isn't everyone can view the source page of URLs? like an html file on browsers.

Dec 21 '10 at 08:15 AM Albert

no, not with php, its an html generator, so it will connect to the database & then process its data to HTML, so the actual php code (where the pass is) will never be show to the net (as far as i know)

Jan 06 '11 at 03:23 PM Badger
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x241
x136
x104
x78

asked: Nov 28 '10 at 01:11 AM

Seen: 3584 times

Last Updated: Nov 28 '10 at 01:11 AM