Join us at IRC!
One mans freedom fighter, another's terrorist.
Thursday, May 24, 2012
Navigation
Members Online
Total Online: 38
Web Spiders: 17
Guests Online: 36
Members Online: 2

Registered Members: 70189
Newest Member: CrownClown
Latest Articles
View Thread

HellBound Hackers | Computer General | Webmasters Lounge

Author

include_once problems

jjbutler88
Colemak User



Posts: 590
Location:
Joined: 22.04.07
Rank:
Guru
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:


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


Any ideas?




Edited by jjbutler88 on 02-10-08 22:51
http://soundcloud.com/altimeter
Author

RE: include_once problems

Zephyr_Pure
Member



Posts: 2402
Location:
Joined: 15.09.06
Rank:
God
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);
}



I still check PMs from time to time.




Our responses were moronic, why shouldn't he follow suit? - Futility

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

RE: include_once problems

jjbutler88
Colemak User



Posts: 590
Location:
Joined: 22.04.07
Rank:
Guru
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.


http://soundcloud.com/altimeter
Author

RE: include_once problems

Zephyr_Pure
Member



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


I still check PMs from time to time.




Our responses were moronic, why shouldn't he follow suit? - Futility
Guest
Username

Password

Remember Me


Bookmark This Page
Affiliates
Adverts

 

 

Links
By using, viewing or obtaining any information contained on this site, you agree to the disclaimer.

© HellBound Hackers 2008- 2009. Since 3rd December 2004.