Jump to content

PHP Include not working


xf220

Recommended Posts

The website is http://www.grlistingservices.com

 

The code block is as follows:

 

<?php
if (!isset($id))
{
include 'home.php';
}
else
{
include "$id.php";
}
?>

 

All files are in the same directory, I am running php5.x on a windows server with GoDaddy.

This website used to work at my hold host, I just switched it today.

Link to comment
https://forums.phpfreaks.com/topic/190173-php-include-not-working/
Share on other sites

The website is http://www.grlistingservices.com

 

The code block is as follows:

 

<?php
if (!isset($id))
{
include 'home.php';
}
else
{
include "$id.php";
}
?>

 

All files are in the same directory, I am running php5.x on a windows server with GoDaddy.

This website used to work at my hold host, I just switched it today.

 

you tried using the double quote?

 

"home.php"

 

also you have to concatenate the variable with .php

 

include "".$id.".php"; that may work..., i havent tried it...

 

or even

include $id.".php";

I apologize, I had different code running from trying to solve my problem, I put the original code back in.

Again so you do not have to scroll up.

<?php
if (!isset($id))
{
include 'home.php';
}
else
{
include "$id.php";
}
?>

 

This code includes home.php correctly. When you click a link, it doesnt change the page included.

index.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<title>GRListing Services-</title>

<meta name="keywords" content="GRListing Services, Real Estate Listings, Real Estate, WNY, Buffalo, Property Staging ">

<meta name="description" content="Property/real estate staging and preparation in Western NY.">

<link rel=stylesheet href="styles.css" type="text/css" />

</head>

<body>

<table width="864" align="center" cellpadding="0" cellspacing="0" border="0" class="main">

<tr>

		<td class="green" align="right">GRListing Services - Williamsville, New York 14221</td>

</tr>

<tr cellpadding="0">

	<td cellpadding="0">

	<img src="images/topheader.png" />

	</td>

</tr>

<tr>

<!-- ==================== LINKS =========================== -->

	<td class="green" align="center">

<table width="100%" cellspacing="0" cellpadding="0" width="center" border="0">

<tr>

	<td align="center"><a href="index.php?id=home">Home</a> </td>
	<td align="center"><a href="index.php?id=services">Services</a></td>
	<td align="center"><a href="index.php?id=contact">Contact</a></td>

</tr>

</table>

	</td>

</tr>

<tr>

	<td> <img src="images/header.png" /> </td>	

</tr>

<tr>

	<td>


<?php
if (!isset($id))
{
include 'home.php';
}
else
{
include "$id.php";
}
?>

	</td>

</tr>

<tr>



<td class="green">
&#169 2010 GRListing Services. All rights reserved.
</td>

</tr>

</table>

</body>

</html>

 

home.php

<table width="100%" cellpadding="5" cellspacing="0" align="center" border="0">

<tr>

<td colspan="2" align="center">

<h2>Let us help you improve the quality of your property!</h2>

</td>

</tr>

<tr>

<td>

<h3>How can we help?</h3>

GRListing Services is committed to helping Western New York sell properties by:

<ul>
<li>New Listing Preperation</li>
<li>Property Clean Up</li>
<li>Property Checks</li>
<li>General Maintainence</li>
<li>Sign Placement and Removal</li>
</ul>

</td>

<td>

<img src="images/forsale.png" align="right" />

</td>

</tr>

<tr>

<td colspan="2">

<center><h2><a href="index.php?id=contact"/> Get started today! </a></h2></center>

<p>GRListing Services is here to help any one sell a property for more! We specialize in prepping properties
for sale so that the seller can earn the most for their property! Not only does GRListing Services advise homeowners and real 
estate agents of how to make the most of a sale, we do the work. The team at GRListing Services is dedicated and ready to help you; 
<a href="index.php?id=contact">contact us</a> today to learn more about what GRListing Services can do for you.</p>

</td>

</tr>

</table>

Take care with including files based on user input. ;)

 

If it weren't for the security restrictions on the account, a user could include anything they wanted on your site. They could still include any PHP file of yours though, including your config file if you have one.

 

http://www.grlistingservices.com/index.php?id=index ;)

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.