简体   繁体   English

比较用户ID,如果不匹配,则显示不同的输出?

[英]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. 我正在制作个人资料系统,但似乎碰壁了,我需要这样做,如果登录的用户正在查看自己的个人资料,那么他们将拥有其他选择,例如更改个人资料图片,但是,如果其他人登录并正在查看其他人的个人资料,则个人资料的输出将不同,就像Facebook或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 登录时使用md5会话,虽然不安全,但比以纯文本格式保存任何内容要好

on Login: $_SESSION['id'] = md5($id); 登录时:$ _SESSION ['id'] = md5($ id);
$id is from login or database. $ id来自登录名或数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 用户ID与cakephp中的user_id不匹配 - User's ID doesn't match user_id in cakephp 用户名和密码不匹配 Output - Username and Password Don't Match Output 只为与watchedtvshow表中给定用户ID条目不匹配的节目(在tvshow表中)显示一个复选框-Laravel - Displaying a checkbox only for the shows(in the tvshow table) that don't match the entries for a given user id in the watchedtvshow table - Laravel 如果操作包含其他变量,则不匹配 - Don't match if the operation contain different variable 比较字符串,只获取某些不匹配的字符串 - Compare strings and only get certain strings that don't match 索引不匹配时如何比较两个数组 - How to compare two arrays when the indexes don't match 比较php中的两个字符串获取不匹配的字符数? - Compare two strings in php get number of characters that don't match? 为什么我的查询ID和返回ID不匹配? - Why Don't My Queried ID and Returned ID match? 选择不工作的地方-用户ID - Select Where don't work - user ID 我无法显示我的数据。 我可以显示具有特定 ID 的数据。 但我不知道如何在同一页面上显示具有不同 id 的数据 - i'am have trouble to display my data. I can display data with a specific id. but i don't know how to display data with different id on the same page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM