Jump to content

iframe wont display in i.e


seanfacer@yahoo.co.uk

Recommended Posts

HI im having a problem displaying an image in an iframe or img tag on my php page if i set the source to google it displays fine in the iframe! but if i set the source to a page on my server it doesnt display. It displays in both fire fox and chrome!????

 

Any help would be greatly appreciated

 

Thanks Sean

Link to comment
https://forums.phpfreaks.com/topic/219187-iframe-wont-display-in-ie/
Share on other sites

HI i need to finish this by today and really need help . I have a php page that uses an iframe to show another php page on my server (graphs etc), It works in all browsers except i.e ? I can display the image if i set the source to www.google.com but not if its set to an page on my server ??? if i go to the page directly the image shows ???

 

dd_graphs.php page -

<img class='print' src='http://dnsdash/dd_graphdata1.php' border='0' alt='GraphDisplay' width='$width' height ='$height'>-->
<iframe src='http://dnsdash/dd_graphdata1.php'></iframe>

 

dd_graphdata1.php

 

<?php

mysql_connect("localhost", "dnsdashboard", "sqldash");
mysql_select_db("dddom") or die ("Could not connect to database");

include ("./classes/GoogleChart.php");
include ("./src/common.php");
$session =implode("|",$_SESSION['GraphData']);
$sessionarray = explode("|",$session);

$graphdata['posted'] =$sessionarray['0'] ;
$graphdata['report'] =$sessionarray['1'];
$graphdata['reportType'] = $sessionarray['2'];
// $graphdata['domaincharts'] = $sessionarray['3'];
// $graphdata['growthcharts'] = $sessionarray['4'];
$graphdata['graph'] = $sessionarray['3'];
$graphdata['size'] = $sessionarray['4'];
$graphdata['Graph_Title'] = $sessionarray['5'];
// $graphdata['pieDimension'] = $sessionarray['8'];
// $graphdata['Width'] = $sessionarray['9'];
// $graphdata['Height'] = $sessionarray['10'];
// $graphdata['Left_Margin'] = $sessionarray['11'];
// $graphdata['Right_Margin'] = $sessionarray['12'];
// $graphdata['Top_Margin'] = $sessionarray['13'];
// $graphdata['Bottom_Margin'] = $sessionarray['14'];

if ($_GET['save_graph'] == "true")
{
$graphdata['action'] = "Save";
} else {
$graphdata['action'] = "Display";
}

//global variables
$clid = 3;
$errorarray =array();
$errors =array();
$chartarray = array();
///////////////////////////TOOOOO DOOOOOOOOOOOOO LIST/////////////////////////////////////////////////////
// create a back fill for line graph
// Data for manaaged domains by region is returning the same data every time

// 		function selectBox creates a select dropdown box which you can add as many options to as you want and you can choose the starting value and how much to increment that value by 
// 		@param $name = name of the select box (used to later on post value)
// 		@param $limit = limit you would like select box to reach
// 		@param $increment = value you would like to increment by
// 		@param $firstvalue = numerical value to start on

function selectBox($name, $firstvalue, $limit, $increment,$defaultvalue)
{
$select ="selected";
$body = "<select name='$name' pos='relative' style='width:70px' class='Select' width='100px' id='$name' method='POST'>
			<option value='$defaultvalue'>0</option>";
	for ($value = $firstvalue; $value <= $limit; $value += $increment) 
	{
		$body .= "<option value= '$value'  ";  
			if (isset($_POST["$name"]) && ($_POST["$name"]) == $value)
		{
			$body .= $select;
		} else {
			$body .= "";
		}
		$body .= ">$value</option>";
		}		
			$body .= "</select>";
	return $body;
}

// 		function datarange() checks each value in an array to see if its within a range and returns a message;
// 		@params $array =
// 		@params $firstvalue =firstvalue in the range
// 		@params $lastvalue = lastvalue in the range
// 	

function downloadImage($url) {
$chart = imagecreatefrompng($url);
header('Content-Type: image/png');
header("Content-Disposition: attachment; filename=\"test.png\";\n\n");
imagepng($chart);
imagedestroy($chart);
}

//		function datarange() checksHow many datavalues in an array e.g 0-10 
//		@PARAMS $array = array to check
//		@PARAMS $firstvalue = first value in range
//		@PARAMS $lastvalue =  last value in range

