Job - fix php "includes" on page
Moderator: General Moderators
Job - fix php "includes" on page
I don't know much of anything about php really if you visit my site here:
http://www.bp-grafix.net/sitebuilder/page.php?id=1
You'll see the error:
Warning: main(.html): failed to open stream: No such file or directory in /home/bpgrafix/public_html/sitebuilder/page.php on line 118
Warning: main(): Failed opening '.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/bpgrafix/public_html/sitebuilder/page.php on line 118
---
It's just simple php includes but it isn't working, I think the script is correct just the php on the server. Here is my servers phpinfo:
http://www.bp-grafix.net/sitebuilder/test.php
I made the page.php page a zip file so you can download it and see the php script here:
http://www.bp-grafix.net/sitebuilder/page.zip
If someone can fix this for me I'll pay $50 minimum, thanks. View my profile for contact methods.
http://www.bp-grafix.net/sitebuilder/page.php?id=1
You'll see the error:
Warning: main(.html): failed to open stream: No such file or directory in /home/bpgrafix/public_html/sitebuilder/page.php on line 118
Warning: main(): Failed opening '.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/bpgrafix/public_html/sitebuilder/page.php on line 118
---
It's just simple php includes but it isn't working, I think the script is correct just the php on the server. Here is my servers phpinfo:
http://www.bp-grafix.net/sitebuilder/test.php
I made the page.php page a zip file so you can download it and see the php script here:
http://www.bp-grafix.net/sitebuilder/page.zip
If someone can fix this for me I'll pay $50 minimum, thanks. View my profile for contact methods.
Code: Select all
<?php
if(phpversion() >= 4.2){
include($_SERVER[DOCUMENT_ROOT]."$id.html");
} else {
include($DOCUMENT_ROOT."$id.html");
}
?>Code: Select all
<?php
$id = $_GET['id'];
if(phpversion() >= 4.2){
include($_SERVER['DOCUMENT_ROOT']."/$id.html");
} else {
include($_SERVER['DOCUMENT_ROOT']."/$id.html");
}
?>hawleyjr thankyou for the suggestion but
doesn't work.
also include("$id.html"); doesn't work, i think theres something going on with the php on the server thats why i posted the location to the phpinfo.
Code: Select all
<?php
$id = $_GET['id'];
if(phpversion() >= 4.2){
include($_SERVER['DOCUMENT_ROOT']."/$id.html");
} else {
include($_SERVER['DOCUMENT_ROOT']."/$id.html");
}
?>also include("$id.html"); doesn't work, i think theres something going on with the php on the server thats why i posted the location to the phpinfo.
lol, I answered my own question. Yes there is.
*The page we are talking about is probably not suitable for most work networks....
Your warning is main(.html) not main(1.html)
For testing reasons try this:
*The page we are talking about is probably not suitable for most work networks....
Your warning is main(.html) not main(1.html)
For testing reasons try this:
Code: Select all
include("1.html");
and
include($_SERVER['DOCUMENT_ROOT']."/1.html");Code: Select all
include("1.html");works
Code: Select all
include($_SERVER['DOCUMENT_ROOT']."/1.html");gives error:
Warning: main(/home/bpgrafix/public_html/1.html): failed to open stream: No such file or directory in /home/bpgrafix/public_html/sitebuilder/page.php on line 116
Warning: main(): Failed opening '/home/bpgrafix/public_html/1.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/bpgrafix/public_html/sitebuilder/page.php on line 116
What does this produce:
Code: Select all
echo '<HR><PRE>'; print_r($_GET); echo '</PRE>';when i add
this comes up:
--------------------------------------------------------------------------------
Array
(
)
Code: Select all
echo '<HR><PRE>'; print_r($_GET); echo '</PRE>';--------------------------------------------------------------------------------
Array
(
)
Should be:
Thats what I'm seeing:
http://www.bp-grafix.net/sitebuilder/page.php?id=1
Code: Select all
Array
(
[id] => 1
)http://www.bp-grafix.net/sitebuilder/page.php?id=1
Replace all of your PHP code with the following:
Code: Select all
if(file_exists($_GET['id'] . '.html')) {
include($_GET['id'] . '.html';
}else{
echo 'File ' . $_GET['id'] .'.html Does Not Exist';
}i did that im gettin error:
Parse error: parse error, unexpected ';' in /home/bpgrafix/public_html/sitebuilder/page.php on line 118
link 118 is:
i removed the ';' but then says:
Parse error: parse error, unexpected '}' in /home/bpgrafix/public_html/sitebuilder/page.php on line 118
Parse error: parse error, unexpected ';' in /home/bpgrafix/public_html/sitebuilder/page.php on line 118
link 118 is:
Code: Select all
include($_GET['id'] . '.html';Parse error: parse error, unexpected '}' in /home/bpgrafix/public_html/sitebuilder/page.php on line 118
Code: Select all
include($_GET['id'] . '.html');