Good to all.) You need to remember the user in the cookies. But so that would protect the data. Well, it is natural to pass them through the pages. Question? how to do it?

  • what kind of data? and what specifically to protect? - Alexey Shimansky
  • It is necessary from editing someone else's data. through their own. data. here is the query UPDATE users SET name = 'boss', seurname =' sos', sex = '1', mygroup = 'wos', balls = 10,000, berd_year =' 1000 ', place =' always', email = '@@ @ shima @@@ 'WHERE id =' id 'LIMIT 1; if I post there any id, I will corrupt other people's data - dpi
  • You should not give the opportunity to edit the author ID. Or, at worst, always check that they match. - user207618
  • Such an id should be stored in your session, and not in cookies. And when editing information related to the author (articles of some kind or posts), you should check that their id also match. - teran
  • @ Dima Perilman at the start of the session on the server, the session identifier is recorded in the cookie to make the browser understand that this is the user. there are so many characters that it is difficult to pick up randomly. and you must take the user ID not from the cookie, but from the data of the authorized user. - Alexey Shimansky

1 answer 1

Everything that is sent to the client will already be decrypted by all means (not a hacker, so a browser).

Therefore, you can send either what should be decrypted, or something like a session ID - the ID itself costs nothing, and the data is securely stored on the server.

  • Ie in kuku bring id sesi? And how to get it? and then how to substitute? - dpi
  • @ Dima Perilman pkhp himself take care of this when you start the session - teran
  • @ Dima Perilman, read the basics: phpfaq.ru/sessions You start a session, it generates a session, puts the session ID in a cookie, you work with it through $_SESSION . Repeat request restores the session by the received ID (if it is changed, that's okay, just the old session will die, then puff it will erase it) and voila :) - user207618