简体   繁体   English

如何使用此PHP登录设置修复too_many_redirects

[英]How to fix too_many_redirects with this PHP login set up

I have a web server running LAMP. 我有一个运行LAMP的Web服务器。 I have the website tbg.robotpidgeon.com set up to run the PHP login system that I copied from here ( https://www.tutorialrepublic.com/php-tutorial/php-mysql-login-system.php ). 我将网站tbg.robotpidgeon.com设置为运行我从这里复制的PHP登录系统( https://www.tutorialrepublic.com/php-tutorial/php-mysql-login-system.php )。

Very basic login system using MySQLi. 使用MySQLi的非常基本的登录系统。

In my apache2 config file for this web address, I have set up the virtual host and pointed it to where the PHP files are located. 在我的这个Web地址的apache2配置文件中,我已经设置了虚拟主机并将其指向PHP文件所在的位置。 However, when you go to the above address it generates an index of the PHP files. 但是,当您转到上述地址时,它会生成PHP文件的索引。

When I try to set up the virtual host to land on the login or welcome page I get a too_many_redirects error. 当我尝试将虚拟主机设置为登陆或欢迎页面时,我收到了too_many_redirects错误。 So I am assuming that I have created a loop when I set the virtual host document root to a specific PHP file? 所以我假设我在将虚拟主机文档根设置为特定的PHP文件时创建了一个循环?

What should I do so that when I go to the above address it goes to the login/register page? 我该怎么办,当我转到上述地址时,它会进入登录/注册页面?

The browser is stopping you from hammering the server with a bunch of requests. 浏览器阻止您通过一堆请求来锤击服务器。 This is most likely due to the header() sending you to a page which in turn sends you to the same page (or page with the same header() ). 这很可能是由于header()将您发送到页面,而该页面又将您发送到同一页面(或具有相同header() )。

In your session.php you have to destroy the session because it might be set still but without that the query can find a existing user? 在你的session.php中,你必须销毁会话,因为它可能仍然设置但如果没有,查询可以找到现有用户?

To unset sessions do this: 要解开会话,请执行以下操作:

unset(); for all the session variables unset($_SESSION['login_user']); 所有会话变量未unset($_SESSION['login_user']); for a specific session 对于特定的会话

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

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