Jump to content

[SOLVED] Help with IF else in side the code


divadiva

Recommended Posts

I have this page working fine.Thing is when I enter http://www.agsemiconductor.com/SugarCRM/index.php?entryPoint=removeme&identifier={MESSAGE_ID} I get the webpage.(entry point  defined as removeme)

 

But when I enter http://www.agsemiconductor.com/SugarCRM/index.php?entryPoint=123&identifier={MESSAGE_ID}(entry point  defined as 123)

 

I see a blank page.Whereas it should die I should get You dont have right to view the page.

 

 

<?php

error_reporting(0);

$fileDir = "http://"; // Write an appropriate path name.

$fileName = "index.php"; //Provide a valid file name.

$fileLink ='?entryPoint='.$_GET["entryPoint"].'&identifier='.$_GET["identifier"];//Add the additional links

$fileString = $fileDir.'/'.$fileName.$fileLink;//Append all the links 

if($fileLink = '?entryPoint='.$_GET["entryPoint"].'&identifier='.$_GET["identifier"] && in_array($_GET["entryPoint"], array('removeme','campaign_tracker2','campaign_tracker')))  
{
if(!$fdl=@fopen($fileString ,'r')) 
{
die("You dont have right to view the page!");//For somereason this is not working ???
}
       else
{
$contentType = 'text/html';
header("Cache-Control: ");// leave blank to avoid IE errors
  	header("Pragma: "); // leave blank to avoid IE errors
header("Content-type: $contentType");
  	
    	fpassthru($fdl);
}

}
?>

Thanks fo replying but Die is not working right.Rest everything works. 


error_reporting(0);

$fileDir = "http://67.100.111.140/SugarCRM"; // Write an appropriate path name.

$fileName = "index.php"; //Provide a valid file name.

$fileLink ='?entryPoint='.$_GET["entryPoint"].'&identifier='.$_GET["identifier"];//Add the additional links

$fileString = $fileDir.'/'.$fileName.$fileLink;//Append all the links 

if($fileLink = '?entryPoint='.$_GET["entryPoint"].'&identifier='.$_GET["identifier"] && in_array($_GET["entryPoint"], array('removeme','campaign_tracker2','campaign_tracker')))  
{
if($fdl=@fopen($fileString ,'r'))  

{
$contentType = 'text/html';
header("Cache-Control: ");// leave blank to avoid IE errors
  	header("Pragma: "); // leave blank to avoid IE errors
header("Content-type: $contentType");
  	
    	fpassthru($fdl);
}
else
  	{
die("You dont have right to view the page!");/// Problem is DIE doesnt work I see a blank page and not the die message 
}

}
?>



There was no makor error.I was not closing the IF statement.Thanks all for help though.

 

 

error_reporting(0);

$fileDir = "xyz"; // Write an appropriate path name.

$fileName = "index.php"; //Provide a valid file name.

$fileLink ='?entryPoint='.$_GET["entryPoint"].'&identifier='.$_GET["identifier"];//Add the additional links

$fileString = $fileDir.'/'.$fileName.$fileLink;//Append all the links 

if($fileLink = '?entryPoint='.$_GET["entryPoint"].'&identifier='.$_GET["identifier"] && in_array($_GET["entryPoint"], array('removeme','campaign_tracker2','campaign_tracker')))  
{
if($fdl=@fopen($fileString ,'r'))  

{
$contentType = 'text/html';
header("Cache-Control: ");// leave blank to avoid IE errors
  	header("Pragma: "); // leave blank to avoid IE errors
header("Content-type: $contentType");
  	
    	fpassthru($fdl);
}

             }

else
  	{
die("You dont have right to view the page!");/// Problem is DIE doesnt work I see a blank page and not the die message 
}


?>


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.