function datarange($array,$firstvalue,$lastvalue)
{
$msg =1;
foreach ($array as $value)
{	
	$range = range($firstvalue,$lastvalue);
	foreach ($range as $key)
	{		
		if ($value == $key)
		{
			return $msg;
		}		
	}
}		
}

//		function checkrange() checks the data values being returned (eg you have 10 data values returned) value is within a range
//		@PARAMS $number = number you wish to check
//		@PARAMS $firstvalue = first value in range
//		@PARAMS $lastvalue =  last value in range
//		@PARAMS $return  = what you would like to return

function checkrange($number,$firstvalue, $lastvalue,$msg)
{
$range = range($firstvalue,$lastvalue);
foreach ($range as $key)
	{	
		if ($number == $key)
		{
			return $msg;
		}
	}
return false;
}

//		function setMargin sets a $setMargin to qa default value if it is not set (post value);
//		@PARAMS $margin is the post value you wish to check
//		@ PARAMS $default = the deafult value you wish to set 

function setMargin($margin,$default)
{
if ($margin ==""){
	$setMargin= $default;
}elseif ($margin !=="")
{
	$setMargin=$margin;
}
return $setMargin;
}
// SELECT STATEMENTS
function growthQuery ($post,$value,$region)
{
global $clid;
	$queryJoin = db_select("dddom", "date, tldregion,tlddeleted,COUNT(*) as total", "dd_client_hist","left join dd_tlds on dd_client_hist.tldid = dd_tlds.tldid", "(clid = $clid) && (tldregion like '%$region%')   group by  date", "", "");
return  $queryJoin;
}
// 		function displayValue() changes the values in the array as some values are to long to display on the graph and returns new array
// 		@param $array = array you wish to check through and change
// 		@param $text1 = text you wish to check for
// 		@param $replacement1 = text you wish to change

function displayValue($array,$text1,$replacement1,$text2,$replacement2,$text3,$replacement3,$text4,$replacement4,$text5,$replacement5)
{
$display = array();
foreach ($array as $key => $value)
{
// 	print_R($value);
	if ($value == $text1)
	{
		$newvalue=$replacement1;
	}elseif ($value == $text2)
	{
		$newvalue=$replacement2;
	}elseif ($value == $text3)
	{
		$newvalue=$replacement3;
	}elseif ($value == $text4)
	{
		$newvalue=$replacement4;
	}elseif ($value == $text5)
	{
		$newvalue=$replacement5;
	}else{
		$newvalue=$value;
	}

$display[] =$newvalue;	
}
return $display;
}


function selected($submit,$post,$value)
{
if ((isset($submit)) && $post == $value)
{
	$selected = "selected";
}else{
$selected= "";
}
return $selected;
}

// 		function displayMonth takes an array of values and changes the data string of each array value into a calnder month and then returns a new array, You need tomake sure the data is in ana array first.
// 		@ Param $array = the array you wish to check

