function Page_Msg_Back($msg) {
echo "";
}
function Page_Msg($msg) {
echo "";
}
function Page_Url($url) {
echo "";
}
function Page_Msg_Url($msg, $url) {
echo "";
}
function replace_in_se($string){
if ($string){
$string = str_replace("sp_","",$string);
$string = str_replace("xp_","",$string);
$string = str_replace("","",$string);
$string = str_replace("'","\'",$string);
}
return $string;
}
function replace_out_se($string){
if ($string){
$string = str_replace("\'","'",$string);
$string = str_replace("\\\'","'",$string);
$string=stripslashes($string);
}
return $string;
}
function replace_out($string){
if ($string){
$string = str_replace("\'","'",$string);
$string = str_replace("\\\'","'",$string);
$string=nl2br($string);
$string=stripslashes($string);
}
return $string;
}
// 세션변수값 지정
function set_session($session_name, $value) {
$_SESSION["$session_name"] = $value;
}
// 세션변수값 얻음
function get_session($session_name) {
return $_SESSION[$session_name];
}
//페이지 이동시 기본 변수
function getAdmParams($FPOST){
$ad_params = "";
return $ad_params;
}
//년도로 나이계산
function getAge($birth_year_month_day){
$birth_year = substr($birth_year_month_day, 0, 4);
$current_year = date('Y');
$age = $current_year - $birth_year;
return $age;
}
//숫자로 요일 계산
function getDayTxt($day_txt) {
$dayOfWeek = ["일", "월", "화", "수", "목", "금", "토"];
$parts = explode("_", $day_txt);
$days = [];
foreach ($parts as $part) {
$dayIndex = intval($part);
if ($dayIndex >= 0 && $dayIndex <= 6) { // 인덱스 0부터 6까지가 일요일부터 토요일
$days[] = $dayOfWeek[$dayIndex];
}
}
if (count($days) > 0) {
$daysList = implode(', ', $days);
return $daysList;
}
}
//////////////////////////////////////////////
// 공통코드 불러오는 함수
// getCodeCom('apply_cms_amt')
// 2017-12-02 By gayoung
//////////////////////////////////////////////
function getCodeCom($objCode){
$com_code['coupon_state'] = array('1' => '사용', '2' => '미사용');
$com_code['use_yn'] = array('Y' => 'Y', 'N' => 'N');
$com_code['useYN'] = array('Y' => '사용', 'N' => '미사용');
$com_code['out_YN'] = array('Y' => '출고', 'N' => '미출고');
return $com_code[$objCode];
}
//////////////////////////////////////////////
// 라디오버튼 공통 함수
// radioBoxCommon('10', 'ra_age', 'apply_age')
// 2017-12-22 By gayoung
//////////////////////////////////////////////
function radioBoxCommon($selectVal, $objName, $arrCode){
$noArry = getCodeCom($arrCode);
$html_txt = "";
$i = 0;
foreach($noArry as $code=>$name){
$chkval = "";
if($selectVal != '' && $selectVal == $code ) $chkval = "checked";
$html_txt .= " ";
$i++;
}
return $html_txt;
}
//타임스템프(밀리세컨드까지)
function FN_get_timestamp(){
list($microtime, $tStamp) = explode(' ',microtime());
$timestamp = $tStamp . substr($microtime, 2, 3);
return $timestamp;
}
//전화번호 하이픈 넣기
function format_phone($phone){
$phone = preg_replace("/[^0-9]/", "", $phone);
$length = strlen($phone);
switch($length){
case 11 :
return preg_replace("/([0-9]{3})([0-9]{4})([0-9]{4})/", "$1-$2-$3", $phone);
break;
case 10:
return preg_replace("/([0-9]{3})([0-9]{3})([0-9]{4})/", "$1-$2-$3", $phone);
break;
default :
return $phone;
break;
}
}
//랜덤숫자문자 얻기
function RndomNum($cnt) {
$ran= "";
for( $i=0; $i<$cnt; $i++) //7자리만 출력
{
if( strlen($ran)<$cnt ) $ran .= rand( 0, 9 ); //숫자
}
return $ran;
}
/*
* 랜덤 문자열 생성(인수 : 길이, 타입)
* 지정된 타입의 문자열로 지정된 길이의 랜덤 문자열을 반환한다.
* 타입 0 : 영문 대소문자(A-Z,a-z), 숫자(0-9)
* 타입 1 : 영문 대문자(A-Z), 숫자(0-9)
* 타입 2 : 영문 소문자(a-z), 숫자(0-9)
* 타입 3 : 영문 대문자(A-Z)
* 타입 4 : 영문 소문자(a-z)
* 타입 5 : 숫자(0-9)
* 디폴트 : false 반환.
*/
function rand_str($length, $type)
{
switch($type){
case 0:
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890';
break;
case 1:
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
break;
case 2:
$chars = 'abcdefghijklmnopqrstuvwxyz1234567890';
break;
case 3:
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
case 4:
$chars = 'abcdefghijklmnopqrstuvwxyz';
break;
case 5:
$chars = '1234567890';
break;
default:
return false;
}
$chars_length = (strlen($chars) - 1);
$string = '';
for ($i = 0; $i < $length; $i = strlen($string)){
$string .= $chars[rand(0, $chars_length)];
}
return $string;
}
Function get_noimg($file_path,$img,$noimg){
If (!$img) {
$get_noimg = $noimg;
} Else {
if(file_exists($_SERVER["DOCUMENT_ROOT"].$file_path.$img)){
$get_noimg = $file_path.$img;
}else{
$get_noimg = $noimg;
}
}
return $get_noimg;
}
function get_arr($no,$bet){
$get_arr=$bet;
if($no){
for($i=0; $i2){
$days = explode("||", $yoil); // 문자열을 ||를 기준으로 분할하여 배열로 변환
$result = implode(",", $days); // 배열의 각 요소를 콤마로 연결하여 문자열로 변환
$result = trim($result, ',');
return $result;
}
}
}
function get_week($yoil){
if($yoil){
if(strpos($yoil, "토")==false and strpos($yoil, "일")==false){
return "Y";
}
}
}
?>
function dbconn(){
$dsn = _DBTYPE . ':host=' ._DBHOST. ';dbname=' . _DBNAME . ';charset=' . _CHARSET;
// PDO 객체 생성 & DB 접속
try{
$conn = new PDO($dsn, _DBUSER, _DBPASSWORD);
return $conn;
}catch(PDOException $e){
echo $e->getMessage();
return;
}
}
function QRY_CNT($tbl,$searchand){
$pdo = dbconn();
$sql = "SELECT
COUNT(*) AS CNT
FROM
$tbl
WHERE 1=1
$searchand";
$stmt = $pdo->prepare($sql);
$stmt->execute();
$cnt_row = $stmt->fetch(PDO::FETCH_ASSOC); //레코드 수 카운팅
$cnt = $cnt_row['CNT'];
return $cnt;
}
function QRY_MAX($tbl,$searchand,$item){
$pdo = dbconn();
$sql = "SELECT
MAX($item) AS MAX
FROM
$tbl
WHERE 1=1
$searchand";
$stmt = $pdo->prepare($sql);
$stmt->execute();
$cnt_row = $stmt->fetch(PDO::FETCH_ASSOC); //레코드 수 카운팅
$cnt = $cnt_row['MAX'];
return $cnt;
}
function QRY_VIEW($tbl,$searchand){
$pdo = dbconn();
$sql = "select * from $tbl where 1 = 1 $searchand";
$stmt = $pdo->prepare($sql);
$stmt->execute();
$row = $stmt->fetch();
return $row;
}
function QRY_VIEW_echo($tbl,$searchand){
$pdo = dbconn();
$sql = "select * from $tbl where 1 = 1 $searchand";
$stmt = $pdo->prepare($sql);
$stmt->execute();
$row = $stmt->fetch();
return $row;
}
function getQueryItem($table, $where, $getId){
$pdo = dbconn();
$sql = "select $getId as want from $table where 1 = 1 $where limit 0, 1";
$stmt = $pdo->prepare($sql);
$stmt->execute();
$row = $stmt->fetch();
$cnt = $stmt->rowCount();
$rowVal = "";
if($cnt > 0){
$rowVal = $row["want"];
}
return $rowVal;
}
function getQueryItemECHO($table, $where, $getId){
$pdo = dbconn();
$sql = "select $getId as want from $table where 1 = 1 $where limit 0, 1";
echo $sql;
//$stmt = $pdo->prepare($sql);
//$stmt->execute();
//$row = $stmt->fetch();
//$cnt = $stmt->rowCount();
//$rowVal = "";
//if($cnt > 0){
// $rowVal = $row["want"];
//}
return $rowVal;
}
function comQueryResult($sql){
$pdo = dbconn();
$stmt = $pdo->prepare($sql);
$stmt->execute();
$rsData = $stmt->fetchAll();
return $rsData;
}
function QRY_TMP_IDX($tableName){
$threis = getQueryItem("tempIdx", " and tableName='".$tableName."'", "tempIdx");
if(!$threis){
//primary 컬럼 구하기
$conn = dbconn();
$stmt = $conn->prepare("SHOW KEYS FROM $tableName WHERE Key_name = 'PRIMARY'");
$stmt->execute();
$primary_key_info = $stmt->fetch(PDO::FETCH_ASSOC);
if ($primary_key_info) {
$primary_key_column = $primary_key_info["Column_name"];
}
$max_idx = QRY_MAX($tableName," ",$primary_key_column);
$sql = "INSERT INTO tempIdx SET tempIdx = '$max_idx' , tableName = '$tableName'";
comQueryResult($sql);
}
$max = QRY_MAX("tempIdx"," and tableName='".$tableName."'","tempIdx");
$max++;
$sql = "UPDATE tempIdx SET tempIdx = $max WHERE tableName = '$tableName'";
comQueryResult($sql);
return $max;
}
/**********************************************
호출방법 ::
$order_query = selectRow("all",$page," sc_ord asc");
*******************************************/
function selectRow($cnt,$page,$ord){
$startno = ($page-1) * $cnt;
if($cnt!="all"){
$limit = "LIMIT $startno,$cnt ";
}
$sql = " order by $ord $limit";
return $sql;
}
function QRY_TOTALPAGE($cnt,$recordcnt){
$total_page = (int)($cnt%$recordcnt);
if ($total_page != 0){
$totalpage = (int)($cnt/$recordcnt)+1;
} else {
$totalpage = (int)($cnt/$recordcnt);
}
return $totalpage;
}
function GetUpdate($table, $where, $col){
$pdo = dbconn();
$sql = "UPDATE $table SET $col WHERE 1=1 $where";
$stmt = $pdo->prepare($sql);
$stmt->execute();
$row = $stmt->fetch();
$cnt = $stmt->rowCount();
$rowVal = "";
if($cnt > 0){
$rowVal = $row[$getId];
}
return $rowVal;
}
function GetInsert($table, $col, $val){
$pdo = dbconn();
$sql = "INSERT INTO $table ($col) VALUES($val)";
$stmt = $pdo->prepare($sql);
$stmt->execute();
$row = $stmt->fetch();
$cnt = $stmt->rowCount();
$rowVal = "";
if($cnt > 0){
$rowVal = $row[$getId];
}
return $rowVal;
}
/*
code 공통코드 싱글 선택 라디오버튼 생성 함수
$selectVal : 실제 선택 된 값
$checkName : 라디오버튼 name (아이디값은 name1, name2 로 생성)
$code_gubun : code_gubun 컬럼의 구분값
Author : 2023-03-18 By KGY
사용예시 >>>>>>>>>>>>>>>>>>>>>>>>>> (S)
Fatal error: Uncaught Error: Call to undefined function radioSingleList() in /home/qding/html/application/libs/sql.php:185
Stack trace:
#0 /home/qding/html/index.php(15): require_once()
#1 {main}
thrown in /home/qding/html/application/libs/sql.php on line 185