<?php


if (!function_exists('view_details_i2d')) {
function view_details_i2d($parameters){
 
 
 if (array_key_exists('id', $parameters)) {
   $id=$parameters['id'];
   }   
 
 if (array_key_exists('btn_id', $parameters)) {
   $btn_id=$parameters['btn_id'];
   }   
 
 
 if (array_key_exists('settings', $parameters)) {
   $settings=$parameters['settings'];
   }   

 if (array_key_exists('fields', $parameters)) {
   $fields=$parameters['fields'];
   }   

 
 if (array_key_exists('url_fields', $parameters)) {
   $url_fields=$parameters['url_fields'];
   }   
 
 if (array_key_exists('remote_cols', $parameters)) {
   $remote_fields=$parameters['remote_cols'];
   }   
 
 if (array_key_exists('links', $parameters)) {
   $links=$parameters['links'];
   }   


if (array_key_exists('table', $settings)) {
   $table=$settings['table'];
   }
   if (array_key_exists('ref', $settings)) {
   $ref=$settings['ref'];
   }		
   if (array_key_exists('id_col', $settings)) {
   $id_col=$settings['id_col'];
   }	

	
   $loaded=get_content2($ref,$id_col,$fields['fields'],$table,"1",$id);
   
?>
   <!-- PAGE FUNCTION STARTS (c) i2d Technologies Website Engine -->
   <div id="page-right-content">
<!-- note this div closes in footer -->
                    <div class="container">
                        <div class="row">
                            <div class="col-sm-12">
   
<?php
echo "<h3>".$parameters['heading']."</h3> <hr />";
?>
   
   <p>&nbsp;</p>
   <div class="col-md-12">
   <div class="col-md-6">
      <p>
	  <?php if($loaded){ 
	foreach($loaded as $item){
	foreach (array_combine($fields['labels'], $fields['fields']) as $key => $field) {
	
    ?>
	  <strong><?php echo $key; ?> : </strong><?php 
	  echo check_decode($item[$field]);
	  
	  ?>
	  
	  
	  <br />
	  <br />
	  <?php } }  }
	?>
 
	 </p>
	  
	  
                        </div>
	
	
	
	<?php
	if (array_key_exists('remote_cols', $parameters)) {
 ?>
	<div class="col-md-6">
	<?php
	 $loaded2=get_content2($ref,$id_col,$remote_fields['fields'],$table,"1",$id);
  ?>
	
	<p>
	  <?php if($loaded2){ 
	foreach($loaded2 as $item2){
	foreach (array_combine($remote_fields['labels'], $remote_fields['fields']) as $key2 => $remote_field) {
	
    ?>
	  <strong><?php echo $key2; ?> : </strong><?php 
	  
	  $zoor=db_ref($settings['child_table'],$settings['child_table_id_col'],$item2[$remote_field],$settings['child_table_title']);
	   
	  echo check_decode($zoor);
	  
	  
	  ?>
	  
	  
	  <br />
	  <br />
	  <?php } }  }
	?>
 
	 </p>
	  
</div>
	<?php } ?>


                        </div>
						<div class="col-md-12">
						<div class="alert alert-success alert-dismissible fade in" role="alert" id="holo" style="display:none;">
                                                <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                                    <span aria-hidden="true">×</span>
                                                </button>
                                                <strong>Done!</strong> copied to clipboard.
                                            </div>
						<p>&nbsp;</p>
	
	<div class="col-md-12" id="select_txt">
	
	
	<script type="text/javascript">
function copy_data(containerid) {
	$("p").toggleClass("hidden");
  var range = document.createRange();
  range.selectNode(containerid); //changed here
  window.getSelection().removeAllRanges(); 
  window.getSelection().addRange(range); 
  document.execCommand("copy");
  window.getSelection().removeAllRanges();
   $('#holo').show(0).delay(5000).hide(0);
   $("p").toggleClass("hidden");
  }
  </script>
  

	
	
      <p>
	  <?php 
	  $cell=db_ref(main_table,id_col,$parameters['id'],cell);
	  $domain=strtolower(db_ref(main_table,id_col,$parameters['id'],domain));
	  $name=ucwords(db_ref(main_table,id_col,$parameters['id'],person));
	  $company=db_ref(main_table,id_col,$parameters['id'],company);
	  $company=strtoupper($company);

if(isset($parameters['product']) && !empty($parameters['product'])) {

    $domain=$parameters['product'];
    
}

	?>
	
	<p class="hidden">Dear <?php echo $name; ?>, <br /><br />i2d offers " <?php echo $domain; ?> " for your business <?php echo $company; ?>.<br /></p>
    
	<p class="hidden">for more information , please call us at 051-8774077 ,  03458500096.<br />
	<strong><br />Please Click on the followings link to view package details : </strong></p>
	 
	 </p>
	  
	                    </div>
	
	
		<div id="select_txt2">
		    <p class="hidden"><?php echo $url_fields['dir']; ?></p>
</div>
	
	<div class="col-md-6 text-right">
	<p>&nbsp;</p>
	
	<button type="button" class="btn btn-md btn-primary btn-sm" onclick="copy_data(select_txt)">Message - 1 - copy introduction</button> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    
	
	<button type="button" class="btn btn-md btn-success btn-sm" onclick="copy_data(select_txt2)">Message 2 - copy LINK</button>
    
	</div>					
						
						</div>
						
<?php
if (array_key_exists('links', $parameters)) {
form_button_adv($btn_id,$links);
}
?>

<?php

$cell=str_replace('(', '', $cell);
$cell=str_replace(')', '', $cell);
$cell=str_replace('-', '', $cell);

$wap_link="https://api.whatsapp.com/send?phone=92".$cell;

?>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div class="text-center">
	  
	  <!-- <a href="<?php //echo $wap_link; ?>" target="_blank" type="button" class="btn btn-success btn-lg m-t-10">Send Whatsapp</a>
      	 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -->
	  <button type="button" class="btn btn-danger m-t-10 btn-lg" onclick="history.go(-1);">Close View</button>
      
	  
   </div>
													<p>&nbsp;</p>
													<p>&nbsp;</p>
													<p>&nbsp;</p>
   
                        </div> <!-- end row -->
                    </div>

 <!-- PAGE FUNCTION ENDS (c) i2d Technologies Website Engine -->   
<?php   
}
}
//////////////////////////// HTML FUNCTION ENDS (c) i2d Technologies ///////////////////////////////////////

////////////////////// CORE FUNCTION | MODULE FUNCTION (c) i2d Technologies //////////////////////////////////
if (!function_exists('random')) {
function random($length,$number) { 

    $characters = 'Hbsefgdqrsqjxlkmyt';
    $charactersLength = strlen($characters);
    $randomString = '';
    for ($i = 0; $i < $length; $i++) {
        $randomString .= $characters[rand(0, $charactersLength - 1)];
    }

if(strlen($number)>0){
$middle=strlen($number)/2;
$first=substr($number,0,$middle);
$last=substr($number,$middle);
	
$randomString=$first.$randomString.$last;
}
else{
$randomString=$randomString.$number;
}
    return $randomString;
}
}

/////////////////////////// function ends /////////////////////////////////

//$id=preg_replace('~\D~', '', $id);

////////////////////// CORE FUNCTION | MODULE FUNCTION (c) i2d Technologies //////////////////////////////////
if (!function_exists('make_url')) {
function make_url($id) { 

$finder=db_ref("master","id",$id,"col1");
$finder=str_replace(" ", "-", $finder);
//$finder=$finder."-".$id;
$finder=strtolower($finder);
return $finder;

} 
}
/////////////////////////// function ends /////////////////////////////////
/////////////////////////////////////////////////////////
if (!function_exists('email')) {
function email($company) {
	
$dated1 = date('d-m-Y H:i:s');
$dated=date( "d-m-Y", strtotime( $dated1 )+5*60*60 );
$time=date( "H:i:s", strtotime( $dated1 )+5*60*60 );

$ipaddress = '';
     if (getenv('HTTP_CLIENT_IP'))
         $ipaddress = getenv('HTTP_CLIENT_IP');
     else if(getenv('HTTP_X_FORWARDED_FOR'))
         $ipaddress = getenv('HTTP_X_FORWARDED_FOR'&quot);
     else if(getenv('HTTP_X_FORWARDED'))
         $ipaddress = getenv('HTTP_X_FORWARDED');
     else if(getenv('HTTP_FORWARDED_FOR'))
         $ipaddress = getenv('HTTP_FORWARDED_FOR');
     else if(getenv('HTTP_FORWARDED'))
        $ipaddress = getenv('HTTP_FORWARDED');
     else if(getenv('REMOTE_ADDR'))
         $ipaddress = getenv('REMOTE_ADDR');
     else
         $ipaddress = 'UNKNOWN';
        
    $browser=ExactBrowserName();
    $os=getOS();

 $to = "omer.iqbal@i2dtechnologies.com";
 $subject = $company." Hosting Offer Checked" ;
 $body .= "<p>Offer Checked at ".$dated." <br />Domain Name : ".$company."<br />Time : ".$time."<br />VIA IP ADDRESS: ".$ipaddress."<br /> Device Application : ".$browser."<br /><b> OS Version : ".$os."</b>";
   
    $headers = 'From: i2d Technologies Hosting Solutions info@i2dhost.net' . "\r\n" ;
    $headers .='Reply-To: i2d Technologies info@i2dtechnologies.com'."\r\n" ;
    $headers .='X-Mailer: PHP/' . phpversion();
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= 'Bcc: zeeshan.a@i2dtechnologies.com , sales@i2dtechnologies.com' . "\r\n";
	if(mail($to, $subject, $body,$headers)) {
return;
sleep(3);

} 

}
}
/////////////////////////// function ends /////////////////////////////////

if (!function_exists('view_details_i2d_msg')) {
function view_details_i2d_msg($parameters){
 
 
 if (array_key_exists('id', $parameters)) {
   $id=$parameters['id'];
   }   
 
 if (array_key_exists('btn_id', $parameters)) {
   $btn_id=$parameters['btn_id'];
   }   
 
 
 if (array_key_exists('settings', $parameters)) {
   $settings=$parameters['settings'];
   }   

 if (array_key_exists('fields', $parameters)) {
   $fields=$parameters['fields'];
   }   

 
 if (array_key_exists('url_fields', $parameters)) {
   $url_fields=$parameters['url_fields'];
   }   
 
 if (array_key_exists('remote_cols', $parameters)) {
   $remote_fields=$parameters['remote_cols'];
   }   
 
 if (array_key_exists('links', $parameters)) {
   $links=$parameters['links'];
   }   


if (array_key_exists('table', $settings)) {
   $table=$settings['table'];
   }
   if (array_key_exists('ref', $settings)) {
   $ref=$settings['ref'];
   }		
   if (array_key_exists('id_col', $settings)) {
   $id_col=$settings['id_col'];
   }	

	
   $loaded=get_content2($ref,$id_col,$fields['fields'],$table,"1",$id);
   
?>
   <!-- PAGE FUNCTION STARTS (c) i2d Technologies Website Engine -->
   <div id="page-right-content">
<!-- note this div closes in footer -->
                    <div class="container">
                        <div class="row">
                            <div class="col-sm-12">
   
<?php
echo "<h3>".$parameters['heading']."</h3> <hr />";
?>
   
   <p>&nbsp;</p>
   <div class="col-md-12">
   <div class="col-md-6">
      <p>
	  <?php if($loaded){ 
	foreach($loaded as $item){
	foreach (array_combine($fields['labels'], $fields['fields']) as $key => $field) {
	
    ?>
	  <strong><?php echo $key; ?> : </strong><?php 
	  echo check_decode($item[$field]);
	  
	  ?>
	  
	  
	  <br />
	  <br />
	  <?php } }  }
	?>
 
	 </p>
	  
	  
                        </div>
	
	
	
	<?php
	if (array_key_exists('remote_cols', $parameters)) {
 ?>
	<div class="col-md-6">
	<?php
	 $loaded2=get_content2($ref,$id_col,$remote_fields['fields'],$table,"1",$id);
  ?>
	
	<p>
	  <?php if($loaded2){ 
	foreach($loaded2 as $item2){
	foreach (array_combine($remote_fields['labels'], $remote_fields['fields']) as $key2 => $remote_field) {
	
    ?>
	  <strong><?php echo $key2; ?> : </strong><?php 
	  
	  $zoor=db_ref($settings['child_table'],$settings['child_table_id_col'],$item2[$remote_field],$settings['child_table_title']);
	   
	  echo check_decode($zoor);
	  
	  
	  ?>
	  
	  
	  <br />
	  <br />
	  <?php } }  }
	?>
 
	 </p>
	  
</div>
	<?php } ?>


                        </div>
						<div class="col-md-12">
						<div class="alert alert-success alert-dismissible fade in" role="alert" id="holo" style="display:none;">
                                                <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                                    <span aria-hidden="true">×</span>
                                                </button>
                                                <strong>Done!</strong> copied to clipboard.
                                            </div>
						<p>&nbsp;</p>
	
	<div class="col-md-12" id="select_txt">
	
	
	<script type="text/javascript">
function copy_data(containerid) {
	$("p").toggleClass("hidden");
  var range = document.createRange();
  range.selectNode(containerid); //changed here
  window.getSelection().removeAllRanges(); 
  window.getSelection().addRange(range); 
  document.execCommand("copy");
  window.getSelection().removeAllRanges();
   $('#holo').show(0).delay(5000).hide(0);
   $("p").toggleClass("hidden");
  }
  </script>
  

	
	
      <p>
	  <?php 
	  $cell=db_ref(main_table,id_col,$parameters['id'],cell);
	  $domain=strtolower(db_ref(main_table,id_col,$parameters['id'],domain));
	  $name=ucwords(db_ref(main_table,id_col,$parameters['id'],person));
	  $company=db_ref(main_table,id_col,$parameters['id'],company);
	  $company=strtoupper($company);

if(isset($parameters['product']) && !empty($parameters['product'])) {

    $domain=$parameters['product'];
    
}

	?>
	
	<p class="hidden">معزز کسٹمر، i2d Technologies، آپ کے بزنس کے لیے Online Solution فراہم کرتا ہے<br /></p>
    
    
	<p class="hidden">ہماری ریسرچ کے مطابق، <?php echo $domain;?>, ابھی تک نہیں خریدا گیا اور محفوظ ہے. <br />
	<br />
	جلد ہی اپنا انٹرنیٹ برینڈ ریجسٹر کروایں اور انٹرنیٹ فراڈ سے محفوظ رہیں. 
	<br />
	مزید مالومعات کے لیے ہماری ویب سائٹ ،www.i2dtechnologies.com, وزٹ کریں اور,
	
	<br />
	03458500096 پر, booking, کے لئے کال کریں، شکریہ.
	
	 
	 </p>
	  
	                    </div>
	
	
		<div class="col-md-12" id="select_txt2">
		    <p class="hidden">Dear <?php echo $name; ?>, <br /><br />i2d Technologies offers ONLINE SOLUTIONS for your business. Your business internet brand " <?php echo $domain; ?> " can be purchased by <?php echo $company; ?> before <strong>any other business registers it and captures your brand market.</strong>.</p>
    
    
	<p class="hidden">for more information , please visit our official website www.i2dtechnologies.com and for Booking please call us at 03458500096.<br />
	</p>
	
</div>
	
	<div class="col-md-6 text-right">
	<p>&nbsp;</p>
	
	<button type="button" class="btn btn-md btn-primary btn-sm" onclick="copy_data(select_txt)">copy whatsapp Urdu</button> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    
	<button type="button" class="btn btn-md btn-warning btn-sm" onclick="copy_data(select_txt2)">copy whatsapp English</button> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    
	
	</div>					
						
						</div>
						
<?php
if (array_key_exists('links', $parameters)) {
form_button_adv($btn_id,$links);
}
?>

<?php

$cell=str_replace('(', '', $cell);
$cell=str_replace(')', '', $cell);
$cell=str_replace('-', '', $cell);

$wap_link="https://api.whatsapp.com/send?phone=92".$cell;

?>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div class="text-center">
	  
	  <!-- <a href="<?php //echo $wap_link; ?>" target="_blank" type="button" class="btn btn-success btn-lg m-t-10">Send Whatsapp</a>
      	 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -->
	  <button type="button" class="btn btn-danger m-t-10 btn-lg" onclick="history.go(-1);">Close View</button>
      
	  
   </div>
													<p>&nbsp;</p>
													<p>&nbsp;</p>
													<p>&nbsp;</p>
   
                        </div> <!-- end row -->
                    </div>

 <!-- PAGE FUNCTION ENDS (c) i2d Technologies Website Engine -->   
<?php   
}
}
//////////////////////////// HTML FUNCTION ENDS (c) i2d Technologies ///////////////////////////////////////

if (!function_exists('vid_player')) {
	function vid_player($settings){
   ?>
   <!-- PAGE FUNCTION STARTS (c) Crystal Trading Company - Inteli-Sense PWA by i2d Technologies -->
    <!-- PAGE FUNCTION STARTS (c) i2d Technologies Website Engine -->

                        <div class="row">
                            <div class="col-sm-12 text-center">
                                <h3><?php echo $settings['heading']; ?></h3>
  
   <video oncontextmenu="return false;" width="<?php echo $settings['width']; ?>" height="<?php echo $settings['height']; ?>" controls controlsList="nodownload">
		<source src="<?php echo $settings['src']; ?>" type="video/mp4">
	</video>
	</div>
	</div>
	<p>&nbsp;</p>
	
	
 <!-- PAGE FUNCTION ENDS (c) Crystal Trading Company - Inteli-Sense PWA by i2d Technologies -->   
<?php
}
}
?>


















?>