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

    评论

报告相同问题?

悬赏问题

  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退