Path : /var/www/html/main/
File Upload :
Current File : /var/www/html/main/head2.php

<?php
/*!
 * Copyright Anucha Puangpaka
 * Contacts anucha.ppk@icloud.com 062-479-9836
 * https://google.com/ping?sitemap=https://localhost/sitemap.xml
 */

error_reporting(E_ALL);
ini_set("display_errors", 0);

/*ini_set('session.cookie_httponly', 1);
ini_set("session.cookie_secure", 1);*/

session_start();

$lastModified = filemtime(__FILE__);
$etagFile = md5_file(__FILE__);
$offset = 1*60*60;
$expire = "Expires: ".gmdate("D, d M Y H:i:s", time()+$offset)." GMT";
if(substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
  ob_start("ob_gzhandler");
}else{
  ob_start();
}

/*header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Credentials: true");*/

header("content-type: text/html");
header($expire);
header("Last-Modified: ".gmdate("D, d M Y H:i:s", $lastModified)." GMT");
header("Etag: $etagFile");
header("Cache-Control: must-revalidate, public, max-age=86400"); /* 1days (60sec * 60min * 24hours * 1days) */
header("vary: Accept-Encoding");

include_once('config.php');

/*header("X-XSS-Protection: 1; mode=block");
header("X-Frame-Options: SAMEORIGIN");
header("X-Content-Type-Options: nosniff");
header("Referrer-Policy: strict-origin");
header("Content-Security-Policy: base-uri 'self'");
header("Feature-Policy: vibrate 'self'");
header("Strict-Transport-Security; max-age=31536000; includeSubDomains; preload");

header("Set-Cookie: PHPSESSID=".session_id()."; path=/; HttpOnly; Secure; SameSite=Lax");*/

if(empty($_GET['lang'])){
  $_GET['lang'] = "TH";
}

$sql = "select * from ap_settings";
$query = mysqli_query($conn,$sql);
$rows = mysqli_fetch_array($query);
$line_notify = $rows['line_notify'];
$line_notify2 = $rows['line_notify2'];
$line_notify3 = $rows['line_notify3'];
$line_notify4 = $rows['line_notify4'];
$line_notify5 = $rows['line_notify5'];
$line_notify6 = $rows['line_notify6'];
$line_notify7 = $rows['line_notify7'];
$line_notify8 = $rows['line_notify8'];
$line_notify9 = $rows['line_notify9'];
$google_translate = $rows['google_translate'];
$google_site_verification = $rows['google_site_verification'];
$google_analytics = $rows['google_analytics'];
$google_tag_manager = $rows['google_tag_manager'];
$majestic_site_verification = $rows['majestic_site_verification'];
$yandex_verification = $rows['yandex_verification'];
$bing_verification = $rows['bing_verification'];
$fb_id = $rows['facebook_app_id'];
$fb_page = $rows['facebook_page'];
$fb_page_id = $rows['facebook_page_id'];
$twitter = $rows['twitter'];
$instagram = $rows['instagram'];
$line = $rows['line'];
$youtube_channels = $rows['youtube_channels'];
$ap_watermark = $rows['title_eng'];
$externalbanner_bottom_slide = $rows['externalbanner_bottom_slide'];

if($_GET['lang']=="TH"){
  $title = $rows['title'];
  
  $slogan = $rows['slogan'];

  $header_logo = $rows['header_logo'];

  $foot_col_1 = $rows['foot_col_1'];
  $foot_col_2 = $rows['foot_col_2'];
  $foot_col_3 = $rows['foot_col_3'];
  $foot_col_4 = $rows['foot_col_4'];
}
if($_GET['lang']=="ENG"){
  $title = $rows['title_eng'];
  $slogan = $rows['slogan_eng'];

  $header_logo = $rows['header_logo_eng'];

  $foot_col_1 = $rows['foot_col_1_eng'];
  $foot_col_2 = $rows['foot_col_2_eng'];
  $foot_col_3 = $rows['foot_col_3_eng'];
  $foot_col_4 = $rows['foot_col_4_eng'];
}

$keywords = $rows['keywords'];
$keywords_eng = $rows['keywords_eng'];

$description = $rows['description'];
$description2 = $rows['description2'];
$description3 = $rows['description3'];
$short_title = $rows['short_title'];

$header_color = $rows['header_color'];
$footer_color = $rows['footer_color'];
$logo = $rows['logo'];
$logo_touch = $rows['logo_touch'];
$favicon = $rows['favicon'];
$date_counters = $rows['date_counters'];
$visit_counters = $rows['visit_counters'];
$limit_list = $rows['list'];
$themes = $rows['themes'];
$col1 = $rows['columns1'];
$col1_w = $rows['columns1_width'];
$col2 = $rows['columns2'];
$col2_w = $rows['columns2_width'];
$col3 = $rows['columns3'];
$col3_w = $rows['columns3_width'];
$g_gallery = $rows['group_gallery'];
$g_gallery_name = $rows['group_gallery_name'];
$g_gallery_show = $rows['group_gallery_show'];
$grayscale = $rows['grayscale'];

if($_GET['lang']=="TH"){
  $lang = "th";
  $locale = "th_TH";
  include_once('lang/th.php');
}

if($_GET['lang']=="ENG"){
  $lang = "en";
  $locale = "en_US";
  include_once('lang/eng.php');
}


/*if((date(Ymd)>=(date(Y)."0728")) && (date(Ymd)<=(date(Y)."0731"))){
  if(empty($_SESSION['main_website'])){
    header('location:'.$ap_site.$ap_folder.'main.php');
    $_SESSION['main_website'] = 1;
  }
}*/

/*$sql_line = "select count(id) as total from ap_pages where lang='$_GET[lang]' and (counters<'1' and notify>'0') order by date_time desc";
$query_line = mysqli_query($conn,$sql_line);
$rows_line = mysqli_fetch_array($query_line);
$num_rows_line = $rows_line['total'];

$sql_line = "select * from ap_pages where lang='$_GET[lang]' and (counters<'1' and notify>'0') order by date_time desc";
$query_line = mysqli_query($conn,$sql_line);
$rows_line = mysqli_fetch_array($query_line);
if($num_rows_line>0){
  if(empty($ap_ip)){
    $apdomain = "$ap_site$ap_folder";
  }else{
    $apdomain = str_replace("$ap_ip","$ap_domain","$ap_site$ap_folder");
  }

  $rows_line['info2'] = strip_tags($rows_line['info2']);
  $rows_line['info2'] = str_replace( "&nbsp;"," ",$rows_line['info2']);

  if($last!=$apdomain){
    
    $message = array(
      'message' => "$rows_line[title] ".$rows_line['info2']." --> ".($apdomain)."?page_id=$rows_line[id]&lang=$_GET[lang]",
      'imageThumbnail' => "$rows_line[images]",
      'imageFullsize' => "$rows_line[images]",
      'imageFile' => 'copy/240.jpg',
      'stickerPackageId' => '',
      'stickerId' => ''
    );

    //$token = "tn4tthSdCi521nNZg0ahWFZZtEHUJW7UoD2Qa7X6K2Q"; //Anucha Puangpaka
    //line_notify($message, $token, $rows_line['id']);
    //$line_notify = $token;

    if(!empty($line_notify)){
      if($last1!=$line_notify){
        line_notify($message, $line_notify, $rows_line['id']);
      }
      $last1 = $line_notify;
    }
    if(!empty($line_notify2)){
      if($last2!=$line_notify2){
        line_notify($message, $line_notify2, $rows_line['id']);
      }
      $last2 = $line_notify2;
    }
    if(!empty($line_notify3)){
      if($last3!=$line_notify3){
        line_notify($message, $line_notify3, $rows_line['id']);
      }
      $last3 = $line_notify3;
    }
    if(!empty($line_notify4)){
      if($last4!=$line_notify4){
        line_notify_messages($message, $line_notify4);
      }
      $last4 = $line_notify4;
    }
    if(!empty($line_notify5)){
      if($last5!=$line_notify5){
        line_notify_messages($message, $line_notify5);
      }
      $last5 = $line_notify5;
    }
    if(!empty($line_notify6)){
      if($last6!=$line_notify6){
        line_notify_messages($message, $line_notify6);
      }
      $last6 = $line_notify6;
    }
    if(!empty($line_notify7)){
      if($last7!=$line_notify7){
        line_notify_messages($message, $line_notify7);
      }
      $last7 = $line_notify7;
    }
    if(!empty($line_notify8)){
      if($last8!=$line_notify8){
        line_notify_messages($message, $line_notify8);
      }
      $last8 = $line_notify8;
    }
    if(!empty($line_notify9)){
      if($last9!=$line_notify9){
        line_notify_messages($message, $line_notify9);
      }
      $last9 = $line_notify9;
    }

  }
  $last = $apdomain;
}*/

$browsers = "safari firefox";
$browsers = explode(" ", $browsers);
$http_user_agent = strToLower($_SERVER['HTTP_USER_AGENT']);
$l = strlen($http_user_agent);
for ($i=0; $i<count($browsers); $i++){
  $browser = $browsers[$i];
  $n = stristr($http_user_agent, $browser);
  if($n!=''){
    $GLOBALS["nav"] = $browser;
  }
}

