Posted by JimL (JimL), 22 January 2004I'm developing a system which uses PHP to read from and update a MySQL database.
Because some of the data is sensitive I want one table to be read-only (so malicious users cannot change any of the information).
However, one table I want to use as a log, and so must be read/write.
Am I correct in thinking that the second table need only to be read/write to the user account within which the PHP application runs?
Posted by admin (Graham Ellis), 22 January 2004You're using PHP on a web server to access the MySQL tables. The PHP scripts won't be visible to users of your system - only to the people who have other access (such as FTP or ssh) to the document directory on your web server; those scripts might well include the MySQL password, but - provided that you set up the PHP properly that code will never get out to the user's browser.
I think that just a single simple login account to the MySQL will suffice, but it will need to be protected with a good password. You might also consider allowing access to the MySQL through this account only from the web server, so that (even if they discovered the password), user on other systems couldn't get it ... but it would restrict you except when you were logged in to a shell session on the server.
Final note - the security will only be as stong as the security of the worst protected account that can get at the database(s). In other words, if there happened to be a MySQL root account with lots of global priviledges and a password that lots of people knew, then whatever you do any of these people could come in through the back door ... and remember that a thief will always look for the easiest entry, and preferably one where he expects he won't be seen.
Posted by JimL (JimL), 23 January 2004Hi Graham,
as far as the code, I'll stick to your guidelines and do all the PHP first, and build up the HTML I want to send in a variable. Then I'll just send it all out at the end in one go.
As far as the MySQL database is concerned, I'll check with the server administators to ensure they put it in a sceure place.
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: email@example.com • WEB: http://www.wellho.net • SKYPE: wellho