403Webshell
Server IP : 119.59.102.212  /  Your IP : 3.15.182.56
Web Server : Apache/2
System : Linux narin 2.6.32-042stab142.1 #1 SMP Tue Jan 28 23:44:17 MSK 2020 x86_64
User : yangkam ( 1022)
PHP Version : 5.6.40
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/yangkam/domains/yangkam.go.th/public_html/coremain/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/yangkam/domains/yangkam.go.th/public_html/coremain/function_theme.php
<?php
import_request_variables('pG', 'p_');
//#5.3#//if($p_select!="")								{	 $select=trim($p_select);			}
$select = isset($p_select) ? $p_select : '';

if($select!=""){
	$sql="update cms_main_themes set status=0 where status=1";
	$result=mysql_query($sql);

	$sqlch="SELECT * FROM cms_main_themes WHERE id='$select'";
	$re=mysql_query($sqlch);
	$d=mysql_num_rows($re);
     if($d==1){
		$sql="update cms_main_themes set status='1' where id='$select'";
		$result=mysql_query($sql);
	 }else{
			 $sql="INSERT INTO `cms_main_themes` VALUES('$select', '#AFB98A', '1', 'f01.swf', 'f02.jpg', '#66CD00', '#c9d4e5', '#e9b4da', '#B0DE00', '#F8FCE2', '#C2DFCA', '#77a091', 'menu1', 'top_1.jpg', 'top_2.jpg', 'top_3.jpg', 1, 0, '#9cbbea', '#daff6a', '', '', '', '', 'marker.gif')";
			 $re=mysql_query($sql);

			$sql="update cms_main_themes set status='1' where id='$select'";
			$result=mysql_query($sql);	 
	 }
}


		$sql="SELECT * FROM cms_main_themes WHERE status='1'";		
		$re=mysql_query($sql);
		$data=mysql_fetch_array($re);
			
			$_SESSION['themes_']="$data[id]"; 							// version_theme
			$_SESSION['title_color']="$data[title_color]";				// title_color
			$_SESSION['bg_body2']="$data[color1]";						// bg_body2

			// table color
			$_SESSION["tb_bgcolor"]="$data[bg_textrun]";				// table bgcolor
			$_SESSION["tb_row_color1"]="$data[color]";	    			// table row bgcolor 1  for swap color
			$_SESSION["tb_row_color2"]="$data[color1]";	    			// table row bgcolor 2  for swap color
			$_SESSION["menu"]="$data[menu_ccs]";						// menu_css
			$_SESSION["tb_head_bgcolor"]="$data[bg_menu]";				
			
			$_SESSION['bg_textrun']="$data[bg_textrun]";				//กลาง
			$_SESSION['bg_header']="$data[heder_color]";				
							
			$_SESSION['bg_line']="$data[line_title_table]";				//เข้ม
			
			$_SESSION['bg_menu']="$data[bg_menu]";					//อ่อน

			//สีตัวอักษร
			$_SESSION['bg_body1']="$data[color]";																// Font Color

			//ขนาดความสูงของ Footer
			$_SESSION['herder_top_03']="$data[herder_top_03]";									//ขนาดความสูงของ Footer		
	
			
			//menu font color
			$_SESSION["head_menu_color"] = $data['h_menu_color'];
			$_SESSION["sub_menu_color"] =  $data['sub_menu_color'];

			// font footer
			$_SESSION["footer_head"] = $data['footer_head'];
			$_SESSION["footer_sub"] =  $data['footer_sub'];

			// Image_Menu
			$_SESSION["image_menu"] = isset($data['image_menu']) ? $data['image_menu'] : 'menu.jpg';

			// Flash Header
			$_SESSION["flash"] = $data['flash'];
			$_SESSION["flash_width"] = isset($data['footer_head']) && $data['footer_head'] > 0 ? $data['footer_head'] : ($_SESSION["flash_width"] != '' ? $_SESSION["flash_width"] : '100%');
			$_SESSION["flash_height"] = isset($data['footer_sub']) && $data['footer_sub'] > 0 ? $data['footer_sub'] : ($_SESSION["flash_height"] != '' ? $_SESSION["flash_height"] : '');

			// Background
			$_SESSION["background1"] = $data['herder_top_01'];
			$_SESSION["background2"] = isset($data['sub_menu_color']) ? $data['sub_menu_color'] : 'background.gif';
			$_SESSION["background3"] = $data['herder_top_02'];

			// Footer
			$_SESSION["footer_bg"] = isset($data['h_menu_color']) ? $data['h_menu_color'] : 'footer.gif';

			// Navagator
			$_SESSION["header_navigator"] = isset($data['header_navigator']) ? $data['header_navigator'] : 'navagator.jpg';
			$_SESSION["height_navigator"] = isset($data['height_navigator']) ? $data['height_navigator'] : '30';		
			$_SESSION["icon_navigator"] = isset($data['icon_navigator']) ? $data['icon_navigator'] : (file_exists("$_SESSION[web_name]/theme/$_SESSION[themes_]/$data[image_menu]") ? $data['image_menu'] : 'icon.gif');		
            // Bar Header
 			$_SESSION["bar_header1"] = isset($data['header_navigator']) ? $data['navigrator'] : (file_exists("$_SESSION[web_name]/theme/$_SESSION[themes_]/bar1.gif") ? 'bar1.gif' : 'bar01.gif');
			$_SESSION["bar_header2"] = isset($data['header_navigator']) ? $data['title_color'] : (file_exists("$_SESSION[web_name]/theme/$_SESSION[themes_]/bar1.gif") ? 'bar2.gif' : 'bar02.gif');
			$_SESSION["bar_header3"] = isset($data['header_navigator']) ? $data['bg_list_table'] : (file_exists("$_SESSION[web_name]/theme/$_SESSION[themes_]/bar1.gif") ? 'bar3.gif' : 'bar03.gif');
            
            if(!isset($data['home_template'])){
              mysql_query("ALTER TABLE `cms_main_themes` ADD `home_template` VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 't01';");
              mysql_query("ALTER TABLE `cms_main_themes` CHANGE `h_menu_color` `h_menu_color` VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;");
              mysql_query("ALTER TABLE `cms_main_themes` CHANGE `sub_menu_color` `sub_menu_color` VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;");
              $_SESSION['template'] = 't01';
              
              $chkMTemplate = mysql_query("SELECT id_sub FROM cms_menu_sub WHERE name = 'เปลี่ยนรูปแบบ/Template'");
              $MTemplate = mysql_num_rows($chkMTemplate);
              if($MTemplate == 0){
                $queOrder = mysql_query("SELECT MAX(position) AS position FROM cms_menu_sub WHERE id_top = '1'");
                $objOrder = mysql_fetch_assoc($queOrder);
                $mxOrder = $objOrder['position'] + 1;
                mysql_query("INSERT INTO `cms_menu_sub` (`id_sub`, `id_top`, `id_type`, `name`, `url`, `position`, `status`) VALUES ('0', '1', '1', 'เปลี่ยนรูปแบบ/Template', 'index.php?mod=manage_template&path=template', '$mxOrder', '1');");
                mysql_query("UPDATE `cms_menu_sub` SET name = 'เปลี่ยน Banner/พื้นหลัง/Footer' WHERE name = 'เปลี่ยน Flash/พื้นหลัง/Footer';");
              
                set_menu_graphic();
              }
            }else{
              $_SESSION['template'] = $data['home_template'];
            }
  
