Hi there,

So I thought this would be simple and it should be but I can't see what is wrong. Basically I am checking what language has been selected (via a code stored in a constant LANG_CODE) and then loading in a specific swf file.

Except that the language code part of the filename I am trying to output is not there in the source code but is there when I just echo it to the browser as text.

Here's the code for it. Any help is very much appreciated.

if ( isset($_SERVER['HTTP_REFERER']) ){
	$referer = basename($_SERVER['HTTP_REFERER']);
}
else{
	 $referer = 'default_page.php';
}

$lang_version = LANG_CODE;


if( $referer == 'page_1.php' ){
	$flash = 'console_'.$lang_version.'.swf';
}
elseif( $referer == 'page_2.php' ){
	$flash = 'io_'.$lang_version.'.swf';
}
elseif( $referer == 'page_3.php' ){
	$flash = "console_".$lang_version.".swf";
}
elseif( $referer == 'page_4.php' ){
	$flash = "console_".$lang_version.".swf";
}
else{
	$flash = "console_".$lang_version.".swf";
}


echo'
	<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
	   codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"
	   width="738" height="404" id="SONAR" align="middle">
	<param name="allowScriptAccess" value="sameDomain" />
	<param name="movie" value="swf_includes/'.$flash.'" />
	<param name="quality" value="high" />
	<param name="bgcolor" value="#ffffff" />
	<embed src="swf_includes/'.$flash.'" quality="high" bgcolor="#ffffff" width="738"
	   height="404" name="mymovie" align="middle" allowScriptAccess="sameDomain"
	   type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />
	</object>';

I have also tried this code for outputting the flash (still isn't working):

echo"
	<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\"
	   codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\"
	   width=\"738\" height=\"404\" id=\"SONAR\" align=\"middle\">
	<param name=\"allowScriptAccess\" value=\"sameDomain\" />
	<param name=\"movie\" value=\"swf_includes/$flash\" />
	<param name=\"quality\" value=\"high\" />
	<param name=\"bgcolor\" value=\"#ffffff\" />
	<embed src=\"swf_includes/$flash\" quality=\"high\" bgcolor=\"#ffffff\" width=\"738\"
	   height=\"404\" name=\"mymovie\" align=\"middle\" allowScriptAccess=\"sameDomain\"
	   type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" />
	</object>";

Ok so I don't know why but it seems the code below has fixed it.

if ( isset($_SERVER['HTTP_REFERER']) ){
	$referer = basename($_SERVER['HTTP_REFERER']);
}
else{
	 $referer = 'default_page.php';
}

$lang_version = LANG_CODE;

if( $referer == 'page_1.php' ){
	if( LANG_CODE == 'en'){
		$flash = 'console_en.swf';
	}
	elseif(LANG_CODE == 'es'){
		$flash = 'console_es.swf';
	}
	elseif(LANG_CODE == 'de'){
		$flash = 'console_de.swf';
	}
	elseif(LANG_CODE == 'fr'){
		$flash = 'console_fr.swf';
	}
	elseif(LANG_CODE == 'it'){
		$flash = 'console_it.swf';
	}
	elseif(LANG_CODE == 'jp'){
		$flash = 'console_jp.swf';
	}
	else{
		$flash = 'console_en.swf';
	}
}//Closing Console if statement
elseif( $referer == 'page_2.php' ){
	if( LANG_CODE == 'en'){
		$flash = 'io_en.swf';
	}
	elseif(LANG_CODE == 'es'){
		$flash = 'io_es.swf';
	}
	elseif(LANG_CODE == 'de'){
		$flash = 'io_de.swf';
	}
	elseif(LANG_CODE == 'fr'){
		$flash = 'io_fr.swf';
	}
	elseif(LANG_CODE == 'it'){
		$flash = 'io_it.swf';
	}
	elseif(LANG_CODE == 'jp'){
		$flash = 'io_jp.swf';
	}
	else{
		$flash = 'io_en.swf';
	}
}//Closing IO if statement
else{
	$flash = 'console_en.swf';
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.