function displayMonth($array)
{	
$calender =array();
foreach ($array as $key => $value)
{
// can change the way it shows the date but try keep it as short as possible for display purposes!
	$substring1 = substr($value,2,2);
	$substring2 = substr($value,5,2);
switch ($substring2)
{
	case "01";
		$month = "Jan";
	break;
	case  "02";
		$month = "Feb";
	break;
	case  "03";
		$month = "Mar";
	break;
	case  "04";
		$month = "Apr";
	break;
	case  "05";
		$month = "May";
	break;
	case  "06";	
		$month = "Jun";
	break;
	case  "07";
		$month = "Jul";
	break;
	case  "08";
		$month = "Aug";
	break;
	case  "09";
		$month = "Oct";
	break;
	case  "10";
		$month = "Sep";
	break;
	case  "11";
		$month = "Nov";
	break;
	case  "12";
		$month = "Dec";
	break;
}
$newvalue = $month . "-" . $substring1 . "";
	$calender[] = $newvalue;	
}
return $calender;
}
if(!empty($graphdata['action']) && ($graphdata['report'] ==="growth"))
{
switch ($graphdata['reportType'])
{
	case "Grasia";
		$queryJoin = growthQuery($graphdata['growthcharts'],"Grasia","Asia");
	break;
	case "Grmiddle_east";
		$queryJoin =growthQuery($graphdata['growthcharts'],"Grmiddle_east","Middle East");
	break;
	case "Gramerica";
		$queryJoin = growthQuery($graphdata['growthcharts'],"Gramerica","Americas");
	case "Groceania";
		$queryJoin = growthQuery($graphdata['growthcharts'],"Grasia","Asia");
	break;
	case "Grgeneric";
		$queryJoin = growthQuery($graphdata['growthcharts'],"Grgeneric","Generic");	
	break;
	case "Greuropean_union";
		$queryJoin = growthQuery($graphdata['growthcharts'],"Greuropean_union","European Union");
	break;
	case "Greurope - non EU";
		$queryJoin = growthQuery($graphdata['growthcharts'],"Greurope - non EU","Europe - non EU");
	break;
}
}
if (!empty($graphdata['action']) && ($graphdata['report'] ==="domains")) {
$queryJoin= db_select("dddom", "tldcountry, COUNT(*) as total", "dd_domains", "LEFT JOIN dd_tlds ON dd_tlds.tldexten = SUBSTRING(dd_domains.domname,LOCATE('.',dd_domains.domname ))", "(domdeleted != '1') and (tldregion = '{$graphdata['reportType']}') and (dommanstat = '10') and (clid = '$clid') GROUP by tldcountry ", "", "");
}

if (!empty($graphdata['action']) && ($graphdata['report'] ==="general")) {

switch ($graphdata['reportType'])
{
	case "Region";
		$queryJoin = db_select("dddom", "tldregion, COUNT(*) as total", "dd_domains", "LEFT JOIN dd_tlds ON dd_tlds.tldexten = SUBSTRING(dd_domains.domname,LOCATE('.',dd_domains.domname ))", "(domdeleted != '1') and (dommanstat = '10') AND (clid = $clid) GROUP by tldregion", "", ""); 
	break;
	case "Division"; 
		$queryJoin = db_select("dddom", "dd_divs.divname, COUNT(*) as total", "dd_domains", "LEFT JOIN dd_divs ON dd_divs.divid = dd_domains.divid", "(domdeleted != '1') and (dd_domains.clid = $clid) GROUP by dd_divs.divname", "", "");

	break;
	case "M_Status";
		$queryJoin = db_select("dddom", "paramname, COUNT(*) as total", "dd_domains", "LEFT JOIN dd_params ON dd_domains.dommanstat=dd_params.paramid", "(domdeleted != '1') AND (clid = $clid) GROUP by paramname;", "", "");
	break;
	case "Country";
		$queryJoin = db_select("dddom", "tldcountry, COUNT(*) as total", "dd_domains", "LEFT JOIN dd_tlds ON dd_tlds.tldexten = SUBSTRING(dd_domains.domname,LOCATE('.',dd_domains.domname ))", "(domdeleted != '1') and (dommanstat = '10') AND (clid = $clid) GROUP by tldcountry", "", "");
	break;
}
}

	while ($row1 = mysql_fetch_assoc($queryJoin))
	{
// 		print_R($graphdata['report']);
// 		print_R($graphdata['reportType']);
// 		echo "<br>";
		if ( $graphdata['report'] == "growth" && ($graphdata['graph'] !== "global_graph")) 
		{
			$tldsarray[] = $row1['date'];
		}
		if (  ($graphdata['report'] == "growth") && ($graphdata['graph'] == "global_graph") ) 
		{
			$tldsarray[] = $row1['tldcountry'];
		}
		if ( ($graphdata['report'] == "general" && $graphdata['reportType'] == "Region") ) 
		{
			$tldsarray[] = $row1['tldregion'];
		} elseif($graphdata['report'] == "general" && $graphdata['reportType'] == "Division") 
		{
			$tldsarray[] = $row1['divname'];
		}  elseif($graphdata['report'] == "general" && $graphdata['reportType'] == "M_Status") 
		{
			$tldsarray[] = ($row1['paramname']);
		}  elseif ($graphdata['report'] =="general" && $graphdata['reportType'] =="Country") 
		{
// 				echo "<br>this is working";
			$tldsarray[] =($row1['tldcountry']);
		}
		 elseif ($graphdata['report'] == "domains" ) 
		{
			$tldsarray[] =($row1['tldcountry']);
		}
		$totalsarray[] =($row1['total']);
}

$count = count($totalsarray);
foreach($totalsarray as $value)
{
$range10= checkrange($value,0,10,"10");
$range20= checkrange($value,11,20,"20");
$range30= checkrange($value,21,30,"30");
$range40= checkrange($value,31,40,"40");
$range50= checkrange($value,41,50,"50");
$range100= checkrange($value,41,50,"50");
}

$datarange10 = datarange($totalsarray,1,10);
$datarange20 = datarange($totalsarray,11,20);
$datarange30 = datarange($totalsarray,21,30);
$datarange40 = datarange($totalsarray,31,40);
$datarange50 = datarange($totalsarray,41,50);
$datarange60 = datarange($totalsarray,51,60);
$datarange70 = datarange($totalsarray,61,70);
$datarange80 = datarange($totalsarray,71,80);
$datarange90 = datarange($totalsarray,81,90);
$datarange100 = datarange($totalsarray,91,100);

if ($datarange10 =="1")
{
$multiple = 10;
$modifiedchxr = "1,1,10";
}
if ($datarange20 =="1")
{
$multiple = 5;
$modifiedchxr = "1,1,20";
}
if ($datarange30 =="1")
{	
$multiple = 3.333333333;
$modifiedchxr = "1,1,30";
}
if ($datarange40=="1")
{
$multiple = 2.5;
$modifiedchxr = "1,1,40";
}
if ($datarange50 =="1")
{
$multiple = 2;
$modifiedchxr = "1,1,50";
}
if ($datarange60 =="1")
{
$multiple = 1.666666667;
$modifiedchxr = "1,1,60";
}
if ($datarange70 =="1")
{
$multiple = 1.428571429;
$modifiedchxr = "1,1,70";
}
if ($datarange80 =="1")
{
$multiple = 1.25;
$modifiedchxr = "1,1,80";
}
if ($datarange90 =="1")
{
$multiple = 1.111111111;
$modifiedchxr = "1,1,90";
}
if ($datarange100 =="1")
{
$multiple = 2;
$modifiedchxr = "1,1,100";
}

$chmalft = setMargin($graphdata['Left_Margin'],"75");
$chmargt = setMargin($graphdata['Right_Margin'],"75");
$chmatop = setMargin($graphdata['Top_Margin'],"75");
$chmabot = setMargin($graphdata['Bottom_Margin'],"75");
$count = count($totalsarray);

$modifiedtotals = array();
foreach ($totalsarray as $key => $value)
	{	
		$testvalue = ($multiple*($value));
		$modifiedtotals[] = ($multiple*($value));	
	}
// change this into a function
$totalsstring = implode(",",$modifiedtotals);
$startvalue = ((100/$count)/2);
$increment = (100/$count);
$incRoundedUp =ceil($increment);
$divide = ( ($incRoundedUp) / (2*$startvalue) );
$finalanswer =( ($incRoundedUp) / ($divide) );
$Y_axes = array();
$Y_axes[0] .= $startvalue;
$lastvalue = (100+($startvalue));
$i = $startvalue;
$total = 0;
$percentages=  array();

foreach($totalsarray as $key => $value)
{	
$total +=$value;

}

$percentile = array();
$graphvalue = array();
foreach($totalsarray as $key => $value)
{	
$percentage = ((100/$total)*$value);
$graphvalue[] .= substr($percentage, 0, 4);
$percentile[] .= substr($percentage, 0, 4) . "%";
}
$c=0;
if ($count >=1)
{
while ($i <= $lastvalue )
{
	$c++;
	if ($c >= 110) {
		exit();
	}	
	$i = $i + $increment;
	$Y_axes[] .=$i;
}
}

foreach($count as $key => $value)
{	
if($value == "0")
{
	unset($chdarray[$key]);
}
}

$newvalue ="t:" . implode(",",$chdarray) . "";

foreach ($Y_axes as $key => $value)
{
	if ($value > 100)
	unset($Y_axes[$key]);
}


// Setting graph VAriables

// PIE CHARTS VARIABLES
if (isset($graphdata['action']))
{
$chco = "9FB9EA,1A59F5,042F85,000000,9FB9EA,1A59F5,042F85,000000,9FB9EA,1A59F5,042F85,000000,9FB9EA,1A59F5,042F85,000000";
$chd = "t:". implode(",", $totalsarray) . "";	
$chdl2 = implode(",", $graphvalue) . "";
$chdl = implode("|", $percentile) . "";
$chdlp= "b";
$chf = "bg,lg,0,EFEFEF,0,BBBBBB,1";
$chl = implode("|", $tldsarray);
if (isset($chmamod))
{
	$chma = $chmamod;
	echo "<br>yes<br>";
}else{
	$chma= "125,125,60,60";
}
$chxr = $modifiedchxr;
$chxl="0:|". $chl . "";
$chxp = implode("|",$Y_axes);
}
$barchd="t:". implode(",", $modifiedtotals);


if ($graphdata['report'] == "general" && $graphdata['reportType']=="M_Status")
{
$managed =displayValue($tldsarray,"Managed By Com Laude","Managed","Pending Transfer In","Trsfer in","Transferred Away","Trsfer Away","","","","");
$chl=implode("|",$managed);
}

if ($graphdata['reportType']=="Region")
{
$managed =displayValue($tldsarray,"European Union","E.U","Middle East","Mid-East","Europe - non EU","Eur-non EU");
$chl=implode("|",$managed);
}

$modtotals = implode(",",$modifiedtotals);

// This creates the country key codes
$chxl = explode("|",$chl);
$count = array();
foreach($chxl as $value){
$query =db_select("dddom", "countrycode", "dd_countries", "", "(countryname like '%$value%')", "", "1");
$row1 = mysql_fetch_assoc($query);
$variable = $row1['countrycode'];
if (empty($variable))
{
	$count[] =0;
}else{
	$count[] =1;
}
$chld.= $variable;

}

$chdsub = substr($barchd,2);
$chdarray = array();
$chdarray = explode(",",$chdsub);

// This unsets the corresponding value in chd if there is no match found for the country
foreach($count as $key => $value)
{	
if($value == "0")
	{
		unset($chdarray[$key]);
	}
}

$newvalue ="t:" . implode(",",$chdarray) . "";
$y_axes=explode("|",$y_axes);
$chxp="0," . implode(",",$y_axes) . "";

// Pie charts
if ( $graphdata['graph'] == "p3"  or $graphdata['graph'] == "p" )
{
$chartarray['chtt'] = $graphdata['Graph_Title'];
$chartarray['chco'] = "9FB9EA,1A59F5,042F85,000000,9FB9EA,1A59F5,042F85,000000,9FB9EA,1A59F5,042F85,000000,9FB9EA,1A59F5,042F85,000000";
$chartarray['chd'] = $chd;
$chartarray['chdl'] = $chdl;
$chartarray['chdlp'] ="b";
// 	$chartarray['chf'] ="bg,lg,0,EFEFEF,0,BBBBBB,1";
$chartarray['chl'] = $chl;
$chartarray['cht'] = $graphdata['graph'];

}
if ( ( $graphdata['graph'] == "p3"  or $graphdata['graph'] == "p") &&  ( $graphdata['report'] =="growth") )
{
$chartarray['chd'] =$barchd;	
}
// BARGRAPHS
if ( $graphdata['graph'] == "bar_graph")
{
$chartarray['chtt'] = $graphdata['Graph_Title'];
$chartarray['chbh'] = "a,0,0";
$chartarray['chco'] = "1E4CC0";
$chartarray['chd'] = $barchd;
$chartarray['cht'] = "bhg";
$chartarray['chxl'] = "0:|". $chl . "";
$chartarray['chxp'] = $chxp;
$chartarray['chxr'] = $modifiedchxr;
$chartarray['chxt'] ="y,x";

}

// line charts
if ( $graphdata['graph'] == "line_graph")
{
$chartarray['chtt'] = $graphdata['Graph_Title'];
$chartarray['chco'] = "3072F3";
$chartarray['chd'] ="t:0," . $chdl2 . "" ;
$chartarray['cht'] = "lc";
$chartarray['chxt'] ="x,y";
$chartarray['chls'] ="1,-1,-1";
}

