Name: Anonymous 2013-09-05 21:08
(sorry for not knowing technical terms for all of this, I understand languages on more of a conceptual basis)
I've just started messing around with mySQL and decided I wanted to use it to store some information. But I have a question about how users would be kept out of the database.
If I make a file that accesses a database and adds info to it, there has to be a line like "mysql_connect("localhost", "root", "");" to connect to the database (with PHP anyways).
But what if the code is open source, and anyone can look at and see this line? I figured I could force the user to input information such as username and password so that the mentioned line wouldn't reveal anything that the user didn't already know, but what if the user was, for example, creating an account? The user doesn't have anything associated with the database yet, but information has to be written to the database to initialize their account, which would require a user with higher privileges than I want the user to have.
I don't want users to be able to access the database at all, but I know that anything I code has to access the database to read and write data. How would that be possible?
I've just started messing around with mySQL and decided I wanted to use it to store some information. But I have a question about how users would be kept out of the database.
If I make a file that accesses a database and adds info to it, there has to be a line like "mysql_connect("localhost", "root", "");" to connect to the database (with PHP anyways).
But what if the code is open source, and anyone can look at and see this line? I figured I could force the user to input information such as username and password so that the mentioned line wouldn't reveal anything that the user didn't already know, but what if the user was, for example, creating an account? The user doesn't have anything associated with the database yet, but information has to be written to the database to initialize their account, which would require a user with higher privileges than I want the user to have.
I don't want users to be able to access the database at all, but I know that anything I code has to access the database to read and write data. How would that be possible?