today i finished programming my project. and now i'm trying to find somebugs in my codes. i realize that when i want to change my info (like users) i can edit my user id from tamper data (ad-don to change header data) and i can change my level (from user to admin) via tamper date :/ this code i use for setting cookie
setcookie('level',$login['level'],time()+120*120*48); setcookie('username',$login['username'],time()+120*120*48); setcookie('uid',$login['uid'],time()+120*120*48); i use $_COOKIE['uid'] when users try to add comment its come on database just a number (you know that)
and i want to give you this code i use it to start session and start in it every file.
include("cookiesset.php"); ob_start(); session_start(); if($_COOKIE['level'] != 1){ ... }else{ ... } and this is cookie i have in header
uid=1; level=1; username=asd; PHPSESSID=ldr48bua487pjmtvohp53tr662; LoginForm=r9imqbnj2csfrmsu50i9kn0q54 ok how i can fix it ? i want to secure my website.
if there is no solution i want to ask.
sha256('really_big_big_random_string'), stores that value in a database so you can do something like: [key][uid][level][username] in the table (columns) select from that table where the key is the cookie value and then, get the results, so you don't show any important value in the cookie but with fetching them from a table is a little more secure.