$_GET['nu'] = (isset($_GET['nu']))?$_GET['nu']:'';
$_GET['page'] = (isset($_GET['page']))?$_GET['page']:'';
$_SESSION['views_catalogs'] = (isset($_SESSION['views_catalogs']))?$_SESSION['views_catalogs']:'';
$_SESSION['views_pages'] = (isset($_SESSION['views_pages']))?$_SESSION['views_pages']:'';
$_SESSION['views_gallery'] = (isset($_SESSION['views_gallery']))?$_SESSION['views_gallery']:'';
$_SESSION['views_gallery2'] = (isset($_SESSION['views_gallery2']))?$_SESSION['views_gallery2']:'';
?>
<!doctype html>
<html lang="<?php echo $lang; ?>" prefix="og: http://ogp.me/ns#">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <?php /* ?><meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"><?php */ ?>
  <meta http-equiv="content-language" content="<?php echo $lang; ?>" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <meta name="robots" content="index,follow"/>
  <meta name="robots" content="max-image-preview:standard">
  
  <meta name="theme-color" content="#317EFB"/>


  <?php
  if(!empty($_GET['page_id'])){
    if($_GET['api']>0){
      $headers = array("Content-Type: application/json", "Method: GET", "Token: $token");
      $url = "$ap_site$ap_folder"."modify-API.php?nu=$_GET[xcat]&id=$_GET[page_id]&code=$_GET[code]";
      $ch = curl_init($url);
      curl_setopt($ch, CURLOPT_HEADER, 0);
      curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
      curl_setopt($ch, CURLOPT_TIMEOUT, 15);
      curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      $data = curl_exec($ch);
      curl_close($ch);
      $json = json_decode($data, true);
      $json_total = count($json);

      $json[0]['info2'] = strip_tags($json[0]['info2']);
      $json[0]['info2'] = str_replace( "&nbsp;"," ",$json[0]['info2']);

      $sizeImg = getimagesize($json[0]['images']);
      $widthImg = $sizeImg['0'];
      $heightImg = $sizeImg['1'];
      ?>
      <title><?php echo $ap_page; ?> - <?php echo $json[0]['title']; ?></title>
      <meta name="title" content="<?php echo $json[0]['title']; ?>" />
      <meta name="keywords" content="<?php echo $json[0]['keywords']; ?>" />
      <meta name="description" content="<?php echo $json[0]['title']; ?><?php echo ', '.$keywords; ?>" />
      
      <meta property='og:url' content='<?php echo substr($ap_site,0,-1).$_SERVER['REQUEST_URI']; ?>' />
      <meta property="og:title" content="<?php echo $json[0]['title']; ?>" />
      <meta property="og:description" content="<?php echo $title; ?>" />
      <meta property="fb:app_id" content="<?php echo $fb_id?>" />
      <meta property="og:image" content="<?php echo $json[0]['images']; ?>" />
      <meta property="og:image:width" content="<?php echo $widthImg; ?>" />
      <meta property="og:image:height" content="<?php echo $heightImg; ?>" />
      <meta property="og:image:secure_url" content="<?php echo $json[0]['images']; ?>" />
      <meta property="og:image:alt" content="<?php echo $json[0]['title']; ?>" />
      <meta property="og:type" content="article" />
      <meta property="og:updated_time" content="<?php echo date_reformat2($json[0]['date_time'])."T".date('H:i:s')."+07:00"; ?>" />

      <meta name="twitter:card" content="summary_large_image" />
      <meta name="twitter:title" content="<?php echo $json[0]['title']; ?>" />
      <meta name="twitter:description" content="<?php echo $json[0]['title']; ?>" />
      <meta name="twitter:image" content="<?php echo $json[0]['images']; ?>" />
      <meta name="twitter:image:width" content="<?php echo $widthImg; ?>" />
      <meta name="twitter:image:height" content="<?php echo $heightImg; ?>" />
      <meta name="twitter:creator" content="<?php echo str_replace("https://twitter.com/", "", $twitter); ?>" />
      <meta name="twitter:site" content="<?php echo str_replace("https://twitter.com/", "", $twitter); ?>" />
      
      <meta name="DC.Title" content="<?php echo $json[0]['title']; ?>" />
      <meta name="DC.Creator" content="<?php echo $title?>" />
      <meta name="DC.Description" content="<?php echo $json[0]['title']; ?>" />
      <meta name="DC.date.issued" content="<?php echo date('Y-m-d'); ?>">

      <meta itemprop="image" content="<?php echo $json[0]['images']; ?>">

      <link rel="image_src" type="image/jpeg" href="<?php echo $json[0]['images']; ?>" />
      <link rel="canonical" href="<?php echo substr($ap_site,0,-1).$_SERVER['REQUEST_URI']; ?>">
    <?php
    }else{
      $sql_pid = "select * from ap_pages where id='$_GET[page_id]'";
      $query_pid = mysqli_query($conn,$sql_pid);
      $rows_pid = mysqli_fetch_array($query_pid);
      
      $rows_pid['info2'] = strip_tags($rows_pid['info2']);
      $rows_pid['info2'] = str_replace( "&nbsp;"," ",$rows_pid['info2']);

      /*$sizeImg = getimagesize($rows_pid['images']);
      $widthImg = $sizeImg['0'];
      $heightImg = $sizeImg['1'];*/

      $images = str_replace("$ap_site$ap_folder/", "", $rows_pid['images']);
      $apExp = explode("/", $images);
      $apCount = count($apExp);
      $images2 = $apExp[($apCount-1)];
      $dir = str_replace($images2, "", $images);

      $sizeImg = getimagesize("$dir/thumbs/thumb_m_$images2");
      $widthImg = $sizeImg['0'];
      $heightImg = $sizeImg['1'];

      $rows_pid['images'] = "$ap_site$ap_folder".str_replace("//", "/", "$dir/thumbs/thumb_m_$images2");
      ?>
      <title><?php echo $ap_page; ?> - <?php echo $rows_pid['title']; ?></title>
      <meta name="title" content="<?php echo $rows_pid['title']; ?>" />
      <meta name="keywords" content="<?php echo $rows_pid['keywords']; ?>" />
      <meta name="description" content="<?php echo $rows_pid['title']; ?><?php echo ', '.$keywords; ?>" />
      
      <meta property='og:url' content='<?php echo substr($ap_site,0,-1).$_SERVER['REQUEST_URI']; ?>' />
      <meta property="og:title" content="<?php echo $rows_pid['title']; ?>" />
      <meta property="og:description" content="<?php echo $title; ?>" />
      <meta property="fb:app_id" content="<?php echo $fb_id?>" />
      <meta property="og:image" content="<?php echo $rows_pid['images']; ?>" />
      <meta property="og:image:width" content="<?php echo $widthImg; ?>" />
      <meta property="og:image:height" content="<?php echo $heightImg; ?>" />
      <meta property="og:image:secure_url" content="<?php echo $rows_pid['images']; ?>" />
      <meta property="og:image:alt" content="<?php echo $rows_pid['title']; ?>" />
      <meta property="og:type" content="article" />
      <meta property="og:updated_time" content="<?php echo date_reformat2($rows_pid['date_time'])."T".date('H:i:s')."+07:00"; ?>" />

      <meta name="twitter:card" content="summary_large_image" />
      <meta name="twitter:title" content="<?php echo $rows_pid['title']; ?>" />
      <meta name="twitter:description" content="<?php echo $rows_pid['title']; ?>" />
      <meta name="twitter:image" content="<?php echo $rows_pid['images']; ?>" />
      <meta name="twitter:image:width" content="<?php echo $widthImg; ?>" />
      <meta name="twitter:image:height" content="<?php echo $heightImg; ?>" />
      <meta name="twitter:creator" content="<?php echo str_replace("https://twitter.com/", "", $twitter); ?>" />
      <meta name="twitter:site" content="<?php echo str_replace("https://twitter.com/", "", $twitter); ?>" />
      
      <meta name="DC.Title" content="<?php echo $rows_pid['title']; ?>" />
      <meta name="DC.Creator" content="<?php echo $title?>" />
      <meta name="DC.Description" content="<?php echo $rows_pid['title']; ?>" />
      <meta name="DC.date.issued" content="<?php echo date('Y-m-d'); ?>">

      <meta itemprop="image" content="<?php echo $rows_pid['images']; ?>">

      <link rel="image_src" type="image/jpeg" href="<?php echo $rows_pid['images']; ?>" />
      <link rel="canonical" href="<?php echo substr($ap_site,0,-1).$_SERVER['REQUEST_URI']; ?>">

      <script type="application/ld+json">
      {
        "@context":"https://schema.org",
        "@type":"BreadcrumbList",
        "itemListElement":
        [
          {
            "@type":"ListItem",
            "position":1,"item":
            {
              "@id":"<?php echo $ap_site.$ap_folder; ?>",
              "name":"<?php echo $title; ?>"
            }
          },
          {
            "@type":"ListItem",
            "position":2,
            "item":
            {
              "@id":"<?php echo substr($ap_site,0,-1).$_SERVER['REQUEST_URI']; ?>",
              "name":"<?php echo $rows_pid['title']; ?>",
              "image":"<?php echo $rows_pid['images']; ?>"
            }
          }
        ]
      }
      </script>
    <?php
    }
  }elseif(!empty($_GET['gal'])) {
    $sql_pid = "select * from ap_gallery where lang='$_GET[lang]' and code='$_GET[gal]'";
    $query_pid = mysqli_query($conn,$sql_pid);
    $rows_pid = mysqli_fetch_array($query_pid);
    $rows_pid['title'] = $rows_pid['name'];

    $sqlu = "select * from ap_users where user='$rows_pid[createBy]'";
    $queryu = mysqli_query($conn,$sqlu);
    $rowsu = mysqli_fetch_array($queryu);

    $allowed_types = array('JPG', 'jpg', 'JPEG', 'jpeg', 'GIF', 'gif', 'PNG', 'png');
    if($rows_pid['createByStatus'] == "Admin"){
      $dir = "contents/gallery/$rows_pid[code]/";
    }else{
      $dir = "contents/$rows_pid[createBy]/$rows_pid[code]/";
    }
    $files1 = scandir($dir);
    $total = 0;
    $pic_path = array();
    foreach ($files1 as $key => $value) {
      if ($key > 0) {
        $file_parts = explode('.', $value);
        $ext = strtolower(array_pop($file_parts));
        if (in_array($ext, $allowed_types)) {
          $pic_path[] = $dir.$value;
          $total++;
        }
      }
    }
    for ($indexPicture = 0; $indexPicture < $total; $indexPicture++) {
      $images = $pic_path[$indexPicture];
      if ($images) {
        if ($indexPicture == 0) {
            $rows_pid['images'] = $images;
        }
      }
    }
    
    $sizeImg = getimagesize($rows_pid['images']);
    $widthImg = $sizeImg['0'];
    $heightImg = $sizeImg['1'];
    ?>
    <title><?php echo $ap_page; ?> - <?php echo $rows_pid['title']; ?></title>
    <meta name="title" content="<?php echo $rows_pid['title']; ?>" />
    <meta name="keywords" content="<?php echo $rows_pid['title']; ?>" />
    <meta name="description" content="<?php echo $title?><?php echo ', '.$keywords; ?>" />
    
    <meta property='og:url' content='<?php echo substr($ap_site,0,-1).$_SERVER['REQUEST_URI']; ?>' />
    <meta property="og:title" content= "<?php echo $rows_pid['title']; ?>" />
    <meta property="og:description" content="<?php echo $rows_pid['title']; ?><?php echo ', '.$keywords; ?>" />
    <meta property="fb:app_id" content="<?php echo $fb_id?>" />
    <meta property="og:image" content="<?php echo $rows_pid['images']; ?>" />
    <meta property="og:image:width" content="<?php echo $widthImg; ?>" />
    <meta property="og:image:height" content="<?php echo $heightImg; ?>" />
    <meta property="og:image:secure_url" content="<?php echo $rows_pid['images']; ?>" />
    <meta property="og:image:alt" content="<?php echo $rows_pid['title']; ?>" />
    <meta property="og:type" content="article" />

    <meta name="twitter:card" content="summary_large_image" />
    <meta name="twitter:title" content="<?php echo $rows_pid['title']; ?>" />
    <meta name="twitter:description" content="<?php echo $rows_pid['title']; ?><?php echo ', '.$keywords; ?>" />
    <meta name="twitter:image" content="<?php echo $rows_pid['images']; ?>" />
    <meta name="twitter:image:width" content="<?php echo $widthImg; ?>" />
    <meta name="twitter:image:height" content="<?php echo $heightImg; ?>" />
    <meta name="twitter:creator" content="<?php echo str_replace("https://twitter.com/", "", $twitter); ?>" />
    <meta name="twitter:site" content="<?php echo str_replace("https://twitter.com/", "", $twitter); ?>" />
    
    <meta name="DC.Title" content="<?php echo $rows_pid['title']; ?>" />
    <meta name="DC.Creator" content="<?php echo $rowsu['dePart']; ?>" />
    <meta name="DC.Description" content="<?php echo $title?><?php echo ', '.$keywords; ?>" />
    <meta name="DC.date.issued" content="<?php echo date('Y-m-d'); ?>">

    <meta itemprop="image" content="<?php echo $rows_pid['images']; ?>">

    <link rel="image_src" type="image/jpeg" href="<?php echo $rows_pid['images']; ?>" />
    <link rel="canonical" href="<?php echo substr($ap_site,0,-1).$_SERVER['REQUEST_URI']; ?>">

    <script type="application/ld+json">
    {
      "@context":"https://schema.org",
      "@type":"BreadcrumbList",
      "itemListElement":
      [
        {
          "@type":"ListItem",
          "position":1,"item":
          {
            "@id":"<?php echo $ap_site.$ap_folder; ?>",
            "name":"<?php echo $title; ?>"
          }
        },
        {
          "@type":"ListItem",
          "position":2,
          "item":
          {
            "@id":"<?php echo substr($ap_site,0,-1).$_SERVER['REQUEST_URI']; ?>",
            "name":"<?php echo $rows_pid['title']; ?>",
            "image":"<?php echo $rows_pid['images']; ?>"
          }
        }
      ]
    }
    </script>
  <?php
  }elseif(!empty($_GET['gal2'])) {
    $sql_pid = "select * from ap_gallery2 where lang='$_GET[lang]' and code='$_GET[gal2]'";
    $query_pid = mysqli_query($conn,$sql_pid);
    $rows_pid = mysqli_fetch_array($query_pid);
    $rows_pid['title'] = $rows_pid['name'];

    $sqlu = "select * from ap_users where user='$rows_pid[createBy]'";
    $queryu = mysqli_query($conn,$sqlu);
    $rowsu = mysqli_fetch_array($queryu);

    $sizeImg = getimagesize($rows_pid['images']);
    $widthImg = $sizeImg['0'];
    $heightImg = $sizeImg['1'];
    ?>
    <title><?php echo $ap_page; ?> - <?php echo $rows_pid['title']; ?></title>
    <meta name="title" content="<?php echo $rows_pid['title']; ?>" />
    <meta name="keywords" content="<?php echo $rows_pid['title']; ?>" />
    <meta name="description" content="<?php echo $rows_pid['title']; ?>" />
    
    <meta property='og:url' content='<?php echo substr($ap_site,0,-1).$_SERVER['REQUEST_URI']; ?>' />
    <meta property="og:title" content= "<?php echo $rows_pid['title']; ?>" />
    <meta property="og:description" content="<?php echo $rows_pid['title']; ?>" />
    <meta property="fb:app_id" content="<?php echo $fb_id?>" />
    <meta property="og:image" content="<?php echo $rows_pid['images']; ?>" />
    <meta property="og:image:width" content="<?php echo $widthImg; ?>" />
    <meta property="og:image:height" content="<?php echo $heightImg; ?>" />
    <meta property="og:image:secure_url" content="<?php echo $rows_pid['images']; ?>" />
    <meta property="og:image:alt" content="<?php echo $rows_pid['title']; ?>" />
    <meta property="og:type" content="article" />

    <meta name="twitter:card" content="summary_large_image" />
    <meta name="twitter:title" content="<?php echo $rows_pid['title']; ?>" />
    <meta name="twitter:description" content="<?php echo $rows_pid['title']; ?><?php echo ', '.$keywords; ?>" />
    <meta name="twitter:image" content="<?php echo $rows_pid['images']; ?>" />
    <meta name="twitter:image:width" content="<?php echo $widthImg; ?>" />
    <meta name="twitter:image:height" content="<?php echo $heightImg; ?>" />
    <meta name="twitter:creator" content="<?php echo str_replace("https://twitter.com/", "", $twitter); ?>" />
    <meta name="twitter:site" content="<?php echo str_replace("https://twitter.com/", "", $twitter); ?>" />
    
    <meta name="DC.Title" content="<?php echo $rows_pid['title']; ?>" />
    <meta name="DC.Creator" content="<?php echo $rowsu['dePart']; ?>" />
    <meta name="DC.Description" content="<?php echo $rows_pid['title']; ?>" />
    <meta name="DC.date.issued" content="<?php echo date('Y-m-d'); ?>">

    <meta itemprop="image" content="<?php echo $rows_pid['images']; ?>">

    <link rel="image_src" type="image/jpeg" href="<?php echo $rows_pid['images']; ?>" />
    <link rel="canonical" href="<?php echo substr($ap_site,0,-1).$_SERVER['REQUEST_URI']; ?>">

    <script type="application/ld+json">
    {
      "@context":"https://schema.org",
      "@type":"BreadcrumbList",
      "itemListElement":
      [
        {
          "@type":"ListItem",
          "position":1,"item":
          {
            "@id":"<?php echo $ap_site.$ap_folder; ?>",
            "name":"<?php echo $title; ?>"
          }
        },
        {
          "@type":"ListItem",
          "position":2,
          "item":
          {
            "@id":"<?php echo substr($ap_site,0,-1).$_SERVER['REQUEST_URI']; ?>",
            "name":"<?php echo $rows_pid['title']; ?>",
            "image":"<?php echo $rows_pid['images']; ?>"
          }
        }
      ]
    }
    </script>
  <?php
  }else{
    $sizeImg = getimagesize("$logo");
    $widthImg = $sizeImg['0'];
    $heightImg = $sizeImg['1'];
    ?>
    <title><?php echo $title; ?></title>
    <meta name="title" content="<?php echo $title; ?>">
    <meta name="keywords" content="<?php echo $keywords_eng; ?>" />
    <meta name="keywords" lang="th" content="<?php echo $keywords; ?>" />
    <meta name="description" content="<?php if(!empty($description)){ echo $description; } ?><?php if(!empty($description2)){ echo ",$description2"; } ?><?php if(!empty($description3)){ echo ",$description3"; } ?>" />

    <meta property='og:url' content='<?php echo $ap_site.$ap_folder; ?>' />
    <meta property="og:title" content="<?php echo $title; ?>">
    <meta property="og:description" content="<?php if(!empty($description)){ echo $description; } ?>" />
    <meta property="fb:app_id" content="<?php echo $fb_id?>" />
    <meta property="og:image" type="image/jpeg" content="<?php echo $logo; ?>" />
    <meta property="og:image:width" content="<?php echo $widthImg; ?>" />
    <meta property="og:image:height" content="<?php echo $heightImg; ?>" />
    <meta property="og:image:secure_url" content="<?php echo $logo; ?>" />
    <meta property="og:image:alt" content="<?php echo $title; ?>" />
    <meta property="og:type" content="article" />

    <meta name="twitter:card" content="summary_large_image" />
    <meta name="twitter:title" content="<?php echo $title; ?>" />
    <meta name="twitter:description" content="<?php if(!empty($description)){ echo $description; } ?>" />
    <meta name="twitter:image" content="<?php echo $logo; ?>" />
    <meta name="twitter:image:width" content="<?php echo $widthImg; ?>" />
    <meta name="twitter:image:height" content="<?php echo $heightImg; ?>" />
    <meta name="twitter:creator" content="<?php echo str_replace("https://twitter.com/", "", $twitter); ?>" />
    <meta name="twitter:site" content="<?php echo str_replace("https://twitter.com/", "", $twitter); ?>" />

    <meta name="DC.Title" content="<?php echo $title; ?>" />
    <meta name="DC.Creator" content="<?php echo $title; ?>" />
    <meta name="DC.Description" content="<?php if(!empty($description)){ echo $description; } ?>" />
    <meta name="DC.date.issued" content="<?php echo date('Y-m-d'); ?>">

    <meta itemprop="image" content="<?php echo $logo; ?>">

    <link rel="image_src" type="image/jpeg" href="<?php echo $logo; ?>" />
    <link rel="canonical" href="<?php echo substr($ap_site,0,-1).$_SERVER['REQUEST_URI']; ?>">

    <script type="application/ld+json">
    {
      "@context":"https://schema.org",
      "@type":"BreadcrumbList",
      "itemListElement":
      [
        {
          "@type":"ListItem",
          "position":1,"item":
          {
            "@id":"<?php echo $ap_site.$ap_folder; ?>",
            "name":"<?php echo $title; ?>"
          }
        },
        {
          "@type":"ListItem",
          "position":2,
          "item":
          {
            "@id":"<?php echo $ap_site.$_SERVER['REQUEST_URI']; ?>",
            "name":"<?php echo $title; ?>",
            "image":"<?php echo $logo; ?>"
          }
        }
      ]
    }
    </script>
  <?php
  }
  ?>

  <link rel="pingback" href="<?php echo $ap_site.$ap_folder; ?>xmlrpc.php" />

  <meta name="google-site-verification" content="<?php echo $google_site_verification; ?>" />
  <meta name="yandex-verification" content="<?php echo $yandex_verification; ?>" />
  <meta name="msvalidate.01" content="<?php echo $bing_verification; ?>" />
  <meta name="majestic-site-verification" content="<?php echo $majestic_site_verification; ?>">
  
  <meta name="googlebot" content="index">
  <meta name="googlebot-news" content="snippet">
  <meta name="googlebot-image" content="imageindex">
  <meta name="yandex" content="all"/>
  <meta name="distribution" content="Thailand" />
  <meta name="revisit-after" content="1 days" />
  <meta name="expires" content="1 days" />
  <meta name="rating" content="5" />
  <meta name="copyright" content="&copy; <?php echo $title; ?> <?php echo $ap_site.$ap_folder; ?>" />

  <meta name="author" content="<?php echo $title; ?>" />
  <meta name="generator" content="Anucha Puangpaka" />

  <link rel="openid.delegate" content="<?php echo $ap_site.$ap_folder; ?>" />
  <link rel="alternate" hreflang="th" href="<?php echo $ap_site.$ap_folder; ?>" />
  <link rel="alternate" type="application/rss+xml" title="<?php echo $title; ?>" href="<?php echo $ap_site.$ap_folder; ?>feed.php" />
  <link rel="shortcut icon" href="<?php echo $favicon; ?>" />
  <link rel="icon" href="<?php echo $favicon; ?>" type="image/x-icon" />
  <link rel="apple-touch-icon" type="image/png" href="<?php echo $logo_touch; ?>">
  <link rel="apple-touch-icon-precomposed" type="image/png" href="<?php echo $logo_touch; ?>">
  <link rel="critical" hreflang="th" type="application/rss+xml" title="<?php echo $title; ?>" href="<?php echo $ap_site.$ap_folder; ?>feed.php">
  
  <link href="<?php echo $logo_touch; ?>" rel="apple-touch-icon" />
  <link href="<?php echo $favicon; ?>" rel="shortcut icon" type="image/x-icon" />
  
  <meta property="og:site_name" content="<?php echo $title; ?>" />
  <meta property="og:locale" content="<?php echo $locale; ?>" />
  
  <meta property="article:publisher" content="<?php echo $fb_page; ?>" />
  <meta property="article:author" content="<?php echo $ap_site.$ap_folder; ?>" />
  <meta property="article:tag" content="<?php echo $_SERVER['SERVER_NAME'].' '.$title; ?>" />
  
  <meta property="fb:admins" content="<?php echo $ap_fb_admins?>" />
  <meta property="fb:pages" content="<?php echo $fb_page_id; ?>" />

  <meta itemprop="name" content="<?php echo $rows['title']; ?>">

  <base href="<?php echo $ap_site.$ap_folder; ?>">
  <link rel="stylesheet" href="<?php echo $ap_site.$ap_folder; ?>dist/css/bootstrap.min.css">
  <link rel="stylesheet" href="<?php echo $ap_site.$ap_folder; ?>dist/css/bootstrap-theme.min.css">
  <link rel="stylesheet" href="<?php echo $ap_site.$ap_folder; ?>theme.css">

  <script src="<?php echo $ap_site.$ap_folder; ?>js/jquery.min.js" crossorigin="anonymous"></script>
  <script src="<?php echo $ap_site.$ap_folder; ?>dist/js/bootstrap.min.js" crossorigin="anonymous"></script>

  <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->

  <?php include_once('style.php'); ?>
  <!-- by Anucha Puangpaka -->

  <?php 
  if($_GET['box']==""){ 
  ?>
    <?php /* ?><script type="text/javascript" charset="utf-8">
    function webarchive(){
      $.ajax({
        url: "https://web.archive.org/save/<?php echo substr($ap_site,0,-1).$_SERVER['REQUEST_URI']; ?>",
        type: "POST",
        data: '<?php echo $title; ?>'
      })
    }
    webarchive();
    </script><?php */ ?>
    <!-- by Anucha Puangpaka -->

    <?php /* ?><div id="fb-root"></div>
    <script>(function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) return;
      js = d.createElement(s);
      js.id = id;

      js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.8&appId=<?php echo $fb_id; ?>";
      fjs.parentNode.insertBefore(js, fjs);
      }(document, 'script', 'facebook-jssdk'));
    </script><?php */ ?>

    <?php /* ?><script>
    APOptions = {
      elements: true;
    };
    </script>
    <script src="<?php echo $ap_site.$ap_folder; ?>js/AP.js"></script><?php */ ?>
    <!-- by Anucha Puangpaka -->

    <?php /* ?><script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js" crossorigin="anonymous"></script><?php */ ?>
    <script type="text/javascript" charset="utf-8">
    function get_notify(){
      $.ajax({
        url: "<?php echo $ap_site.$ap_folder; ?>notification.php",
        type: "POST",
        data: ''
      })
      .success(function(result) {
        var obj = jQuery.parseJSON(result);
        if(obj != ''){
          var messageid = null;
          var subject = null;
          $.each(obj, function(key, val) {
            messageid = val["id"] ;
            subject = val["title"] ;
          });

          showPopup(messageid,subject);
        }
      });
    }
    
    if(Notification.permission !== "granted") {
      Notification.requestPermission();
    }else{
      function showPopup(messageid,subject) {
        var mypicture = '<?php echo $logo_touch; ?>';
        var titletext = '<?php echo $ap_new_infomation; ?>';
        var bodytext = subject;
        var popup = new Notification(titletext, {
          icon: mypicture,
          body: subject,
        });

        popup.onclick = function () {
          <?php 
          if($ap_rewrite == "on"){ 
          ?>
            window.open("<?php echo $ap_site.$ap_folder; ?>page_id/"+messageid+"/<?php echo $_GET['lang']; ?>");
          <?php 
          }else{
          ?>
            window.open("<?php echo $ap_site.$ap_folder; ?>?page_id="+messageid+"&lang=<?php echo $_GET['lang']; ?>");
          <?php 
          } 
          ?>
        };
      }
    }

    function usersOnline(){
      var token = "";
      $.ajax({
        cache: false,
        data: {
          token: token,
        },
        type: 'GET',
        url: "<?php echo $ap_site.$ap_folder; ?>usersonline.php",
        dataType: 'json',
        success: function (data, status, jqXHR){
          $('#usersOnline').text(data.usersOnline);
          token = data.token;
        }
      });
    }

    $(document).ready(function(){
      setInterval(function(){
        get_notify();
      },60000);
    });
    </script>
    <!-- by Anucha Puangpaka -->
  <?php
  }
  ?>

  <script>
  function MM_openBrWindow(theURL,winName,features) {
    window.open(theURL,winName,features);
  }
  </script>

  <?php 
  if($_SERVER['HTTPS']=="on"){
  ?>
    <script>
    if(navigator.geolocation) {
      navigator.geolocation.getCurrentPosition(showPosition);
    }
    function showPosition(position) {
      <?php /* ?>document.cookie = 'lat=' + position.coords.latitude;
      document.cookie = 'lng=' + position.coords.longitude;<?php */ ?>
      document.cookie = 'lat=' + position.coords.latitude + '; path=/; Secure; SameSite=Lax';
      document.cookie = 'lng=' + position.coords.longitude + '; path=/; Secure; SameSite=Lax';
    }
    </script>
  <?php 
  } 
  ?>
  
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css">

  <?php if(!empty($google_analytics)){ ?>
  <!-- Global site tag (gtag.js) - Google Analytics -->
  <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo $google_analytics; ?>"></script>
  <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());

    gtag('config', '<?php echo $google_analytics; ?>');
  </script>
  <?php } ?>

  <?php if(!empty($google_tag_manager)){ ?>
  <!-- Google Tag Manager -->
  <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
  new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
  j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
  'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
  })(window,document,'script','dataLayer','<?php echo $google_tag_manager; ?>');</script>
  <!-- End Google Tag Manager -->
  <?php } ?>
</head>
<body>
	
  <?php if(!empty($google_tag_manager)){ ?>
  <!-- Google Tag Manager (noscript) -->
  <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=<?php echo $google_tag_manager; ?>"
  height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
  <!-- End Google Tag Manager (noscript) -->
  <?php } ?>