Jump to content

same code works unless it is called index.php


Doug

Recommended Posts

Hello,

 

I have a problem that I cannot, for the life of me, work out. I have a page where I have a login for people to enter certain parts of my website. I would like this to form art of my homepage. It works fine if I call it for example ‘index4.php’ but as soon as I change it to’ index.php’ (so it is the homepage) it stops working. Why would this be? It is exactly the same code only the name has changed

 

I think the problem is in index1.php. I will put the home page and index1.php below.

 

Thanks in advance for any help

 

index.php


<h4>Home</h4>


<?php require_once('index1.php'); ?>
<?php require_once('navmenu.php'); ?>


<div id="newsstories">
<?php require_once('news.php');?>
</div>

<div id="maincontent1">
<?php require_once('poll/phpoll/poll.php');?>

</div>

<div id="mainpics">

<?php require_once('latestpicsmain.php'); ?>
</div>

rest of code...

index1.php
[code]

<?php
  
require_once('appvars.php');
  
require_once('connectvars1.php');

  


?>
<div id="index1">
<?php
if (isset($_SESSION['username'])) {
echo '<a href="viewprofile1.php">View Profile</a>';
  
echo '   '; 
echo '<a href="editprofile3.php">Edit Profile</a>';

  
echo '   '; 
echo '<a href="addcontent.php">Add Content</a>';
//echo '&#10084; <a href="logout3.php">Log out (' . $_SESSION['username'] . ')</a>';
}
?>
</div>
<?php
// Connect to the database 
  
$dbc = mysqli_connect(DB_Host, DB_User, DB_Password, DB_Name); 

  

// Retrieve the user data from MySQL
  
$query = "SELECT * FROM registration WHERE first_name IS NOT NULL";
  
$data = mysqli_query($dbc, $query);


mysqli_close($dbc);

?>
</body> 
</html>

[/code]

 

Which server are you using?

 

By default, whichever server it is, when u call your domain it will search for index.html, index.htm, index.php or login.php.

 

But since you say that when u change it to index.php your file is not fetched then you may have to check your server configuration.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.