php - how to use session ids for authentication purpose -


i using session variables $_session['user_id'] , $_session['passwd'] store id , password of user once when logs in.

i checking these 2 variables database each time user moves new php page authentication. didnt know session_id() .

i dont think doing authentication right way. feel there done session_id security stuff.

and 1 more doubt- can these session variables hacked when use session variables way mentioned

what should do?

an attacker cannot change or read $_session variables, long there no other vulnerability present, general bad practice store password longer necessary on server several reasons.

it sufficient check password once when user logs in. afterwards need store authenticated user_id in session. have know session belongs to, grant necessary permissions specific user. know user submitted correct password, otherwise wouldn't have stored user_id in session in first place.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -