Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Albert · Nov 28, 2010 at 01:11 AM · databasemysqlphpsecurity

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)?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Badger · Nov 28, 2010 at 07:35 AM

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.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Albert · Dec 21, 2010 at 08:15 AM 0
Share

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

avatar image Badger · Jan 06, 2011 at 03:23 PM 0
Share

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

avatar image superme2012 · Aug 28, 2013 at 08:05 AM 0
Share

PHP is server side code, HT$$anonymous$$L, CSS and JavaScript is client side code. Server side code is processed on the server only and is never visible to the user (client). In other words, PHP creates results (echo "hello world"), echo is server side, hello world is client side.

avatar image oliver-jones · Aug 28, 2013 at 08:09 AM 0
Share

Badger and Superme are all right. If you uploaded a pure PHP file (no html) to a server, and then viewed the URL, nothing will show up, even if you view the source code, you wont see any of the PHP... Ever!

If you include HT$$anonymous$$L into your PHP file, then the viewer can ONLY view the HT$$anonymous$$L code, again, never the PHP.

The only way a user can see your PHP source code is if the user actually gains access to your server files somehow (illegally).

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Why i keep getting this message : Wrong response ? 0 Answers

How to use php to update mySQL 1 Answer

www php send data to mysql 2 Answers

How to make a highscore database for unity? 1 Answer

How to get Variable from Php Script? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges