Jump to content

failed to open stream error help


svgmx5

Recommended Posts

having this problem where i keep getting the 'failed to open stream' error.

 

The site is a membership type website, and this is happening on the members section. I managed to pinpoint the problem to only happen when the $_SESSION variable is in use.

 

Here's the error i keep getting

Warning: require(.php) [function.require]: failed to open stream: No such file or directory in /home/content/t/h/e/thereferralpro/html/standard/index.php on line 85

Fatal error: require() [function.require]: Failed opening required '.php' (include_path='.:/usr/local/php5/lib/php') in /home/content/t/h/e/thereferralpro/html/standard/index.php on line 85

 

 

I'll post the code below so you guys can see it and see what i'm doing wrong, even though i'm using this same exact strip of code in 3 other directories, and i haven't had a problem with them.

<?php
       //this is the code that is at the very top of the index.php page above the <html> tag

        //as soon as i remove this batch of code below it works
       //begin code removal
session_start();
if($_SESSION['standard']==TRUE){
	require('../account/scripts/php/config.php');
	$memberID = $_SESSION['memberID'];

	$sql = "SELECT * FROM members WHERE memberID='$memberID'";

	$run = mysql_query($sql) or die(mysql_error());
	$num = mysql_num_rows($run);

	while($fetch = mysql_fetch_assoc($run)){
		$memberID = $fetch['memberID'];
		$email = $fetch['memberEmail'];
		$membership = $fetch['membership'];
	}
//end code removal

                //this gets the pages and loads them as index.php?page=thepage
	if(isset($_GET['page'])){

		$page=array("account", "project", "sale", "profile", "resume", "referral");

		if(in_array($_GET['page'], $page)) {

			$_page=$_GET['page'];

		}else{

			$_page="account";

		}

	}else{

		$_page="account";

	}
}
?>

//line85
<?php require($_page.".php"); ?>

 

If someone can help me, I've looked it over and all the files are named properly, since that is usually the problem

 

Link to comment
https://forums.phpfreaks.com/topic/204021-failed-to-open-stream-error-help/
Share on other sites

There doesn't seem to be a page getting called

	

if(isset($_GET['page'])){










$page=array("account", "project", "sale", "profile", "resume", "referral");














if(in_array($_GET['page'], $page)) {


















$_page=$_GET['page'];
















}else{
















$_page="account";














}












}else{














$_page="account";










}



}
?>

//line85
<?php require($_page.".php"); ?>

I tried this chunk of code and there was an extra bracket at the end - when i removed it and echoed $page i got account - which seems right - I might be missing something if there is more code before hand!

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.