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]

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.