开发者

PHP Warning [function.include]: failed to open stream

http://smiths-heimann.az/index.php?feat=1 please check out this page. My php code looks like that.

<?php 
/*at the top of the page*/
if (!isset($feat)){
if (isset($_GET['page'])) 
{
    $page=$_GET['page'];
    }   
if (!isset($_GET['page']) && !isset($_GET['feat'])) 
{
    $page=1;
    }       
${'page'.$page}='class="current"';
}
    if (isset($_GET['feat']) && !isset($_GET['page']))
    {
    $feat=$_GET['feat'];
    }
....
/*content*/

        if(isset($page) && isset($_GET['id']) && !isset($_GET['subid']))
        include "core/content/pages/".$page.$_GET['id'].".php";
        if(isset($page) && isset($_GET['id']) && isset($_GET['subid']))
        include "core/content/pages/".$page.$_GET['id'].$_开发者_StackOverflow社区GET['subid'].".php";
        if(isset($page) && !isset($_GET['id']) && !isset($_GET['subid'])) 
        include "core/content/pages/".$page.".php";  /*line 136*/
        if (isset($feat) && !isset($_GET['page']))
    {
    $feat=$_GET['feat'];
    include "core/content/pages/featured.php";
        } 
        ?>

What's the problem? Please help


If you have looked in your warning, then it says that unable to find

Warning: include(core/content/pages/class="current".php) [function.include]: failed to open stream: No such file or directory in /home/heimann/public_html/index.php on line 136

page..

I am sure there is no such page like class="current".php ....

little bug .. I am sure you can eliminate it easily

error lies on

${'page'.$page}='class="current"';

line


Read the rest of the error on your website:

No such file or directory

The path or the filename is incorrect. It looks like the problem is with this line:

${'page'.$page}='class="current"';


REPLACE

        if(isset($page) && isset($_GET['id']) && !isset($_GET['subid']))
        include "core/content/pages/".$page.$_GET['id'].".php";
        if(isset($page) && isset($_GET['id']) && isset($_GET['subid']))
        include "core/content/pages/".$page.$_GET['id'].$_GET['subid'].".php";
        if(isset($page) && !isset($_GET['id']) && !isset($_GET['subid'])) 
        include "core/content/pages/".$page.".php";  /*line 136*/

WITH

        if(isset($page) && isset($_GET['id']) && !isset($_GET['subid']))
        @include "core/content/pages/".$page.$_GET['id'].".php";
        if(isset($page) && isset($_GET['id']) && isset($_GET['subid']))
        @include "core/content/pages/".$page.$_GET['id'].$_GET['subid'].".php";
        if(isset($page) && !isset($_GET['id']) && !isset($_GET['subid'])) 
        @include "core/content/pages/".$page.".php";  /*line 136*/

NOTE

When 'isset($_GET['id'])' is true... You should make sure that $page is set properly


I solved it

Replaced

/*at the top of the page*/
if (!isset($feat)){
if (isset($_GET['page'])) 
{
    $page=$_GET['page'];
    }   
if (!isset($_GET['page']) && !isset($_GET['feat'])) 
{
    $page=1;
    }       
${'page'.$page}='class="current"';
}
    if (isset($_GET['feat']) && !isset($_GET['page']))
    {
    $feat=$_GET['feat'];
    }

with

if (!isset($feat)){
if (isset($_GET['page'])) 
{
    $page=$_GET['page'];
    ${'page'.$page}='class="current"';
    }   
if (!isset($_GET['page']) && !isset($_GET['feat'])) 
{
    $page=1;
    ${'page'.$page}='class="current"';
    }       

}
    if (isset($_GET['feat']) && !isset($_GET['page']))
    {
    $feat=$_GET['feat'];
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