diff --git a/wheeparam/application/controllers/Board.php b/wheeparam/application/controllers/Board.php index 3302eb0..eaeea9e 100644 --- a/wheeparam/application/controllers/Board.php +++ b/wheeparam/application/controllers/Board.php @@ -131,7 +131,7 @@ class Board extends WB_Controller { $this->view = "view"; $this->skin_type = "board/view"; - $this->skin = $this->data['board']['brd_skin_w']; + $this->skin = $this->data['board']['brd_skin_v']; } /** diff --git a/wheeparam/application/helpers/common_helper.php b/wheeparam/application/helpers/common_helper.php index 39a0e68..0f7858f 100644 --- a/wheeparam/application/helpers/common_helper.php +++ b/wheeparam/application/helpers/common_helper.php @@ -1269,3 +1269,35 @@ function get_post_summary($post_content="", $length=300) { return cut_str( trim( strip_tags( str_replace(" ", " ", $post_content)) ) ,$length); } + + +/** + * 유일키 를 얻는다. + */ +function get_uniqid() +{ + $CI =& get_instance(); + $tb = $CI->db->dbprefix('uniqid'); + + // 일주일 이상된 자료는 삭제한다. + $tmp_val = date('YmdHis', strtotime('-1 weeks')) . '00'; + $CI->db->where('uq_id <=', $tmp_val); + $CI->db->delete('uniqid'); + + $CI->db->query("LOCK TABLE {$tb} WRITE "); + + $key = null; + + while (1) { + // 년월일시분초에 100분의 1초 두자리를 추가함 (1/100 초 앞에 자리가 모자르면 0으로 채움) + $key = date('YmdHis') . sprintf('%02d', (int)(microtime()*100)); + $ip_addr = ip2long($CI->input->ip_address()); + $result = $CI->db->set('uq_id', $key)->set('uq_ip', $ip_addr)->insert('uniqid'); + if ($result) break; // 쿼리가 정상이면 빠진다. + // insert 하지 못했으면 일정시간 쉰다음 다시 유일키를 만든다. + usleep(10000); // 100분의 1초를 쉰다 + } + $CI->db->query(" UNLOCK TABLES "); + + return $key; +} diff --git a/wheeparam/config/wheeparam.sql b/wheeparam/config/wheeparam.sql index e79308d..b7cd56a 100644 --- a/wheeparam/config/wheeparam.sql +++ b/wheeparam/config/wheeparam.sql @@ -625,6 +625,13 @@ CREATE TABLE `wb_statics_date` ( PRIMARY KEY (`std_date`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +DROP TABLE IF EXISTS `wb_uniqid`; +Create Table `wb_uniqid` ( + `uq_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `uq_ip` int(10) unsigned NOT NULL, +PRIMARY KEY (`uq_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + # VIEW 생성 CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `wb_board_post_new` AS (SELECT `wb_board_post`.`brd_key` AS `brd_key`, count(*) AS `new_cnt` from `wb_board_post` where ((`wb_board_post`.`post_regtime` > (now() + interval - (24)hour)) and (`wb_board_post`.`post_status` = 'Y')) group by `wb_board_post`.`brd_key`); \ No newline at end of file diff --git a/wheeparam/views/themes/admin/board/read.php b/wheeparam/views/themes/admin/board/read.php index 665017d..8989bf2 100644 --- a/wheeparam/views/themes/admin/board/read.php +++ b/wheeparam/views/themes/admin/board/read.php @@ -65,7 +65,7 @@