<?php
//	Author:	Vishwanath Pandey
/****************************************************************************************************************************
************************************HoE.com Video Display set up **********************************************************************
*****************************************************************************************************************************
*/
//session_start();

require_once("db.php");
function hoe_video_setup($site_id, $cat_ids=''){
	if(!empty($_GET['hash_key'])){
		$hoe_identifier ="&hash_key={$_GET['hash_key']}";		
	} else {
		$hoe_identifier ='';
	}
	
	if(empty($site_id)) {
		return false;
	}
	$domain = fetch_domain_details();
	if(!empty($domain)) {
		if(empty($cat_ids)){
			$cat_ids = $domain['categories'];
		}
	}
	
?>
<html>
<script src="http://player.admedia.com/?id=<?php echo $site_id?>&carousel=1&cat_id=<?php echo $cat_ids?><?php echo $hoe_identifier?>"></script>
<!--<script src="http://192.168.30.184/vish/player.admedia.com/trunk/html/?id=<?php #echo $site_id?>&carousel=1&cat_id=<?php #echo $cat_ids?><?php #echo $hoe_identifier?>"></script-->
<script> adm_player.init({player_id:"player_id", width:"800", height:"600"}); </script>
<div style="width:800px"> <div id="player_id"> </div> </div>
</html>	
<?php	
}

function fetch_domain_details(){
	// global $db;
	$db = ConnectToAdmin();
	$host_name = $_SERVER['HTTP_HOST'];
	// $host_name = 'mypassionsandinterests.com';
	$sql ="SELECT * FROM hoe_domains where domain='{$host_name}'";
	$result = mysql_query($sql, $db);
	$resultSet = '';
	$total_videos = mysql_num_rows($result);
	if( $total_videos > 0 ) {
		$resultSet =  mysql_fetch_assoc($result);		
	}
	return $resultSet;
}




