dongmanni6916 2016-01-09 05:05
浏览 184

XAMPP只允许我连接到index.php而不是其他页面

I have XAMPP working just fine on one computer. 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). 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. I noticed that this is caused by XAMPP apache server going yellow briefly at this point before returning to green status.

I can't connect to localhost:82/home.php directly either. I get the same error.

I have this at the start of each .php page. 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

<?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>";

  }
 ?>
  • 写回答

1条回答 默认 最新

  • douyi1084 2016-01-09 05:11
    关注

    Open apache’s configuration file using your favorite text editor. 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_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

    Restart Apache !

    Done

    评论

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能