elbuhleini 0 Newbie Poster

Hi,
I have a site with free games, etc..
I want to do this: when a user clicks on a game to play, he is redirected to the landing page, where a script checks, if he has our toolbar installed; if yes, then he can play the game - if not, the background freezes and in the front shows a prompt window (mgate.php), to install the toolbar.
I have developed a code, but it does not work properly, so I am asking for a little help :)
Here is the code for the page with game on it (example: index.php):

<html> 
<head> 
<script type="text/javascript">
		toolbar=0;
		function ToolBarInit(tool) {
			toolbar=1;
		}

		function checkToolbar(){
			if(toolbar!=1) {
				window.location.href="landingpage.php";
			}
		} 
</script> 
<script language="javascript">
document.getElementById('mask').style.visibility='visible'
document.getElementById('mask2').style.visibility='visible'

document.getElementById('mask').style.height=document.body.clientHeight

function loadContent(){

if(toolbar==1){ document.getElementById('cont').innerHTML='<div width=500 height=500 style="overflow: hidden;" id=media_container><embed src= "http://www.odeo.com/flash/audio_player_standard_gray.swf" quality="high" width="300" height="52" allowScriptAccess="always" wmode="transparent"  type="application/x-shockwave-flash" flashvars= "valid_sample_rate=true&external_url=<?=$_GET[url];?>" pluginspage="http://www.macromedia.com/go/getflashplayer"> </embed></div>'
document.getElementById('mask').style.visibility='hidden'
document.getElementById('mask2').style.visibility='hidden'

}
}

function confirmDL(){
location.href='http://mydomain/toolbar.exe';
}

</script> 
</head> 
<body> 

<h1><a href="http://mydomain/game.swf">Click to Play!</a></h1> 
</body> 
</html>

And here is the code for the landing page:

<html> 
<head> 
</head>  
<body onLoad="loadContent();" style="position:relative; display:block">
<div id=mask style="width:100%; height:100%; position:absolute; z-index:1000;  background-color: black; filter:alpha(opacity=50);-moz-opacity:.50;opacity:.50;left:0px; top:0px; display:block; visibility:hidden" align=center></div>
<div id=mask2 style=" position: absolute; width: 650px;  z-index:1500;  display:block; margin-left:50%; visibility:hidden" ><div style='position:absolute; z-index:1500; width:650px; height:450px;  background-color:white;  border:1px solid gray; margin-left:-325px;  display:block; margin-top:200px;  ' align=center><?php include_once("mgate.php");?></div></div> 
<script language="javascript">
document.getElementById('mask').style.visibility='visible'
document.getElementById('mask2').style.visibility='visible'

document.getElementById('mask').style.height=document.body.clientHeight

function loadContent(){

if(toolbar==1){ document.getElementById('cont').innerHTML='<div width=500 height=500 style="overflow: hidden;" id=media_container><embed src= "http://www.odeo.com/flash/audio_player_standard_gray.swf" quality="high" width="300" height="52" allowScriptAccess="always" wmode="transparent"  type="application/x-shockwave-flash" flashvars= "valid_sample_rate=true&external_url=<?=$_GET[url];?>" pluginspage="http://www.macromedia.com/go/getflashplayer"> </embed></div>'
document.getElementById('mask').style.visibility='hidden'
document.getElementById('mask2').style.visibility='hidden'

}
}

function confirmDL(){
location.href='http://mydomain/toolbar.exe';
}

</script> 
 
<div id=('cont')

</body>  
</html>

Help pls! :)

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.