// Global Graph
if ( ($graphdata['graph'] == "global_graph") )  
{
$chartarray['chf']="bg,s,EAF7FE";
$chartarray['cht'] = "t";
$chartarray['chco'] = "FFFFFF,BBCCED,0000FF,000000";
$chartarray['chd'] = $newvalue;
$chartarray['chld'] = $chld;
$chartarray['chs'] = "440x220" ;
$chartarray['chtm'] = "world";	
}

if ( ($graphdata['graph'] == "global_graph") &&  ( $graphdata['domaincharts'] == "European_union") or ( $graphdata['domaincharts'] == "Europe - non EU") )
{
$chartarray['chtm'] = "europe";
}
if ( ($graphdata['graph'] == "global_graph") &&  ($graphdata['report'] == "domains") && ( $graphdata['reportType'] == "Asia") )
{
$chartarray['chtm'] = "asia";
}

if ($graphdata['size']=="Small" && ($graphdata['graph'] !== "global_graph") )
{
$chartarray['chma'] ="120,120,50,50";
$chartarray['chs'] ="360x360";
}
if ($graphdata['size']=="Medium" && ($graphdata['graph'] !== "global_graph"))
{
$chartarray['chma'] ="75,75,25,25";
$chartarray['chs'] ="460x460";
}
if ($graphdata['size']=="Large"  && ($graphdata['graph'] !== "global_graph"))
{
$chartarray['chma'] ="50,50,0,0";
$chartarray['chs'] ="540x540";
}
// if ($graphdata['size']=="Custom" && ($graphdata['graph'] !== "global_graph"))
// {
// 	$chartarray['chma'] ="" . $graphdata['Left_Margin'] . "," . $graphdata['Right_Margin'] . "," . $graphdata['Top_Margin'] . "," . $graphdata['Bottom_Margin'] . "";
// 	$chartarray['chs'] = "" . $graphdata['Height'] . "x" . $graphdata['Width'] ."";
// }

$dates =explode("|",$chl);
$data = displayMonth($dates);

if ($graphdata['report'] =="growth" && ( $graphdata['graph'] !=="global_graph") && (  $graphdata['graph'] !== "p3"  or $graphdata['graph'] !== "p"))
{
$chartarray['chxl'] ="0:|"  . implode("|",$data) . "";
}

if (($graphdata['report'] =="growth") && ( $graphdata['graph'] =="pie_graph" or $graphdata['graph'] == "p3"  or $graphdata['graph'] == "p"))
{
$chartarray['chl'] =implode("|",$data);
}

if($graphdata['report'] =="general" && $graphdata['reportType'] == "Country" && ($graphdata['graph'] == "bar_graph"))
{ 	
$chartarray['chd'] ="t:" . implode(",",$modifiedtotals) . "";
}

if($graphdata['graph'] == "line_graph")
{ 	
$chartarray['chxl'] ="0:|0|"  . $chl . "|1:|0|25|50|75|100";
}
if($graphdata['graph'] == "line_graph" && ($graphdata['report'] == "growth"))
{ 	
$chartarray['chxl'] ="0:|0|"  . implode("|",$data) . "|1:|0|25|50|75|100";
}

if (isset($graphdata['action']) )
{

$temp= array();
foreach ($chartarray as $key => $value)
		{
			$temp[] .="$key=$value";
		}

$string = implode("&",$temp);
$g= new GoogleChart;
$g->getChart($chartarray);

}
// try save chart?
// // 	if (($graphdata['action']) == "Save")
// // 	{
// // 	$g->saveChart();
// // 	print_R($g);
// // 	}


if (($graphdata['action']) == "Save")
{
$g->downloadImage();
print_R($g);
}
// 	
// 
if(($graphdata['action']) == "Display" )
{

$g->showImage();
	print_r($g);
}

// print_r($_SESSION["GraphData"]);
// print_r($graphdata);
// echo "<br>string=";		
// print_R($string);
// echo "<br>session == ";
// print_R($_SESSION['Graphdata']);
// echo "<br><br><br><br>graphdata===";
// print_R($graphdata);
// echo "<br><br><br>chartarray=<br>";
// print_r($chartarray);
// echo "<br>tlds array==";
// print_R($tldsarray);
// $graphdata['report']
?>
<!DOCTYPE html>
<title></title>

ANY HELP WOULD BE GREATLY APPRECIATED

 

edit: added code blocks

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.