Follow us on Twitter!
Society leans ever heavily on computers, if you have the power to take out computers you can take out society. - cubeman372
Monday, April 21, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 27
Guests Online: 27
Members Online: 0

Registered Members: 82852
Newest Member: sockpuppets
Latest Articles
View Thread

HellBound Hackers | Computer General | Webmasters Lounge

Author

include_once problems


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 02-10-08 22:51
Hi all,

Im working on a website, and im having some problems with the include system. I take (and clean) the page variable, and can echo the results to the page just fine. I can also include and include_once the page fine, but when I try and add or die() at the end, I get this error:

Warning: include_once(1) [function.include-once]: failed to open stream: No such file or directory in /home/freehost/t35.com/p/r/projectvault/index.php on line 23

Warning: include_once() [function.include]: Failed opening '1' for inclusion (include_path='.:/usr/local/lib/php') in /home/freehost/t35.com/p/r/projectvault/index.php on line 23

I think its evaluating it as an or statement, but I dont know why the $page variable is being affected. Here is the code:

Code

<?php
        if(isset($_GET['page'])) {
            $page = "./".ficlean($_GET['page']).".php";
            include_once($page) or die();
        } else {
            include_once("main.php");
        }
        ?>





Any ideas?




Edited by on 02-10-08 22:51
Author

RE: include_once problems


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 02-10-08 23:36
Edit - Just do this:


if (isset($_GET['page'])
{
$page = "./".ficlean($_GET['page']).".php";
}

if ($page && file_exists($page))
{
include_once($page);
}
else
{
include_once($otherInclude);
}





Edited by on 02-10-08 23:40
Author

RE: include_once problems


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 03-10-08 00:26
Thanks, I guess il have to do it the long way, Im still curious as to why this is happening though. Might it be a bug in the PHP version? Its a t35 site, so I would have thought it would be fine.


Author

RE: include_once problems


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 03-10-08 00:43
Just noticed... it looks like your script is reading the $_GET['page'] as being equal to 1. Are you sure that your GET variable is being entered / parsed correctly?