//##### New Module #####//
$chkModuleQuestion = mysql_query("select * from cms_module where e_name = 'question'");
$numModuleQuestion = mysql_num_rows($chkModuleQuestion);
if($numModuleQuestion == 0){
  //##### 1 - Questionnaire #####//
  mysql_query("insert into cms_module (name, allow, e_name) values ('แบบสอบถาม', '3', 'question')");
  
  mysql_query("CREATE TABLE `cms_question` (
                `id_question` int(11) NOT NULL PRIMARY KEY,
                `topic` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
                `status` int(11) NOT NULL DEFAULT '1',
                `id_sub` int(11) NOT NULL
              ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
  mysql_query("CREATE TABLE `cms_question_ansheader` (
                `header_id` int(11) NOT NULL PRIMARY KEY,
                `question_id` int(11) NOT NULL,
                `user_ip` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
                `datetime` varchar(50) COLLATE utf8_unicode_ci NOT NULL
              ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
  mysql_query("CREATE TABLE `cms_question_answer` (
                `answer_id` int(11) NOT NULL PRIMARY KEY,
                `header_id` int(11) NOT NULL,
                `question_id` int(11) NOT NULL,
                `title_id` int(11) NOT NULL,
                `type_id` int(11) NOT NULL,
                `parent_id` int(11) NOT NULL,
                `answer` text COLLATE utf8_unicode_ci NOT NULL
              ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
  mysql_query("CREATE TABLE `cms_question_choice` (
                `choice_id` int(11) NOT NULL PRIMARY KEY,
                `choice_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
                `choice_order` int(11) NOT NULL,
                `title_id` int(11) NOT NULL,
                `question_id` int(11) NOT NULL,
                `choice_status` int(11) NOT NULL DEFAULT '1'
              ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
  mysql_query("CREATE TABLE `cms_question_title` (
                `title_id` int(11) NOT NULL PRIMARY KEY,
                `title_name` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
                `title_parent` int(11) NOT NULL,
                `title_order` int(11) NOT NULL,
                `question_id` int(11) NOT NULL,
                `type_id` int(11) NOT NULL,
                `title_other` int(11) NOT NULL DEFAULT '0',
                `title_status` int(11) NOT NULL DEFAULT '1',
                `title_validate` int(11) NOT NULL DEFAULT '1'
              ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
  mysql_query("CREATE TABLE `cms_question_type` (
                `type_id` int(11) NOT NULL PRIMARY KEY,
                `type_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL
              ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
  mysql_query("INSERT INTO `cms_question_type` (`type_id`, `type_name`) VALUES
                  (1, 'ถาม-ตอบ'),
                  (2, 'ระดับความพึงพอใจ'),
                  (3, 'ตอบได้หลายข้อ'),
                  (4, 'ตอบได้ข้อเดียว'),
                  (5, 'ข้อเสนอแนะ'),
                  (6, 'คำอธิบาย');");
  
  //##### 2 - E-Service #####//
  mysql_query("CREATE TABLE `cms_eservice` (
                `id` int(11) NOT NULL PRIMARY KEY,
                `type_id` int(11) NOT NULL,
                `topic` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
                `detail` text COLLATE utf8_unicode_ci NOT NULL,
                `sender_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
                `sender_tel` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
                `sender_mail` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
                `send_date` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
                `sender_ip` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
                `file_attach` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
                `service_status` int(11) NOT NULL DEFAULT '0' COMMENT '0:receive, 1:waiting, 2:complete, 3:information',
                `remark` text COLLATE utf8_unicode_ci NOT NULL
              ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
  mysql_query("CREATE TABLE `cms_service_title` (
                `title_id` int(11) NOT NULL PRIMARY KEY,
                `title_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
                `title_status` int(11) NOT NULL DEFAULT '1'
              ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
  mysql_query("INSERT INTO `cms_service_title` (`title_id`, `title_name`, `title_status`) VALUES
                  (1, 'รับเรื่องราวร้องทุกข์', 1),
                  (2, 'ร้องเรียนการทุจริต', 1),
                  (3, 'สายตรงนายกองค์การบริหารส่วนตำบล', 1),
                  (4, 'สายตรงปลัดองค์การบริหารส่วนตำบล', 1);");


  //##### 3 - EGP #####//
  mysql_query("CREATE TABLE `cms_egprss` (
                `egp_id` int(11) NOT NULL,
                `egp_title` varchar(500) NOT NULL,
                `egp_description` varchar(250) NOT NULL,
                `egp_rss_title` varchar(500) NOT NULL,
                `egp_rss_link` varchar(500) NOT NULL,
                `egp_rss_pub_date` date NOT NULL,
                `egp_date` date NOT NULL,
                `id_home` int(11) NOT NULL
              ) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
  
  
  // default questionnaire
    # main blog
    $sqlTop = "select max(id_top+1) from cms_menu_top";
    $queTop = mysql_query($sqlTop);
    $maxTop = mysql_fetch_row($queTop);
    $sqlPos = "select max(`position`+1) from cms_menu_top where left_right = '2'";
    $quePos = mysql_query($sqlPos);
    $maxPos = mysql_fetch_row($quePos);
    mysql_query("INSERT INTO cms_menu_top (id_top, name, position, left_right, `status`, `lock`, module_type, permission) values ('$maxTop[0]', 'แบบสอบถาม', '$maxPos[0]', '2', '1', 1, 'link', 0)");
    # sub menu
    $sqlSub = "select max(id_sub+1) from `cms_menu_sub`";
    $queSub = mysql_query($sqlSub);
    $maxSub = mysql_fetch_row($queSub);
    $url = "index.php?mod=question&path=question&id_sub=$maxSub[0]";
    $menuname = 'แบบสอบถามความพึงพอใจต่อการให้บริการ';
    mysql_query("INSERT INTO `cms_menu_sub` (`id_sub`, `id_top`, `id_type`, `name`, `url`, `position`, `status`) VALUES ('$maxSub[0]', '$maxTop[0]', '1', '$menuname', '$url', '1', '1')");
    # main question
    $sqlQst = "select max(id_question) + 1 from cms_question";
    $queQst = mysql_query($sqlQst);
    $maxQst = mysql_fetch_row($queQst);
    $QstId = $maxQst[0] == '' ? 1 : $maxQst[0];
    mysql_query("INSERT INTO cms_question (id_question, topic, id_sub) VALUES ('$QstId', '$menuname', '$maxSub[0]')");
    # question title
    $sqlMain = "select name_web from cms_main_data where id_main_data = '1'";
    $queMain = mysql_query($sqlMain);
    $objMain = mysql_fetch_row($queMain);
    $MainName = $objMain[0];
    mysql_query("INSERT INTO `cms_question_title` (`title_id`, `title_name`, `title_parent`, `title_order`, `question_id`, `type_id`, `title_other`, `title_status`, `title_validate`) VALUES
      (1, 'แบบสอบถามความพึงพอใจ', 0, 1, 1, 6, 0, 1, 1),
      (2, '<p> $MainName ได้จัดทำแบบสอบถามความพึงพอใจของประชาชนที่มีต่อการให้บริการของ$MainName หรือหน่วยงานต่างๆ ที่มาติดต่อใช้บริการงานด้านต่างๆ ของ$MainName เพื่อนำข้อมูลที่ได้จากการสำรวจนี้มาประมวลสรุปผลลัพธ์ทำแผนปรับปรุงการให้บริการ และดำเนินการแก้ไขข้อบกพร่องของการบริการด้านต่างๆ ให้มีประสิทธิภาพ และตรงกับความต้องการของผู้รับบริการมากยิ่งขึ้นต่อไป</p>\r\n', 1, 1, 1, 0, 0, 1, 1),
      (3, 'ส่วนที่ 1 : ข้อมูลทั่วไปผู้ขอรับบริการ', 0, 2, 1, 1, 0, 1, 1),
      (4, 'ชื่อผู้ขอรับบริการ (บุคคลหรือหน่วยงาน)', 3, 1, 1, 0, 0, 1, 1),
      (5, 'ที่อยู่ผู้ขอรับบริการ', 3, 2, 1, 0, 0, 1, 0),
      (6, 'โทรศัพท์ผู้ขอรับบริการ', 3, 3, 1, 0, 0, 1, 1),
      (7, 'ขอรับบริการจาก (ชื่อหน่วยงานผู้ให้บริการ)', 3, 4, 1, 0, 0, 1, 1),
      (8, 'ส่วนที่ 2 : เรื่องที่ขอรับบริการ', 0, 3, 1, 4, 0, 1, 1),
      (9, 'การขอข้อมูลข่าวสารทางราชการ', 8, 1, 1, 0, 0, 1, 1),
      (10, 'การยื่นเรื่องร้องทุกข์/ร้องเรียน', 8, 2, 1, 0, 0, 1, 1),
      (11, 'การใช้ Internet ตำบล', 8, 3, 1, 0, 0, 1, 1),
      (12, 'การขออนุญาตปลูกสร้างอาคาร', 8, 4, 1, 0, 0, 1, 1),
      (13, 'การขอแบบบ้านเพื่อประชาชน', 8, 5, 1, 0, 0, 1, 1),
      (14, 'การออกแบบอาคาร', 8, 6, 1, 0, 0, 1, 1),
      (15, 'การชำระภาษีโรงเรือนและที่ดิน', 8, 7, 1, 0, 0, 1, 1),
      (16, 'การชำระภาษีป้าย', 8, 8, 1, 0, 0, 1, 1),
      (17, 'การชำระภาษีบำรุงท้องที่', 8, 9, 1, 0, 0, 1, 1),
      (18, 'การขอรับเบี้ยยังชีพผู้สูงอายุ', 8, 10, 1, 0, 0, 1, 1),
      (19, 'การขอรับเบี้ยยังชีพคนพิการ', 8, 11, 1, 0, 0, 1, 1),
      (20, 'การขอรับเบี้ยยังชีพผู้ป่วยโรคเอดส์', 8, 12, 1, 0, 0, 1, 1),
      (21, 'การฉีดวัคซีนป้องกันโรคพิษสุนัขบ้า', 8, 13, 1, 0, 0, 1, 1),
      (22, 'การฉีดพ่นสารเคมีเพื่อป้องกันโรคไข้เลือดออก', 8, 14, 1, 0, 0, 1, 1),
      (23, 'การขอจัดตั้งสถานจำหน่ายอาหารและสะสมอาหาร', 8, 15, 1, 0, 0, 1, 1),
      (24, 'การขอประกอบกิจการที่เป็นอันตรายต่อสุขภาพ', 8, 16, 1, 0, 0, 1, 1),
      (25, 'การสมัครเข้าเรียนในศูนย์ศิลปวัฒนธรรม และภูมิปัญญาท้องถิ่น', 8, 17, 1, 0, 0, 1, 1),
      (26, 'อื่นๆ', 8, 18, 1, 0, 1, 1, 1),
      (27, 'ส่วนที่ 3 : แบบสอบถามความพึงพอใจที่มีต่อการให้บริการ', 0, 4, 1, 6, 0, 1, 1),
      (28, '<p>หัวข้อแบบสอบถามความพึงพอใจ</p>\r\n', 27, 1, 1, 0, 0, 1, 1),
      (29, '1. ด้านเจ้าหน้าที่ผู้ให้บริการ', 0, 5, 1, 2, 0, 1, 1),
      (30, 'เจ้าหน้าที่พูดจาสุภาพ อัธยาศัยดี แต่งกายสุภาพ การวางตัว เรียบร้อย', 29, 1, 1, 0, 0, 1, 1),
      (31, 'เจ้าหน้าที่ให้บริการด้วยความเต็มใจ รวดเร็ว และเอาใจใส่', 29, 2, 1, 0, 0, 1, 1),
      (32, 'เจ้าหน้าที่ให้คำแนะนำ ตอบข้อซักถามได้อย่างชัดเจน ถูกต้อง น่าเชื่อถือ', 29, 3, 1, 0, 0, 1, 1),
      (33, 'เจ้าหน้าที่สามารถแก้ปัญหา อุปสรรค ที่เกิดขึ้นได้อย่างเหมาะสม', 29, 4, 1, 0, 0, 1, 1),
      (34, '2. ด้านกระบวนการขั้นตอนการให้บริการ', 0, 6, 1, 2, 0, 1, 1),
      (35, 'มีช่องทางการให้บริการที่หลากหลาย', 34, 1, 1, 0, 0, 1, 1),
      (36, 'ขั้นตอนการให้บริการมีระบบ ไม่ยุ่งยาก ซับซ้อน มีความชัดเจน', 34, 2, 1, 0, 0, 1, 1),
      (37, 'ขั้นตอนการให้บริการแต่ละขั้นตอนมีความสะดวก รวดเร็ว', 34, 3, 1, 0, 0, 1, 1),
      (38, 'มีผังลำดับขั้นตอนและระยะเวลาการให้บริการอย่างชัดเจน', 34, 4, 1, 0, 0, 1, 1),
      (39, '3. ด้านสิ่งอำนวยความสะดวก', 0, 7, 1, 2, 0, 1, 1),
      (40, 'การจัดสิ่งอำนวยความสะดวกในสถานที่ให้บริการ เช่น ที่จอดรถ น้ำดื่ม', 39, 1, 1, 0, 0, 1, 1),
      (41, 'มีเครื่องมือ/อุปกรณ์/ระบบในการบริการข้อมูลสารสนเทศ', 39, 2, 1, 0, 0, 1, 1),
      (42, 'มีการจัดผังการให้บริการและการใช้อาคารไว้อย่างชัดเจนสะดวก เหมาะสม', 39, 3, 1, 0, 0, 1, 1),
      (43, 'อาคารสถานที่มีความสะอาด ปลอดภัย', 39, 4, 1, 0, 0, 1, 1),
      (44, 'ส่วนที่ 4 : ท่านคิดว่า $MainName ควรปรับปรุงด้านใด (ตอบได้มากกว่า 1 ข้อ)', 0, 8, 1, 3, 0, 1, 1),
      (45, 'ด้านการให้บริการของเจ้าหน้าที่ในหน่วยงาน', 44, 1, 1, 0, 0, 1, 1),
      (46, 'ด้านข้อมูลข่าวสารที่ให้บริการแก่ประชาชน', 44, 2, 1, 0, 0, 1, 1),
      (47, 'ด้านสถานที่ในการบริการข้อมูลข่าวสาร', 44, 3, 1, 0, 0, 1, 1),
      (48, 'ด้านวิธีการเข้ามามีส่วนร่วมของประชาชนในการจัดทำแผนพัฒนา', 44, 4, 1, 0, 0, 1, 1),
      (49, 'ด้านบริการการรับชำระภาษี', 44, 5, 1, 0, 0, 1, 1),
      (50, 'ด้านบริการการอนุญาตก่อสร้างอาคาร', 44, 6, 1, 0, 0, 1, 1),
      (51, 'อื่นๆ', 44, 7, 1, 0, 1, 1, 1),
      (52, 'ข้อเสนอแนะ', 0, 9, 1, 5, 0, 1, 1);");
    mysql_query("INSERT INTO `cms_question_choice` (`choice_id`, `choice_name`, `choice_order`, `title_id`, `question_id`, `choice_status`) VALUES
      (1, 'มากที่สุด', 1, 29, 1, 1),
      (2, 'มาก', 2, 29, 1, 1),
      (3, 'ปานกลาง', 3, 29, 1, 1),
      (4, 'น้อย', 4, 29, 1, 1),
      (5, 'ควรปรับปรุง', 5, 29, 1, 1),
      (6, 'มากที่สุด', 1, 34, 1, 1),
      (7, 'มาก', 2, 34, 1, 1),
      (8, 'ปานกลาง', 3, 34, 1, 1),
      (9, 'น้อย', 4, 34, 1, 1),
      (10, 'ควรปรับปรุง', 5, 34, 1, 1),
      (11, 'มากที่สุด', 1, 39, 1, 1),
      (12, 'มาก', 2, 39, 1, 1),
      (13, 'ปานกลาง', 3, 39, 1, 1),
      (14, 'น้อย', 4, 39, 1, 1),
      (15, 'ควรปรับปรุง', 5, 39, 1, 1);");
}

chmod($_SESSION['web_name'], 0755);
# create folder for e-service
$dir_eservice = $_SESSION['web_name'].'/module_eservice/';
if($_SESSION['web_name'] != '' && !is_dir($dir_eservice)){
  mkdir($dir_eservice, 0755, true);
}
# create folder for e-service1 # 25032021
$dir_eservice1 = $_SESSION['web_name'].'/module_eservice1/';
if($_SESSION['web_name'] != '' && !is_dir($dir_eservice1)){
  mkdir($dir_eservice1, 0755, true);
  
  //##### 25/03/2021 : E-Service1 #####//
  mysql_query("CREATE TABLE `cms_eservice1` (
                `id` int(11) NOT NULL PRIMARY KEY,
                `type_id` int(11) NOT NULL,
                `topic` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
                `detail` text COLLATE utf8_unicode_ci NOT NULL,
                `sender_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
                `sender_tel` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
                `sender_mail` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
                `send_date` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
                `sender_ip` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
                `file_attach` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
                `service_status` int(11) NOT NULL DEFAULT '0' COMMENT '0:receive, 1:waiting, 2:complete, 3:information',
                `remark` text COLLATE utf8_unicode_ci NOT NULL
              ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
  //##### 26/03/2021 #####//
  mysql_query("CREATE TABLE `cms_service_title1` (
                `title_id` int(11) NOT NULL PRIMARY KEY,
                `title_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
                `title_status` int(11) NOT NULL DEFAULT '1'
              ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
  mysql_query("INSERT INTO `cms_service_title1` (`title_id`, `title_name`, `title_status`) VALUES
                  (1, 'คำร้องขอใช้รถน้ำ', 1),
                  (2, 'คำร้องขอใช้น้ำประปา', 1);");
}
# create folder for file editor thumb
$dir_editor = $_SESSION['web_name'].'/file_thumbs/';
if($_SESSION['web_name'] != '' && !is_dir($dir_editor)){
  mkdir($dir_editor, 0755, true);
}
chmod($_SESSION['web_name'], 0555);
//####### End New Module ########//

$template = isset($p_template) ? $p_template : '';
if($template != ''){
  $currTemplate = $_SESSION['template'];
  $_SESSION['template'] = $template;
  
  $menu_top = array();
  $menu_count = array('1' => 0, '2' => 0, '3' => 0);
//  $template_34 = array('boss_message' => '1', 'calendar' => '2', 'service' => '3', 'poll' => '4', 'counter' => '5');
  $template_78 = array('calendar' => '1', 'service' => '2', 'web_link' => '3', 'poll' => '4', 'counter' => '5');
  $sel_menu = "SELECT * FROM cms_menu_top WHERE module_type!='other' and `lock`='1' ORDER BY left_right, position";
  $que_menu = mysql_query($sel_menu);
  $count = 0;
  while($obj_menu = mysql_fetch_assoc($que_menu)){
//    $menu_top[$obj_menu['id_top']] = $obj_menu;
//    $menu_order[$obj_menu['position']] = $obj_menu;
    $menu_top[$count] = $obj_menu;
    $curr_blog[$obj_menu['left_right']] = $obj_menu['left_right'];
    ++$count;
  }
  sort($curr_blog);
  $str_blog = implode('', $curr_blog);
  $half = round($count / 2);
  
  $array_menu = array();
  if($currTemplate == 't07') # 123
  {
    if(in_array($template, array('t01', 't02'))){ # 12
      foreach($menu_top as $codr => $obj){
        if($codr < $half){
          ++$menu_count[1];
          $obj['new_order'] = $menu_count[1];
          $array_menu[1][$obj['id_top']] = $obj;
        }else{
          ++$menu_count[2];
          $obj['new_order'] = $menu_count[2];
          $array_menu[2][$obj['id_top']] = $obj;
        }
      }
    }else if(in_array($template, array('t03', 't05', 't09'))){ # 13
      foreach($menu_top as $codr => $obj){
        if($codr < $half){
          ++$menu_count[1];
          $obj['new_order'] = $menu_count[1];
          $array_menu[1][$obj['id_top']] = $obj;
        }else{
          ++$menu_count[3];
          $obj['new_order'] = $menu_count[3];
          $array_menu[3][$obj['id_top']] = $obj;
        }
      }
    }else if(in_array($template, array('t04', 't06', 't10'))){ # 23
      foreach($menu_top as $codr => $obj){
        if($codr < $half){
          ++$menu_count[2];
          $obj['new_order'] = $menu_count[2];
          $array_menu[2][$obj['id_top']] = $obj;
        }else{
          ++$menu_count[3];
          $obj['new_order'] = $menu_count[3];
          $array_menu[3][$obj['id_top']] = $obj;
        }
      }
    }else if($template == 't08'){ # 213
      foreach($menu_top as $obj){
        if($obj['left_right'] == 3){
          ++$menu_count[3];
          $obj['new_order'] = $menu_count[3];
          $array_menu[3][$obj['id_top']] = $obj;
        }else if($obj['left_right'] == 1){
          ++$menu_count[2];
          $obj['new_order'] = $menu_count[2];
          $array_menu[2][$obj['id_top']] = $obj;
        }else{
          ++$menu_count[1];
          $obj['new_order'] = $menu_count[1];
          $array_menu[1][$obj['id_top']] = $obj;
        }
      }
    }else{
      foreach($menu_top as $obj){
        ++$menu_count[$obj['left_right']];
        $obj['new_order'] = $menu_count[$obj['left_right']];
        $array_menu[$obj['left_right']][$obj['id_top']] = $obj;
      }
    }
  }
  else if($currTemplate == 't08') # 213
  {
    if(in_array($template, array('t01', 't02'))){ # 12
      foreach($menu_top as $codr => $obj){
        if($codr < $half){
          ++$menu_count[1];
          $obj['new_order'] = $menu_count[1];
          $array_menu[1][$obj['id_top']] = $obj;
        }else{
          ++$menu_count[2];
          $obj['new_order'] = $menu_count[2];
          $array_menu[2][$obj['id_top']] = $obj;
        }
      }
    }else if(in_array($template, array('t03', 't05', 't09'))){ # 13
      foreach($menu_top as $codr => $obj){
        if($codr < $half){
          ++$menu_count[1];
          $obj['new_order'] = $menu_count[1];
          $array_menu[1][$obj['id_top']] = $obj;
        }else{
          ++$menu_count[3];
          $obj['new_order'] = $menu_count[3];
          $array_menu[3][$obj['id_top']] = $obj;
        }
      }
    }else if(in_array($template, array('t04', 't06', 't10'))){ # 23
      foreach($menu_top as $codr => $obj){
        if($codr < $half){
          ++$menu_count[2];
          $obj['new_order'] = $menu_count[2];
          $array_menu[2][$obj['id_top']] = $obj;
        }else{
          ++$menu_count[3];
          $obj['new_order'] = $menu_count[3];
          $array_menu[3][$obj['id_top']] = $obj;
        }
      }
    }else if($template == 't07'){ # 123
      foreach($menu_top as $obj){
        if($obj['left_right'] == 3){
          ++$menu_count[3];
          $obj['new_order'] = $menu_count[3];
          $array_menu[3][$obj['id_top']] = $obj;
        }else if($obj['left_right'] == 1){
          ++$menu_count[2];
          $obj['new_order'] = $menu_count[2];
          $array_menu[2][$obj['id_top']] = $obj;
        }else{
          ++$menu_count[1];
          $obj['new_order'] = $menu_count[1];
          $array_menu[1][$obj['id_top']] = $obj;
        }
      }
    }else{
      foreach($menu_top as $obj){
        ++$menu_count[$obj['left_right']];
        $obj['new_order'] = $menu_count[$obj['left_right']];
        $array_menu[$obj['left_right']][$obj['id_top']] = $obj;
      }
    }
  }
  else
  {
    if($str_blog == '12') # t01, t02
    {
      if(in_array($template, array('t03', 't05', 't09'))){
        foreach($menu_top as $obj){
          if($obj['left_right'] == 1){
            ++$menu_count[1];
            $obj['new_order'] = $menu_count[1];
            $array_menu[1][$obj['id_top']] = $obj;
          }else if($obj['left_right'] == 2){
            ++$menu_count[3];
            $obj['new_order'] = $menu_count[3];
            $array_menu[3][$obj['id_top']] = $obj;
          }
        }
      }else if(in_array($template, array('t04', 't06', 't10'))){
        foreach($menu_top as $obj){
          if($obj['left_right'] == 2){
            ++$menu_count[2];
            $obj['new_order'] = $menu_count[2];
            $array_menu[2][$obj['id_top']] = $obj;
          }else if($obj['left_right'] == 1){
            ++$menu_count[3];
            $obj['new_order'] = $menu_count[3];
            $array_menu[3][$obj['id_top']] = $obj;
          }
        }
      }else if($template == 't07'){
        foreach($menu_top as $codr => $obj){
          if($obj['left_right'] == 2){
            ++$menu_count[2];
            $obj['new_order'] = $menu_count[2];
            $array_menu[2][$obj['id_top']] = $obj;
          }else{
            if($codr < 4){
              ++$menu_count[1];
              $obj['new_order'] = $menu_count[1];
              $array_menu[1][$obj['id_top']] = $obj;
            }else{
              ++$menu_count[3];
              $obj['new_order'] = $menu_count[3];
              $array_menu[3][$obj['id_top']] = $obj;
            }
          }
        }
      }else if($template == 't08'){
        foreach($menu_top as $codr => $obj){
          if($obj['left_right'] == 1){
            ++$menu_count[1];
            $obj['new_order'] = $menu_count[1];
            $array_menu[1][$obj['id_top']] = $obj;
          }else{
            if($codr < 4){
              ++$menu_count[2];
              $obj['new_order'] = $menu_count[2];
              $array_menu[2][$obj['id_top']] = $obj;
            }else{
              ++$menu_count[3];
              $obj['new_order'] = $menu_count[3];
              $array_menu[3][$obj['id_top']] = $obj;
            }
          }
        }
      }else{
        foreach($menu_top as $obj){
          ++$menu_count[$obj['left_right']];
          $obj['new_order'] = $menu_count[$obj['left_right']];
          $array_menu[$obj['left_right']][$obj['id_top']] = $obj;
        }
      }
    }
    else if($str_blog == '13') # t03, t05, t09
    {
      if(in_array($template, array('t01', 't02'))){
        foreach($menu_top as $obj){
          if($obj['left_right'] == 1){
            ++$menu_count[1];
            $obj['new_order'] = $menu_count[1];
            $array_menu[1][$obj['id_top']] = $obj;
          }else if($obj['left_right'] == 3){
            ++$menu_count[2];
            $obj['new_order'] = $menu_count[2];
            $array_menu[2][$obj['id_top']] = $obj;
          }
        }
      }else if(in_array($template, array('t04', 't06', 't10'))){
        foreach($menu_top as $obj){
          if($obj['left_right'] == 3){
            ++$menu_count[3];
            $obj['new_order'] = $menu_count[3];
            $array_menu[3][$obj['id_top']] = $obj;
          }else if($obj['left_right'] == 1){
            ++$menu_count[2];
            $obj['new_order'] = $menu_count[2];
            $array_menu[2][$obj['id_top']] = $obj;
          }
        }
      }else if($template == 't07'){
        foreach($menu_top as $codr => $obj){
          if($obj['left_right'] == 3){
            ++$menu_count[3];
            $obj['new_order'] = $menu_count[3];
            $array_menu[3][$obj['id_top']] = $obj;
          }else{
            if($codr < 4){
              ++$menu_count[1];
              $obj['new_order'] = $menu_count[1];
              $array_menu[1][$obj['id_top']] = $obj;
            }else{
              ++$menu_count[2];
              $obj['new_order'] = $menu_count[2];
              $array_menu[2][$obj['id_top']] = $obj;
            }
          }
        }
      }else if($template == 't08'){
        foreach($menu_top as $codr => $obj){
          if($obj['left_right'] == 3){
            ++$menu_count[3];
            $obj['new_order'] = $menu_count[3];
            $array_menu[3][$obj['id_top']] = $obj;
          }else{
            if($codr < 4){
              ++$menu_count[2];
              $obj['new_order'] = $menu_count[2];
              $array_menu[2][$obj['id_top']] = $obj;
            }else{
              ++$menu_count[1];
              $obj['new_order'] = $menu_count[1];
              $array_menu[1][$obj['id_top']] = $obj;
            }
          }
        }
      }else{
        foreach($menu_top as $obj){
          ++$menu_count[$obj['left_right']];
          $obj['new_order'] = $menu_count[$obj['left_right']];
          $array_menu[$obj['left_right']][$obj['id_top']] = $obj;
        }
      }
    }
    else if($str_blog == '23') # t04, t06, t10
    {
      if(in_array($template, array('t01', 't02'))){
        foreach($menu_top as $obj){
          if($obj['left_right'] == 2){
            ++$menu_count[2];
            $obj['new_order'] = $menu_count[2];
            $array_menu[2][$obj['id_top']] = $obj;
          }else if($obj['left_right'] == 3){
            ++$menu_count[1];
            $obj['new_order'] = $menu_count[1];
            $array_menu[1][$obj['id_top']] = $obj;
          }
        }
      }else if(in_array($template, array('t03', 't05', 't09'))){
        foreach($menu_top as $obj){
          if($obj['left_right'] == 3){
            ++$menu_count[3];
            $obj['new_order'] = $menu_count[3];
            $array_menu[3][$obj['id_top']] = $obj;
          }else if($obj['left_right'] == 2){
            ++$menu_count[1];
            $obj['new_order'] = $menu_count[1];
            $array_menu[1][$obj['id_top']] = $obj;
          }
        }
      }else if($template == 't07'){
        foreach($menu_top as $codr => $obj){
          if($obj['left_right'] == 3){
            ++$menu_count[3];
            $obj['new_order'] = $menu_count[3];
            $array_menu[3][$obj['id_top']] = $obj;
          }else{
            if($codr < 4){
              ++$menu_count[1];
              $obj['new_order'] = $menu_count[1];
              $array_menu[1][$obj['id_top']] = $obj;
            }else{
              ++$menu_count[2];
              $obj['new_order'] = $menu_count[2];
              $array_menu[2][$obj['id_top']] = $obj;
            }
          }
        }
      }else if($template == 't08'){
        foreach($menu_top as $codr => $obj){
          if($obj['left_right'] == 3){
            ++$menu_count[3];
            $obj['new_order'] = $menu_count[3];
            $array_menu[3][$obj['id_top']] = $obj;
          }else{
            if($codr < 4){
              ++$menu_count[2];
              $obj['new_order'] = $menu_count[2];
              $array_menu[2][$obj['id_top']] = $obj;
            }else{
              ++$menu_count[1];
              $obj['new_order'] = $menu_count[1];
              $array_menu[1][$obj['id_top']] = $obj;
            }
          }
        }
      }else{
        foreach($menu_top as $obj){
          ++$menu_count[$obj['left_right']];
          $obj['new_order'] = $menu_count[$obj['left_right']];
          $array_menu[$obj['left_right']][$obj['id_top']] = $obj;
        }
      }
    }
  }
//  echo '<pre>';
//  print_r($array_menu);
//  echo '</pre>';
  
  $update_template = "UPDATE cms_main_themes SET home_template = '$template'";
  $query_update = mysql_query($update_template);
  if($query_update){
    foreach($array_menu as $blog => $element){
      foreach($element as $id => $ele){
        $upd_menu = "UPDATE cms_menu_top SET left_right = '$blog', position = '$ele[new_order]' WHERE id_top = '$ele[id_top]'";
        mysql_query($upd_menu);
      }
    }
  }
  
  echo "<meta http-equiv='refresh' content='0; url=index.php'>";
}


function set_menu_graphic(){
  $arrayMTop = array(
    '0.gif' => 'อบต.ในเครือข่าย',
    '1.gif' => 'หมู่บ้านในเขต อบต.',
    '2.gif' => 'ปฏิทินกิจกรรม',
    '3.gif' => 'โรงแรม/ที่พัก',
    '4.gif' => 'ข้อมูลพื้นฐาน อบต.',
    '5.gif' => 'รวมลิงค์ต่างๆ',
    '6.gif' => 'ระบบ MIS',
    '7.gif' => 'โครงสร้างการบริหาร',
    '8.gif' => 'ผลิตภัณฑ์ประจำตำบล',
    '9.gif' => 'ทำเนียบบุคลากร',
    '10.gif' => 'แบบสำรวจความคิดเห็น',
    '11.gif' => 'แนะนำร้านอาหาร',
    '12.gif' => 'การให้บริการ',
    '13.gif' => 'สาส์นจากผู้บริหาร',
    '14.gif' => 'สถิติผู้เข้าชมเว็บไซต์',
    '15.gif' => 'สถานที่ท่องเที่ยว',
    '16.gif' => 'จัดการระบบเว็บไซต์',
    '17.gif' => 'สาส์นจากนายกฯ',
    '18.gif' => 'สาส์นจากประธานสภา',
    '19.gif' => 'สาส์นจากปลัด',
    '20.gif' => 'งบประมาณ อบต.',
    '21.gif' => 'ความรู้เกี่ยวกับภาษี',
    '22.gif' => 'ความรู้เกี่ยวกับ อบต.',
    '23.gif' => 'กฎหมายน่ารู้',
    '24.gif' => 'ราคาน้ำมันวันนี้',
    '25.gif' => 'เว็บไซต์บริการ',
    '26.gif' => 'เว็บไซต์ท้องถิ่นไทย',
    '27.gif' => 'ข่าวจากกรมส่งเสริมการปกครองท้องถิ่น',
    '28.gif' => 'สำนักปลัด',
    '29.gif' => 'ส่วนการคลัง',
    '30.gif' => 'ส่วนการศึกษา',
    '31.gif' => 'ส่วนโยธา',
    '32.gif' => 'ส่วนสาธารณสุข',
    '33.gif' => 'ส่วนส่งเสริมการเกษตร',
    '34.gif' => 'งานควบคุมภายใน',
    '35.gif' => 'งานบริหารบุคคล',
    '36.gif' => 'ศูนย์พัฒนาเด็กเล็ก',
    '37.gif' => 'แผนพัฒนาตำบล',
    '38.gif' => 'งานการเงิน',
    '39.gif' => 'งานนโยบายและแผน',
    '40.gif' => 'งานงบประมาณ',
    '41.gif' => 'งานพัสดุ',
    '42.gif' => 'งานสังคมสงเคราะห์',
    '43.gif' => 'ข้อมูลพื้นฐานเทศบาล',
    '44.gif' => 'Link กระทรวง',
    '45.gif' => 'หมู่บ้านในเขตเทศบาล',
    '46.gif' => 'เครือข่ายของเรา',
    '47.gif' => 'ความรู้เกี่ยวกับเทศบาล',
    '48.gif' => 'สายตรงผู้บริหาร',
    '49.gif' => 'ขั้นตอนการติดต่อราชการ',
    '50.gif' => 'ข้อมูลการจัดซื้อจัดจ้าง',
    '51.gif' => 'บริการออนไลน์'
  );
  foreach($arrayMTop as $gif => $text){
    mysql_query("UPDATE cms_menu_top SET name = '$text' WHERE name = '$gif';");
  }
}



#/*//##### delete old news and old news_tender #####//
$sqlNews = "select * from cms_news where year(date_post) < '2558'";
$queNews = mysql_query($sqlNews);
while($news = mysql_fetch_assoc($queNews)){
	if($news['pic1'] != '' && file_exists($_SESSION['web_name'].'/mainfile/'.$news['pic1'])){
		@unlink($_SESSION['web_name'].'/mainfile/'.$news['pic1']);
	}
	if($news['pic2'] != '' && file_exists($_SESSION['web_name'].'/mainfile/'.$news['pic2'])){
		@unlink($_SESSION['web_name'].'/mainfile/'.$news['pic2']);
	}
	if($news['pic3'] != '' && file_exists($_SESSION['web_name'].'/mainfile/'.$news['pic3'])){
		@unlink($_SESSION['web_name'].'/mainfile/'.$news['pic3']);
	}
	if($news['pic4'] != '' && file_exists($_SESSION['web_name'].'/mainfile/'.$news['pic4'])){
		@unlink($_SESSION['web_name'].'/mainfile/'.$news['pic4']);
	}
	if($news['files'] != '' && file_exists($_SESSION['web_name'].'/mainfile/'.$news['files'])){
		@unlink($_SESSION['web_name'].'/mainfile/'.$news['files']);
	}
	
	mysql_query("delete from cms_news where id = '$news[id]'");
}
$sqlTender = "select * from cms_news_tender where year(date_post) < '2558'";
$queTender = mysql_query($sqlTender);
while($tender = mysql_fetch_assoc($queTender)){
	if($tender['file'] != '' && file_exists($_SESSION['web_name'].'/mainfile/'.$tender['file'])){
		@unlink($_SESSION['web_name'].'/mainfile/'.$tender['file']);
	}
	
	mysql_query("delete from cms_tender where id = '$tender[file]'");
}

include('coremain/connec_out.php');
$sqlOut = "select * from cms_news where year(date_post) < '2558'";
$queOut = mysql_query($sqlOut);
while($out = mysql_fetch_assoc($queOut)){
	mysql_query("delete from cms_news where id = '$out[id]'");
}
$sqlTOut = "select * from cms_news_tender where year(date_post) < '2558'";
$queTOut = mysql_query($sqlTOut);
while($tout = mysql_fetch_assoc($queTOut)){
	mysql_query("delete from cms_news_tender where id = '$tout[id]'");
}
mysql_close($handle_out);
include("$_SESSION[web_name]/connect.php");
//################## end delete #################//*/

  
  
?>

Youez - 2016 - github.com/yon3zu
LinuXploit