简体   繁体   中英

Compare User ID's and display a different output if they don't match?

I'm making a profile system and I've appeared to of hit a brick wall, I need to make it so if a user who's logged in is viewing their own profile then they'll have other options such as changing their profile picture, but if somebody else is logged in and is viewing somebody else's profile then the output for the profile will be different, just like Facebook or Twitter.

I haven't got any code to show you otherwise I would.

if(md5($_GET['id'])  == $_SESSION['id'])
{
    echo "this is your profile";
}
else
{
    echo "this is not your profile";
}

md5 session on login, not secure but better than saving anything in plain text

on Login: $_SESSION['id'] = md5($id);
$id is from login or database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM