![]() |
form for logged user
Hi Friends,
Im a newbie here . Just wanted to clear some of my doubts ... i am working with a site where the logged user can edit something ... ie; a form should be shown only for logged users.. should i use iframes or just show the php file checking session ...Expecting valuable advice and thanks in advance Anoop |
Just create a function (like isLoggedIn()) returning true or false. In that function check the session and maybe some more proof to be 100% sertain the user is logged in.
Something like this will be the result: PHP Code:
|
Perhaps having a peruse over this script that I did may be of some use to you?
|
Yesterday I've written this function to check whether a user is logged in or not:
Users have options to save their login in a cookie, so that they don't have to fill the login form back in again. A cookie is stored like: 'username;sha1hashedpasswordwithoutsalt'. PHP Code:
PHP Code:
|
Even if it's hashed with a salt, never save a password in a Cookie.
|
I think you are true on that. What's a better way to store a cookie (and to check if it's from a real logged in user)?
|
What i always do is make an SQL table:
id - ipadres - userid - uniquestring 1 - 127.0.0.1 - 1 - bvt54345bw45herw45vw45wgef And save a cookie named "login" or something containing the uniquestring. Then check the table for a record containing the uniquestring and ipadres. And then if its found login the user since you have it's userid. Although i use this for autologin, you can also check it for login validation. |
Yep that's definitely a better route to go. Well, I think anoopd should be able modify my script to make it work like that. If not, I will post an update later.
Thanks for keeping me sharp, Jim! |
| All times are GMT. The time now is 03:23 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0