English 中文(简体)
如何在实验室中保存物体数据?
原标题:Best way to save object s data in php?

我正试图在营地建立系统标识。 我有3份档案。 指数.php,login.class.php (defineslogin category),securityPage.php。

伐木类具有不同的功能,如UserName()、AddUser()等。

指数。 php创立了一个新 $子,其形式为标志,并创建了一个新的账户表。

When you create an account on the index.php page, $login->addUser($username, $password, $first_name, $last_name, $email); function executes which creates a new account.

在您登录和点击之后,文字检查了用户名/密码/名称,并指示你确保Page.php。

之后,我从原木阶级.php转而安全。 我不敢肯定,如果用户有正确的记录,而且所有用户都有信息手,那么检查的最佳方式是什么。

Right now my securePage.php creates a new login object $login = new Login; and checks if the user has access to the page by calling checkAccess within the Login class.

页: 1 如果用户能够进入该网页,则改用日志

if($login->checkAccess()) {
   //blah blah blah
}

检查工作如何在Login级进行。

public function checkAccess() {

    // check the session access
    if(isset($_SESSION[ username ]) ) {
        //
        return true;
    }

}

I feel this is bad implementation because a) I create a brand new login object and lose my data b) I only check if the session is secure by checking if session s username is set which can be probably faked.

什么是执行安全方案的最佳途径。 php涉及是否仍然有所有用户数据,以及是否对用户进行了记录?

最佳回答
问题回答

Your session is stored server side, and thus is a good way to check for a login status. There are some issues like f.e. account sharing but they shouldn t be a problem for the application you are developing.

I wouldn t be checking on the username though, I d add a key called authorised or something. also I d call the function isAuthorised instead of checkAccess, as checkAccess would indicate using user roles/rights to me.





相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Remotely authenticating client Windows user on demand

Suppose I am writing a server for a particular network protocol. If I know that the client is running on a Windows machine, is it possible for my server to authenticate the Windows user that owns the ...

Role/Permission based forms authorizing/authentication?

While looking into forms authorizing/authentication, I found that it is possible to do role based authorizing by adding an array of roles to a FormsAuthenticationTicket. That way I can write User....

热门标签