This is the first time when I create a database for user interaction and I have some "silly" questions but I I do not know how to do
What do I want: I have to be a database where users will have comments and articles I have important information such as the name of the user And the address and perhaps credit card must be recovered. What I have done I have a database with the table for users of my information, and then there are comments related to a table and one Related to other articles. My Problems 1) When you do a DB connection, do you do the same user all the time (of course not) and then you Do the aliens and the nearest compare? That's what I have, but it is very strange to me because if anyone knows my user and is close to joining DB, then there will be all the information. I have got to have an account for each user, but then how do I get my accounts Can I Wipe / Restore / Watch Things Only? 2) I have read some questions and now I know that I store passwords and compare them with bereft. Besides, I know that credit card is not so potentially storeable, but I will not do it for the other things (address, name) which is the best way to store them? 3) If a user makes a connection and it is a possibility that will work more in a short time, is it better to shut down and open the connection every time? How can I control the session? The code for writing mobile developers to mysql is written in PHP. First of all, do not store credit cards to do something to token of their own database data Use (Free to sign up and anyone is accepted) If you are making a mobile app with your username and password, then go away with a user name / password to a remote server. Generally, there is a better method for password than hashing encrypting, because hash is the only way (you know that a password matches, but you can never retrieve the password as a string again) . To connect to your database, do not connect it directly to it via the API / Web service on your server. To get information from the server, you probably want to use json and want to use GET and POST requests here is a simple example for handling a login request on the server (from device Post): Note that I have completely created auth_model, sanitizer, and other_model, they are just for example. In most languages / platforms, Jason has a library for the consumer, and this is a simple form, so as a starting point, I think that you will have the easiest time with it. For session / state, store your session in a database table and only id (and return anything) the customer does not really need to be secure)
& lt ;? Php if (isset ($ _ POST ['username']) & amp; amp;; Isset ($ _ POST ['password'])) // If the user's authentication details are valid $ auth = auth_model :: try_auth (sanitizer $ _ POST ['username']), sanitizer ($ _ POST ['password'])); // if valid ($ auth) {echo json_encode (other_model :: some_function_that_returns_array ()); Go out; } Else {echo json_encode (array ('error' = & gt; 'authentication failed.')); Go out; }}
Comments
Post a Comment