title: How to secure User ID inside cookie value
body: <p>After logined user, I keep user ID inside cookie ($_COOKIE['user_id']) and after this mysql check if isset user_id inside cookie and if user_id is exists in DB:</p>
  
  <pre><code>SELECT * FROM users WEHERE user_id = '$_COOKIE[user_id]'
  </code></pre>
  
  <p>It works, but cookie value can be changed by every cliend, so client can set cookie user_id to 1 or 2,3,4 and it will be loggined, So they can hack page.</p>
  
  <p>I want to hash or secure somehow my cookie user_id value. I hope you understand me.
  Can you give me any suggestions?</p>