且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Javascirpt中的登录页面和安全性

更新时间:2023-12-04 18:16:10

Gday伴侣.

听起来您只是在做一个家庭项目,输入东西-即所有位于同一建筑物/住宅中的机器-不能从外界访问的东西.
无论哪种情况,实际上都是您需要Web服务器(软件)为其提供的东西.这样,您就可以在服务器上放置文件"home.html"(或其他等效文件).当请求时,服务器将对其进行检查并执行其中的任何代码,然后再将结果返回给请求者(通常是Web浏览器).

话虽如此,对(1)的答案是设置当前窗口的位置,而不是打开一个新窗口.您可以通过设置window.location来执行此操作,而不是使用window.open.

我对问题(2)的回答是下载XAMPP,然后做一个登录页面教程.然后,您的用户名/密码将被提交到Web服务器上的页面,该页面将在将其传递到主文件或重新加载登录页面之前检查其有效性.由于您在home(.html)页面上有活动代码,因此可以检查用户是否登录.如果没有,请不要输出任何相关页面.

这就提出了另一点-任何具有登录页面链接的人都可以查看其源代码.完成后,将显示每个人的密码/用户名.这真的不是一个很好的系统..

您可以在此处获取XAMPP: http://www.apachefriends.org/en/xampp-windows.html [ ^ ]
这是一个看起来不错的口吻: http://www.phpeasystep.com/phptu/6.html [^ ]
Gday mate.

Sounds like you''re just doing a home-project, type thing - i.e all machines in same building/residence - not something to be accessed from the outside world.
In either case, it''s really something that you need a webserver(software) for. That way, you have the file ''home.html'' (or another equivalent file) sitting on the server. When it''s requested, the server examines it and executes any code in it before returning a result to the requester (usually a web-browser).

With that said, the answer to (1) is to set the location of the current window, rather than opening a new one. You can do this by setting window.location, instead of using window.open.

My answer to question (2) would be to download XAMPP then do a login-page tutorial. Then, your users'' names/passwords will be submitted to a page on the web-server that checks their validity before passing them on to the main file, or reloading the login page. Since you''ve got active code in the home(.html) page, you can check if the user is logged in or not. If not, just don''t output any of the concerned page.

This brings up another point - anyone with a link to the login page can view it''s source. When this is done, the passwords/usernames for everyone will be visible. This is really not such a good system..

You can get XAMPP here: http://www.apachefriends.org/en/xampp-windows.html[^]
Here''s a tute that looks good: http://www.phpeasystep.com/phptu/6.html[^]


看看这个问题 [ ^ ]以及其中的链接.

它将向您解释与此有关的一些问题.

祝你好运!
Take a look at this question[^] and the links that are in it.

It will explain you some concerns related to it.

Good luck!