简体   繁体   English

专用login.php页面vs index.php检查登录数据

[英]Dedicated login.php page vs index.php checking for login data

Okay, so I'm not 100% sure what the best way to implement this is. 好的,所以我不能100%确定实现这个的最佳方法是什么。 I want to create my own little webapp that requires a login to work. 我想创建自己的小webapp,需要登录才能工作。 I know how to authenticate, that's not the problem. 我知道如何进行身份验证,这不是问题所在。

Either my index page redirects to a login.php page and allows you to log in then redirects you back to index or the index page detects that you're not logged in and instead of redirecting you, takes it upon itself to print a login form instead of the main content. 我的索引页面重定向到login.php页面并允许您登录然后将您重定向回索引或索引页面检测到您没有登录而不是重定向您,自己打印登录表单而不是主要内容。 Not sure if that's clear. 不确定这是否清楚。

What are the advantages/disadvantages of each. 每种方法的优点/缺点是什么?

Thanks in advance! 提前致谢!

(I'm thinking of using OpenID but forget about that for now, I'm just curious about what the best way to implement a login system from scratch is, with a separate page or everything in the index) (我正在考虑使用OpenID,但暂时忘记了这一点,我只是好奇从头开始实现登录系统的最佳方法是,使用单独的页面或索引中的所有内容)

I prefer to have the login form on the front page, it's one less step for your frequent users to take to use your app. 我更喜欢在首页上显示登录表单,这是您经常用户使用您的应用程序的一小步。

However, it is also beneficial to have a separate, clutter-free login page for when incorrect login credentials are provided. 但是,如果提供了不正确的登录凭据,则有一个单独的,无杂乱的登录页面也是有益的。 That way, your users can easily identify what went wrong and not have all the distractions commonly associated to webapp front pages. 这样,您的用户就可以轻松识别出错的地方,并且没有通常与webapp首页相关的所有干扰。 IE error messages should be very obvious and don't have to take away from what's going on over on the front page. IE错误消息应该非常明显,不必消除首页上发生的事情。 They can have their own space on a separate login page. 他们可以在单独的登录页面上拥有自己的空间。

Check out facebook for example: they have a pretty good implementation of what I am describing. 以facebook为例:他们对我所描述的内容有很好的实现。

Does the index page have to be behind a login-wall? 索引页面是否必须位于登录墙后面? Because, if so, either way you're going to end up hiding it from google, et al. 因为,如果是这样,无论哪种方式,你最终都会把它隐藏起来,谷歌等等。

Generally speaking, though, I think it's much cleaner to have the login page at a separate URL. 不过一般来说,我认为将登录页面放在一个单独的URL上会更清晰。 If for no other reason than viewing your server log / analytics and being able to determine how many people viewd the home page vs. how many viewed the login form. 除了查看您的服务器日志/分析之外没有其他原因,并且能够确定查看主页的人数与登录表单的查看次数。

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

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