[英]XAMPP only lets me connect to index.php and not other pages
I have XAMPP working just fine on one computer. 我的XAMPP在一台计算机上工作正常。 Then I installed it on another and using the same files I have the following issue.
然后,我将它安装在另一个文件上,并使用相同的文件,但遇到以下问题。
localhost:82 brings up the index.php file (and actually is able to redirect to index3.html as it should). localhost:82会打开index.php文件(并且实际上能够重定向到index3.html)。 I enter my password there and normally it will then redirect me to localhost:82/home.php (and it does on my other computer) but on this one, it takes about 10 seconds of waiting, then I get a connection err page from chrome and IE.
我在那里输入密码,通常它将把我重定向到localhost:82 / home.php(并且在另一台计算机上也可以),但是在这台计算机上,它需要大约10秒钟的等待时间,然后从chrome和IE。 I noticed that this is caused by XAMPP apache server going yellow briefly at this point before returning to green status.
我注意到这是由XAMPP apache服务器在返回绿色状态之前暂时变为黄色引起的。
I can't connect to localhost:82/home.php directly either. 我也无法直接连接到localhost:82 / home.php。 I get the same error.
我犯了同样的错误。
I have this at the start of each .php page. 我在每个.php页面的开头都有这个。 Removing it did not solve the problem.
删除它并不能解决问题。
<?php
session_start();
//Check to make sure the person is loggedin
if (isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] == true) {
//if logged in then do nothing
} else {
//if not logged int he redirect to the login page
header("Location: http://localhost:82/index2.php");
}
?>
It works just fine on my first computer, what is going on here? 它在我的第一台计算机上运行正常,这是怎么回事?
============================ ===========================
EDIT: HERE IS THE CODE THAT IS ON MY INDEX.PHP 编辑:这是我的INDEX.PHP上的代码
<?php
//Connect to a database
$host_name = "localhost";
$database = "db608008888";
$user_name = "ABC";
$password = "123";
$connect = mysqli_connect($host_name, $user_name, $password, $database);
//Take the values from the html form and assign them to variables
$ID = $_POST['name'];
$userpassword = $_POST['password'];
//If no passsowrd entered then go straight to index.php
echo "<script type='text/javascript'>alert($userpassword);</script>";
if ($userpassword == null) {
header("Location: http://localhost:82/index3.php");
die();
}
//Check to see if the password matches the hashes
if (md5($userpassword) === '5b5c45f1b9e444d9e441211cfb325270'
or md5($userpassword) === '17434cf0d4ba816cd776ff8b0ec532f1'
or md5($userpassword) === '7a94fda2a6e81a1693533e6dc8501b37'
or md5($userpassword) === '2d8b2ba14eeb0ac1fe474d468b720771')
{
//Add the visitor name to our list
mysqli_query($connect, "INSERT INTO `visitor list` (`Visitor Name`) VALUES ('$ID')") or die("Error in INSERT: ".mysqli_error($connect));
// Start the session so they can access other pages
session_start();
$_SESSION['loggedIn'] = true;
// Redirect them to rest of site
header("Location: http://localhost:82/home.php");
die();
}
else {
header("Refresh: 0; url=index2.php");
echo "<script type='text/javascript'>alert(\"Wrong Password. .\");</script>";
}
?>
Open apache's configuration file using your favorite text editor. 使用您喜欢的文本编辑器打开apache的配置文件。 The configuration file generally locates at:
配置文件通常位于:
{apache_dir}/conf/httpd.conf
If you are using XAMPP or WAMP package then you will find the file at: 如果您使用的是XAMPP或WAMP软件包,则可以在以下位置找到文件:
{xampp_dir}/apache/conf/httpd.conf
{wamp_dir}/apache/conf/httpd.conf
Search for the following string: 搜索以下字符串:
#LoadModule rewrite_module modules/mod_rewrite.so
and uncomment it (remove the '#' sign). 并取消注释(删除“#”号)。 Now search for another string AllowOverride None and replace it by AllowOverride All
现在搜索另一个字符串AllowOverride None并将其替换为AllowOverride All
Restart Apache ! 重新启动Apache!
Done 完成
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.