简体   繁体   English

如何防止已登录的用户从CMS的php脚本中删除其用户名?

[英]How to prevent a logged in user from deleting his or her username from php script in a CMS?

I am working on creating a CMS, and I would like to know the best approach to prevent logged in user to delete his or her username when deleting users from a php script. 我正在创建CMS,我想知道防止从php脚本删除用户时登录用户删除其用户名的最佳方法。

The way I handled this before was to compare the userID in the session and the user to delete, if they don't match then delete the user. 我之前的处理方式是比较会话中的userID和要删除的用户,如果它们不匹配,则删除该用户。 Is this approach is okay? 这种方法可以吗? is there a better way to do that? 有更好的方法吗?

I am not looking for code... just some tips. 我不是在寻找代码...只是一些技巧。

从交互设计的角度来看,当您显示当前用户时,完全禁用/隐藏“删除”按钮可能是有意义的。

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

相关问题 PHP:如何通过IP地址查明某人是否来自美国? - PHP: How do I find out if someone is from the US from his/her IP Address? 如何通过用户名,头像和消息在页面/帖子上按用户名列出特定用户/订户? - how to list specific user/subscriber by username with his/her avatar and with a message on a page/post? PHP:如何防止会话仍在用户仍然登录时过期 - PHP: How to prevent session from expiring while user is still logged in 从自定义 URL 获取用户名时,LARAVEL 中是否可以将用户标记为已登录? - Is it possible in LARAVEL to tag a user as logged in when getting his username from a custom URL? 显示用户发表的帖子(如果该用户是他/她的PHP朋友) - Displaying posts made by a user if that user is his/her friend with PHP 当用户通过PHP更新状态时,如何在mysql中删除多余的行 - How to delete extra rows in mysql when a user updates his/her status via PHP 向在 php 中输入他/她的详细信息的用户发送电子邮件 - send email to user also who is inputting his/her details in php 根据他/她的积分数获取用户级别PHP - Get user level depending on his/her points number PHP 如果用户的状态为非活动状态,则阻止用户登录 - Prevent user from logging in if his status is inactive SonataAdmin:阻止管理员删除自己的帐户 - SonataAdmin: Prevent Admin From Deleting His Own Account
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM