$g_program_start = getmicrotime();
//################################################################################
// register_globals_onÀ϶§
//################################################################################
@extract($HTTP_GET_VARS);
@extract($HTTP_POST_VARS);
@extract($HTTP_SERVER_VARS);
@extract($HTTP_ENV_VARS);
//################################################################################
// ±âº» º¯¼ö ¸¸µé±â
//################################################################################
$g_now_time = time();
$g_now_date = date("Y-m-d[H:i:s]",$g_now_time);
$g_now_counter = date("Ymd",$g_now_time);
$g_now_month = date("Ym",$g_now_time);
$g_user_agent = getenv("HTTP_USER_AGENT");
$g_user_referer = getenv("HTTP_REFERER");
$g_user_ip = getenv("REMOTE_ADDR");
$g_now_file = $HTTP_SERVER_VARS["SCRIPT_FILENAME"];
//################################################################################
// ¿¡·¯Ã³¸® ±âº»ÇÔ¼ö
//################################################################################
function error_msg($str, $url="") {
global $connect;
if($connect) morning_close($connect);
if ($url == "") { $url = "history.go(-1)";
} elseif ($url == "close") { $url = "window.close()";
} else { $url = "document.location.href = '$url'"; }
if ($str != "") { echo ""; }
else { echo ""; }
exit;
}
//################################################################################
// ÆäÀÌÁö À̵¿ ½ºÅ©¸³Æ®
//################################################################################
function move_page($url,$second = 0) {
global $connect;
if($connect) morning_close($connect);
echo"";
exit;
}
################################################################################
// ȯ°æ ¼³Á¤ ÆÄÀÏ ºÒ·¯¿À±â
################################################################################
if(!file_exists("config_basic.php")) { error_msg("config BASIC file open error");}
if(!file_exists("config_db.php")) { error_msg("config DB file open error","install.php");}
if(!file_exists("license.txt")) { error_msg("license file open error","http://www.morningspecial.com/user/main.html"); }
$settings = parse_ini_file('config_basic.php');
@extract($settings);
$cf_mall_name = settings_re($cf_mall_name);
$cf_mall_url = settings_re($cf_mall_url);
$cf_mall_install_dir = settings_re($cf_mall_install_dir);
$cf_mall_address = settings_re($cf_mall_address);
$cf_mall_title = settings_re($cf_mall_title);
$cf_company_num = settings_re($cf_company_num);
$cf_sale_num = settings_re($cf_sale_num);
$cf_business_name = settings_re($cf_business_name);
$cf_business_conditions = settings_re($cf_business_conditions);
$cf_business_item = settings_re($cf_business_item);
$cf_ceo_name = settings_re($cf_ceo_name);
$cf_charge_name = settings_re($cf_charge_name);
$cf_ceo_phone = settings_re($cf_ceo_phone);
$cf_ceo_fax = settings_re($cf_ceo_fax);
$cf_client_phone1 = settings_re($cf_client_phone1);
$cf_client_phone2 = settings_re($cf_client_phone2);
$cf_client_phone3 = settings_re($cf_client_phone3);
$cf_client_phone4 = settings_re($cf_client_phone4);
$cf_client_fax = settings_re($cf_client_fax);
$cf_client_email = settings_re($cf_client_email);
$cf_client_msn = settings_re($cf_client_msn);
$cf_client_time = settings_re($cf_client_time);
$cf_mall_form = settings_re($cf_mall_form);
$cf_language_method = settings_re($cf_language_method);
$cf_skin_name = settings_re($cf_skin_name);
$cf_account_method = settings_re($cf_account_method);
$cf_card_system = settings_re($cf_card_system);
$cf_card_id = settings_re($cf_card_id);
$cf_terminal_id = settings_re($cf_terminal_id);
$cf_card_url = settings_re($cf_card_url);
$cf_card_money = settings_re($cf_card_money);
$cf_bank_account = settings_re($cf_bank_account);
$cf_member_agreement = settings_re($cf_member_agreement);
$cf_jumin_check = settings_re($cf_jumin_check);
$cf_point_use = settings_re($cf_point_use);
$cf_point_member = settings_re($cf_point_member);
$cf_point_add = settings_re($cf_point_add);
$cf_point_recommend = settings_re($cf_point_recommend);
$cf_point_money = settings_re($cf_point_money);
$cf_delivery_free = settings_re($cf_delivery_free);
$cf_delivery_money = settings_re($cf_delivery_money);
$cf_mail_method = settings_re($cf_mail_method);
$cf_mail_member = settings_re($cf_mail_member);
$cf_mail_order = settings_re($cf_mail_order);
$cf_mail_account = settings_re($cf_mail_account);
$cf_mail_delivery = settings_re($cf_mail_delivery);
$cf_mail_name = settings_re($cf_mail_name);
$cf_stock_use = settings_re($cf_stock_use);
$cf_stock_method = settings_re($cf_stock_method);
$cf_stock_time = settings_re($cf_stock_time);
$cf_limit_list = settings_re($cf_limit_list);
// ÀºÇà °èÁÂ¸í ±¸º°Çϱâ
$cf_bank_bit = explode("\n",$cf_bank_account);
// ¾ð¾î ÆÑ ºÒ¾î¿À±â
if($cf_language_method == "korea") {
include "language_korea.php";
} elseif($cf_language_method == "english") {
include "language_korea.php";
} elseif($cf_language_method == "japen") {
include "language_korea.php";
} elseif($cf_language_method == "china") {
include "language_korea.php";
} else {
include "language_korea.php";
}
//################################################################################
// º¯¼ö ¼±¾ð
//################################################################################
$g_salt = "mo";
// ¸ð´×¸ô ŸÀÌƲ °ª°ú .. ¹öÁ¯ ¾È³»
$g_header_title = "Morning Mall 2003 (Version : 20030912_Beta)";
$g_header_version = "Version 20030912_Beta";
$g_main_html = "index.php";
$g_mall_skin_dir = "skin";
$g_mall_image_dir = "shop_image";
$g_member_image_dir = "member_image";
$g_board_data_dir = "board_data";
$g_board_skin_dir = "board_skin";
$g_page_file = "config_page.txt";
$g_session_dir = "session";
$g_skin_link = "./$g_mall_skin_dir/$cf_skin_name";
$g_all_link_dir = "$cf_mall_url/$cf_mall_install_dir/$g_mall_skin_dir/$cf_skin_name/";
$g_all_slink_dir = "$cf_mall_url/$cf_mall_install_dir/";
$g_division_num = "1000";
// ÆÄÀÏ °ü·Ã ¼³Á¤ º¯¼ö
$g_file_okext = array("jpg","jpeg","gif","bmp","png","psd","swf","tar","gz","tgz","alz","zip","rar","ace","arj");
$g_file_okimage = array("jpg","jpeg","gif","bmp","png");
$g_max_file_size = "2097152";
$cf_morning_copyright = "Copyright 1999 - 2003 Morning Special";
$cf_help_copyright = "Copyright 1999 - 2003 Morning Special";
$cf_help_copyright .= " / help : An Ju Hyun";
//################################################################################
// Å×ÀÌºí ¸íĪ ¼±¾ð
//################################################################################
// Ä«Å×°í¸® Å×À̺í
$morning_category_table = "morning_category_table";
$morning_goods_table = "morning_goods_table";
$morning_gcomment_table = "morning_gcomment_table";
$morning_member_table = "morning_member_table";
$morning_point_table = "morning_point_table";
$morning_popup_table = "morning_popup_table";
$morning_poll_table = "morning_poll_table";
$morning_pcomment_table = "morning_pcomment_table";
// »óÇ° ±¸ÀÔ °ü·Ã Å×À̺í
$morning_cart_table = "morning_cart_table";
$morning_purchase_table = "morning_purchase_table";
$morning_buyer_table = "morning_buyer_table";
// Ä«¿îÅÍ °ü·Ã Å×À̺í
$morning_counter_table = "morning_counter_table";
$morning_time_table = "morning_time_table";
$morning_referer_table = "morning_referer_table";
// °Ô½ÃÆÇ °ü¸® Å×À̺í
$morning_badmin_table = "morning_badmin_table";
// °Ô½ÃÆÇ º»Ã¼ Å×À̺í
if($ps_db) $board_code = $ps_db;
$morning_bmain_table = "morning_bmain_$board_code";
$morning_bcomment_table = "morning_bcomment_$board_code";
$morning_bcategory_table = "morning_bcategory_$board_code";
$cct = $cf_morning_copyright.$cf_help_copyright;
################################################################################
// ȯ°æ ¼³Á¤ ÆÄÀÏ ¹æÇØ ¹®ÀÚ Á¦°Å
################################################################################
function settings_del($str) {
$str = eregi_replace("\r\n", "
", $str);
$str = eregi_replace("\n", "
", $str);
$str = eregi_replace("\"", """, $str);
return $str;
}
################################################################################
// ȯ°æ ¼³Á¤ ÆÄÀÏ º¹¿ø
################################################################################
function settings_re($str) {
$str = stripslashes($str);
$str = eregi_replace("
", "\n", $str);
$str = eregi_replace(""", "\"", $str);
return $str;
}
//################################################################################
// ¸ð´×¸ô ¹è¿ ÀÔ·Â Ç׸ñµé
//################################################################################
// Çѱ¹¾î ¹è¿ Ç׸ñ
$g_point_array = array("","°ü¸®ÀÚÀÔ·Â","ȸ¿ø°¡ÀÔ","ȸ¿øÃßõ","»óÇ°±¸ÀÔ","Æ÷ÀÎÆ®»ç¿ë");
$g_class_array = array("¼Õ´Ô","Å»Åðȸ¿ø","ÀÓ½Ãȸ¿ø","ÀϹÝȸ¿ø","¿ì¼öȸ¿ø","ÃÖ¿ì¼öȸ¿ø","µô·¯","»óÇ°°ü¸®ÀÚ","ÁÖ¹®°ü¸®ÀÚ","Áß°£°ü¸®ÀÚ","ÃÖ°í°ü¸®ÀÚ","°ü¸®ÀÚ¸ðµå");
$g_goods_status_array = array("","MDÃßõ»óÇ°(¸ÞÀÎ)","»õ»óÇ°(¸ÞÀÎ)","ÇØ´ç Ä«Å×°í¸®(»ó´Ü)","ÀϹݻóÇ°");
$g_interest_array = array("°ü½ÉºÐ¾ß","ÄÄÇ»ÅÍ/ÀÎÅͳÝ","°úÇÐ/±â¼ú","»ýÈ°/°Ç°","Á¤Ä¡/»çȸ/Á¾±³","¿¬¿¹/¿À¶ô","¼îÇÎ","º¥Ã³Ã¢¾÷/°æ¿µ",
"ÀçÅ×Å©/Áõ±Ç","±¸ÀÎ/±¸Á÷","±³À°/Çмú/¿Ü±¹¾î","·¹Àú/¿©Çà","½ºÆ÷Ã÷","½Ã»ç/´º½º","À̼º±³Á¦/Ä£¸ñ","À½¾Ç/°ø¿¬",
"¿µÈ/ºñµð¿À","¹®È/¿¹¼ú","±âŸ");
$g_hobby_array = array("Ãë¹Ì","µ¶¼","À½¾Ç°¨»ó","¼ö´Ù¶³±â","¼îÇÎ","¿ä¸®","´ç±¸","¼ú¸¶½Ã±â","ÀáÀÚ±â","ÄÄÇ»ÅÍ°ÔÀÓ","³¬½Ã",
"µî»ê","¹ÙµÏ","»çÁø","¼öÁý","¿©Çà","¾Ç±â¿¬ÁÖ","±×¸²±×¸®±â","±Û¾²±â","³ë·¡/ÃãÃß±â","À¥¼ÇÎ",
"ÄÄÇ»ÅÍÅë½Å","ÀÚµ¿Â÷","ÅÚ·¹ºñÁ¯","¿µÈ/ºñµð¿À","¸¸È/¾Ö´Ï¸ÞÀ̼Ç","½ºÆ÷Ã÷","¹«Ãë¹Ì","±âŸ");
$g_religion_array = array("Á¾±³","±âµ¶±³","ºÒ±³","õÁÖ±³","Áõ»êµµ","¿øºÒ±³","¼º°øȸ","ÈùµÎ±³","ȸ±³","õµµ±³","´ëÁ¾±³","ÅëÀϱ³","¹«±³(ÙíÎç)","±âŸ");
$g_bloodtype_array = array("Ç÷¾×Çü","A","B","O","AB","±âŸ");
$g_jobtype_array = array("ÁßÇб³ÀÌÇÏ","°íµîÇлý","´ëÇлý","´ëÇпø»ý","»ç¹«Á÷","±â¼úÁ÷","¼ºñ½º/ÆǸÅÁ÷","»ý»êÁ÷","Á¤º¸Åë½Å °ü·ÃÁ÷","ÀÇ·áÀÎ",
"¹æ¼Û/¾ð·ÐÀÎ","¹ýÁ¶ÀÎ","Á¾±³ÀÎ","¿¹´É/¿¹¼úÀÎ","ÁÖºÎ","³ó/Ãà/¼ö»ê","±³»ç/±³¼ö","ºñ¿µ¸®´Üü","¹«Á÷","±ºÀÎ","±âŸ");
$g_order_array = array("","ÁÖ¹®Á¢¼ö¿Ï·á","ÀÔ±ÝÈ®ÀÎ","Ãâ°íÁغñ","Ãâ°í¿Ï·á","¹ß¼Û(¹è¼Û)Áß","¹è¼Û¿Ï·á","±¸ÀÔ¿Ï·á","¹ÝÇ°½Åû","¹ÝÇ°¿Ï·á");
$g_star_array = array("","¡Ú","¡Ú¡Ú","¡Ú¡Ú¡Ú","¡Ú¡Ú¡Ú¡Ú","¡Ú¡Ú¡Ú¡Ú¡Ú");
// °Ô½ÃÆÇ Ãʱâ ÀÔ·Â °ª °ü·Ã Ç׸ñµé
$g_board_header_text = "";
$g_board_tailer_text = "
";
$g_filter_text = "°³»õ³¢,¾¾¹ß,Á¿,¾öâ,°³¼í±â,È£·Î»õ³¢,È£·ÎšÃÅ°,¾²¹ú³ð,8¾ï,ÃßõÀÎ,º´½Å,ºù½Å,º´»ï,µØÁø´Ù,Á×À»·¡,°³»õ,¾Ã»õ,¸ôÄ«,´Ï¹Ì·²,´Ï¹Ì,¾¾ºØ,¾²µ,¾¾¹ß³ð,ºé½Å";
if($ps_mango == "ok") echo $ps_mango." ===== ".$cct;
//################################################################################
// ¸¶ÀÌÅ©·Î ŸÀÓ ±¸ÇÔ
//################################################################################
function getmicrotime() {
$microtimestmp = split(" ",microtime());
return $microtimestmp[0]+$microtimestmp[1];
}
//################################################################################
// ºó¹®ÀÚ°¡ ¾Æ´Ï¸é¼ ¼ýÀÚ ÀÏ°æ¿ì 1 ¸®ÅÏ
//################################################################################
function isnumblank($str) {
$temp=str_replace("\r\n","",$temp);
$temp=str_replace("\n","",$temp);
$temp=str_replace("¡¡","",$str);
$temp=str_replace(" ","",$temp);
if(eregi("[^[:space:]]",$temp)) { if(is_numeric($str)) { return 1; } else { return 0; } }
return 0;
}
//################################################################################
// ºó¹®ÀÚ¿ °æ¿ì 1À» ¸®ÅÏ
//################################################################################
function isblank($str) {
$temp=str_replace("\r\n","",$temp);
$temp=str_replace("\n","",$temp);
$temp=str_replace("¡¡","",$str);
$temp=str_replace(" ","",$temp);
if(eregi("[^[:space:]]",$temp)) { return 0; } else { return 1; }
return 0;
}
//################################################################################
// ¼ýÀÚÀÏ °æ¿ì 1À» ¸®ÅÏ
//################################################################################
function isnum($str) {
if(is_numeric($str)) { return 1; } else { return 0; }
}
//################################################################################
// ¼ýÀÚ, ¿µ¹®ÀÚ ÀÏ°æ¿ì 1À» ¸®ÅÏ
//################################################################################
function isalnum($str) {
if(eregi("[^0-9a-zA-Z\_]",$str)) { return 0; } else { return 1; }
}
//################################################################################
// E-mail ÁÖ¼Ò°¡ ¿Ã¹Ù¸¥Áö °Ë»ç
//################################################################################
function ismail($str, $check_dns = "0") {
if((preg_match('/(@.*@)|(..)|(@.)|(.@)|(^.)/', $str)) || (preg_match('/^.+@([?)[a-zA-Z0-9-.]+.([a-zA-Z]{2,3}|[0-9]{1,3})(]?)$/', $str))) {
if($check_dns) {
$host = explode('@', $email);
if( checkdnsrr($host[1], 'MX') ) return 1;
if( checkdnsrr($host[1], 'A') ) return 1;
if( checkdnsrr($host[1], 'CNAME') ) return 1;
} else {
return 1;
}
}
return 0;
}
//################################################################################
// URL, MailÀ» ÀÚµ¿À¸·Î üũÇÏ¿© ¸µÅ©¸¸µë
//################################################################################
function autolink($str) {
$homepage_pattern = "(http://|ftp://|telnet:)[[:alnum:]-]+(\.[[:alnum:]-]+)+(:[[:digit:]]+)?(/[^\/:*\"<>|&?]+)*(\?[^\/:*\"<>|&?]+(&[^\/:*\"<>|&?]+)*)?";
$str =ereg_replace("$homepage_pattern", "\\0", $str);
$email_pattern = "[[:alnum:]._-]+@[[:alnum:]-]+(\.[[:alnum:]-]+)+";
$str =ereg_replace("$email_pattern", "\\0", $str);
return $str;
}
//################################################################################
// MYSQL¿ë ÇÔ¼ö
//################################################################################
// µ¥ÀÌÅÍ º£À̽º ¿¬°á
$g_connect_start = getmicrotime();
$connect = dbconn();
$g_connect_end = getmicrotime();
function dbconn() {
if(!file_exists("config_db.php")) { error_msg("$ERROR_FUNCTION_OPEN_DBFILE","install.php");}
$db_settings = parse_ini_file('config_db.php');
@extract($db_settings);
if(!$connect) $connect = @mysql_connect($con_db_host,$con_db_id,$con_db_pass) or die(" Mysql_Query : ".$query."
Mysql_Error : ".mysql_error()."
Mysql Error Num : ".mysql_errno()."");
@mysql_select_db($con_db_name, $connect) or die(" Mysql_Query : ".$query."
Mysql_Error : ".mysql_error()."
Mysql Error Num : ".mysql_errno()."");
return $connect;
}
function morning_query($query) {
global $connect;
$result = @mysql_query($query,$connect);
return $result;
}
function morning_query_error($query) {
global $connect;
$result = mysql_query($query, $connect) or die(" Mysql_Query : ".$query."
Mysql_Error : ".mysql_error()."
Mysql Error Num : ".mysql_errno()."");
return $result;
}
function morning_fetch_array($result) {
return @mysql_fetch_array($result);
}
function morning_free_result($result) {
@mysql_free_result($result);
}
function morning_num_rows($result) {
return @mysql_num_rows($result);
}
function morning_fetch_row($result) {
return @mysql_fetch_row($result);
}
function morning_close($connect) {
@mysql_close($connect);
}
function morning_counter($table_name, $where_str="", $field_name="*") {
global $connect;
if(!eregi("where",$where_str) and $where_str) $where_str = "where ".$where_str;
$result = @mysql_query("select count($field_name) from $table_name $where_str", $connect);
$fetch_row = @mysql_fetch_row($result);
return $fetch_row[0];
}
##################################################################################
//
ÅÂ±× »ý¼º
##################################################################################
function make_br($str) {
$str = str_replace("\r\n", "
", $str);
$str = str_replace("\n", "
", $str);
return $str;
}
##################################################################################
// html tag¸¦ Á¦°ÅÇÏ´Â ÇÔ¼ö
##################################################################################
function del_teg($str) {
$str = str_replace( ">", ">",$str );
$str = str_replace( "<", "<",$str );
return $str;
}
//################################################################################
// HTML Áß¿¡ °ø°Ý ÅÂ±× »èÁ¦
//################################################################################
function avoid_crack($str) {
$str = eregi_replace("<\?","<?",$str);
$str = eregi_replace("\?>","?>",$str);
$str = eregi_replace("","",$str);
$str = eregi_replace("","",$str);
$str = eregi_replace("","",$str);
$str = eregi_replace("","",$str);
$str = eregi_replace("","",$str);
$str = eregi_replace("","",$str);
$str = eregi_replace("","",$str);
$str = eregi_replace("","",$str);
$str = eregi_replace("","",$str);
$str = eregi_replace("c\|/con/con/","",$str);
return $str;
}
##################################################################################
// »·ÇÑ ¼û±è À̾߱â
##################################################################################
function mango_encode($str) {
$str = base64_encode($str);
$str = urlencode($str);
return $str;
}
##################################################################################
// ¼û°åÀ¸¸é Ç®¾î ¾ßÁö ..
##################################################################################
function mango_decode($str) {
$str = urldecode($str);
$str = base64_decode($str);
return $str;
}
################################################################################
// ¿å ±âŸ ±¤°í±Û ÇÊÅ͸µ
################################################################################
function bad_check($badword,$str,$divide = ",") {
$badword = preg_replace('/'.$divide.'/','|',&$badword);
if(preg_match('/'.$badword.'/',&$str,$match)) { return $match[0]; }
return 0;
}
##################################################################################
// Áֹεî·Ï¹øÈ£ °Ë»ç ¸ÂÀ»°æ¿ì 1 ¸®ÅÏ
##################################################################################
function check_jumin($jumin) {
$weight = '234567892345'; // ÀÚ¸®¼ö weight ÁöÁ¤
$len = strlen($jumin);
$sum = 0;
if($len <> 13) return false;
for ($i = 0; $i < 12; $i++) {
$sum = $sum + (substr($jumin,$i,1)*substr($weight,$i,1));
}
$rst = $sum%11;
$result = 11 - $rst;
if($result == 10) $result = 0;
elseif($result == 11) $result = 1;
$ju13 = substr($jumin,12,1);
if ($result <> $ju13) return 0;
return 1;
}
##################################################################################
// ¹Ì¼º³âÀÚ ÆǺ° ¸ÂÀ»°æ¿ì 1 ¸®ÅÏ
##################################################################################
function adult_check($jumin) {
$jumin = chop($jumin);
$jumin = trim($jumin);
$len = strlen($jumin);
if($len <> 13) return 0;
$birth = substr($jumin, 0, 6);
$checkyear = substr($jumin, 6, 1);
if($checkyear == 3 or $checkyear == 4) $fyear = "20".$birth; else $fyear = "19".$birth;
$agecheck = date(Ymd) - $fyear; // ÇöÀç ³¯Â¥¸¦ ±¸Çؼ ž ³¯ÀÚ »©±â
if($agecheck < 190000) return 0;
return 1;
}
##################################################################################
// ³ªÀÌ Ã¼Å©
##################################################################################
function age_check($jumin1, $jumin2="", $mode="") {
if(!$jumin2) {
$jumin1 = eregi_replace("-","", $jumin1);
$stype = substr($jumin1, 6, 1);
$year = substr($jumin1, 0, 2);
}
else {
$stype = substr($jumin2, 0, 1);
$year = substr($jumin1, 0, 2);
}
$old = date("Y", time()) - (1900+(intval($stype/3)*100)+$year);
if(!$mode) $old++;
return $old;
}
################################################################################
// ÆÄÀÏ »çÀÌÁ kb, mb¿¡ ¸ÂÃß¾î¼ º¯È¯Çؼ ¸®ÅÏ
################################################################################
function getfilesize($size) {
if(!$size) return "0 Byte";
if($size<1024) {
return ($size." Byte");
} elseif($size >1024 && $size< 1024 *1024) {
return sprintf("%0.1f KB",$size / 1024);
} else {
return sprintf("%0.2f MB",$size / (1024*1024));
}
}
################################################################################
// ¹®ÀÚ¿ ²÷±â (ÀÌ»óÀÇ ±æÀÌÀ϶§´Â ... ·Î Ç¥½Ã)
################################################################################
function cut_str($str,$maxlen, $suffix = "..") {
if($maxlen<=0) return $str;
if(ereg("\[re\]",$str)) $len=$len+4;
if($maxlen >= strlen($str)) return $str;
$klen = $maxlen - 1;
while(ord($str[$klen]) & 0x80) $klen--;
return substr($str, 0, $maxlen - (($maxlen + $klen + 1) % 2)).$suffix;
}
################################################################################
// ÆäÀÌÁö URL
################################################################################
function page_list($current_page="1", $total_page="0", $list_num="15", $page_num="10", $url, $first_page="[1]", $post_page="..", $post_start="[Previous 10Pages]", $next_page="..", $last_page="", $next_start="[Next 10Pages]", $link_color="#EF5900") {
$str .= "";
$start_page = @(((int)(($current_page-1)/$page_num))*$page_num)+1;
$temp_pnum = $page_num - 1 ;
$end_page = $start_page + $temp_pnum;
if ($end_page >= $total_page) $end_page = $total_page;
if ($start_page > 1) {
$str .= " ".$post_start."";
}
if ($current_page > 1) {
$str .= " ".$first_page."";
$str .= " ".$post_page."";
}
if ($total_page > 1) {
for ($i=$start_page;$i<=$end_page;$i++) {
if ($current_page != $i) {
$str .= " [$i]";
} else {
$str .= " $i";
}
}
}
if ($current_page < $total_page) {
$str .= " ".$next_page."";
if(!$last_page) {
$last_page = "[".$total_page."]";
$str .= " ".$last_page." ";
}
}
if ($total_page > $end_page) {
$str .= " ".$next_start."";
}
$str .= "";
return $str;
}
################################################################################
// ÆäÀÌÁö URL
################################################################################
function page_rist($current_page="1", $total_page="0", $list_num="15", $page_num="10", $url, $first_page="[1]", $post_page="..", $post_start="[Previous 10Pages]", $next_page="..", $last_page="", $next_start="[Next 10Pages]", $link_color="#EF5900") {
$start_page=@(((int)(($current_page-1)/$page_num))*$page_num)+1;
$temp_pnum=$page_num-1;
$end_page=$start_page+$temp_pnum;
if ($end_page>=$total_page)$end_page=$total_page;
if ($total_page > 1) {
for ($i=$start_page;$i<=$end_page;$i++) {
if ($current_page!=$i){}
else{$str.="$i";}
}
}
return $str;
}
################################################################################
// Next Page
################################################################################
function goto_next($j, $i) {{
$j = $i+1;
if ($$ps_goid!=""){echo ""; }
else{$str.="$j";}
}
return $str;
}
function ct($t) {{
if ($$ps_ctid!=""){}
else{$str.="$t";}
}
return $str;
}
################################################################################
// ÆÄÀÏÀ» »èÁ¦ÇÏ´Â ÇÔ¼ö
################################################################################
function file_unlink($filename) {
if(file_exists($filename)) {
@chmod($filename,0777);
$handle = @unlink($filename);
}
if(file_exists($filename)) {
@chmod($filename,0775);
$handle = @unlink($filename);
}
if(file_exists($filename)) {
$handle = @unlink($filename);
}
return $handle;
}
################################################################################
// ÁöÁ¤µÈ µð·ºÅ丮ÀÇ ÆÄÀÏ Á¤º¸¸¦ ±¸ÇÔ
################################################################################
function get_dirinfo($path) {
$handle=@opendir($path);
while($info = readdir($handle)) {
if($info != "." && $info != "..") {
$dir[] = $info;
}
}
closedir($handle);
return $dir;
}
################################################################################
// ±âº» ¸ÞÀÏ º¸³»±â
################################################################################
function basic_sendmail($to_email,$from_email,$form_name,$subject,$morningbody,$type) {
$header .= "From: $form_name <$from_email>\n";
//$header .= "X-Sender: <$from_email>\n";
//$header .= "X-Mailer: PHP ".phpversion()."\n";
$header .= "X-Priority: 1\n";
//$header .= "Return-Path: <$from_email>\n";
$header .= "Content-Type: text/$type;";
$header .= "charset=euc-kr\n";
$morningbody = stripslashes($morningbody);
//echo "$to_email
$subject
$morningbody
$header";
//exit;
@mail($to_email,$subject,$morningbody,$header);
}
################################################################################
// ¸ÞÀÏ º¸³»±â Á÷Á¢
################################################################################
function nmail($to_email, $from_email, $from_name, $subject, $morningbody, $type) {
$header = "From: $from_name <$from_email>\n";
//$header .= "X-Sender: <$from_email>\n";
//$header .= "X-Mailer: PHP ".phpversion()."\n";
$header .= "X-Priority: 1\n";
//$header .= "Return-Path: <$from_email>\n";
$header .= "Content-Type: text/$type; charset=EUC-KR\n";
$header .= "\n\n";
$morningbody = stripslashes($morningbody);
@$fp = popen('/usr/sbin/sendmail -t -f '.$from_email.' '.$to_email,"w");
if(!$fp) return 0;
fputs($fp,"From:".$from_name."<".$from_email.">"."\n");
//fputs($fp, "To: $to_email\n");
fputs($fp, "Subject: ".$subject."\n");
fputs($fp, $header."\n");
fputs($fp, $morningbody);
fputs($fp, "\n\n\n");
pclose($fp);
return 1;
}
################################################################################
// °¹¼ö°¡ ±¸¸Å°¡´É ÇÑÁö ¾Ë¾Æ º¸±â À§ÇØ ±¸ÀÔ°¡´É Çϸé 1
################################################################################
function goods_stock_check($table, $ps_goid, $goods_num) {
global $connect;
$list = @morning_fetch_array(morning_query_error("select * from $table where uid = '$ps_goid'"));
if($list[goods_stock] >= $goods_num) { return 1; } else { return 0; }
}
################################################################################
// Ä«Å×°í¸® ³×ºñ°ÔÀ̼Ç
################################################################################
function category_navigation($str) {
global $connect,$morning_category_table;
$tmp_level = category_level($str);
$original_len = strlen($str);
// ³×ºñ°ÔÀ̼ÇÀÌ ÇÊ¿äÇÑ °æ¿ì
if($tmp_level > 1) {
for($i=1 ; $i<$tmp_level ; $i++) {
// ±× ·¹º§ÀÇ °¡Àå Å« ¹øÈ£ÀÇ Ä«Å×°í¸® ºÎÅÍ Â÷·Ê ´ë·Î ºÒ·¯¿À±â
$next_num = ($i*2);
$parent_str = substr($str, 0, $next_num);
$now_str = substr($parent_str."00000000", 0, $original_len);
//echo " $tmp_level === $next_num =========== $parent_str ======== $now_str ===
";
$query = " select * from $morning_category_table where category_id = '$now_str' ";
$result = morning_query_error($query);
$list = morning_fetch_array($result);
morning_free_result($result);
$navi_str .= "$list[category_name] > ";
}
}
return $navi_str;
}
################################################################################
// ÇÏÀ§Ä«Å×°í¸® ³×ºñ°ÔÀ̼Ç
################################################################################
function tree_navigation($str) {
global $connect,$morning_category_table;
$tmp_level = category_level($str);
$now_level = $tmp_level;
$original_len = strlen($str);
$next_num = (($tmp_level)*2);
$parent_str = substr($str, 0, $next_num);
//echo " ============= $tmp_level === $next_num =========== $parent_str ======== $now_str ===
";
if($tmp_level < 4) {
$now_level++;
$now_sub_level = $now_level;
$now_sub_level++;
$query = " select * from $morning_category_table where substring(category_id,1,$next_num) = '$parent_str' and category_depth = $now_level order by category_rank asc";
//echo " $query ===================== ".$parent_str = substr($str, 0, $next_num);
//echo "
$query ===
";
$result = morning_query_error($query);
while($list = morning_fetch_array($result)) {
if($now_level != "4") $tree_str .="
";
$tree_str .=" $list[category_name] ";
if($now_level == "4") $tree_str .="|";
if($now_level < 4) {
$tree_str .=" >> ";
$next_num = (($now_level)*2);
$parent_str = substr($list[category_id], 0, $next_num);
$sub_query = " select * from $morning_category_table where substring(category_id,1,$next_num) = '$parent_str' and category_depth = $now_sub_level order by category_rank asc";
$sub_result = morning_query_error($sub_query);
// echo "
$sub_query
";
while($sub_list = morning_fetch_array($sub_result)) {
$tree_str .="$sub_list[category_name] |";
}
}
}
}
return $tree_str;
}
################################################################################
// Ä«Å×°í¸® ·¹º§
################################################################################
function category_level($str) {
$level = 0;
for ($i=0; $i1; $i-=2) {
$j = $i-2;
$temp_sub = substr($str,$j,2);
if($temp_sub != "00") { break; }
$str = substr($str,0,$j);
}
return $str;
}
################################################################################
// ÇÏÀ§ ºÐ·ù ·¹º§ ±¸Çϱâ
################################################################################
function category_next($str) {
global $connect,$morning_category_table;
$parent_str = category_status($str);
$len = strlen($parent_str);
$original_len = strlen($str);
$next_len = $len + 1;
//echo " $str ==== $parent_str ==== $len ===== $original_len ==
";
// 4´Ü°è Áö¿ø ¿¡ µû¸¥ 4´Ü °è ÀÌ»óÀÌ¸é ¸®ÅÏ ÇØÁà¾ß¡
if ($len > 8) { return "1"; }
// ±× ·¹º§ÀÇ °¡Àå Å« ¹øÈ£¸¦ ±¸ÇÑ´Ù.
$query = " select max(substring(category_id,$next_len,2)) from $morning_category_table where substring(category_id,1,$len) = '$parent_str' ";
$result = morning_query_error($query);
$max_num = morning_fetch_array($result);
morning_free_result($result);
$num = $max_num[0];
if ($num == 99) {
// 99 °³ Áß¿¡ ºüÁø °Å ÀÖ³ª ã¾Æ¼ ÇØ°á Çϱâ. ã´Ù°¡ ¾øÀ¸¸é ¾î¿¼ö ¾ø±¸..
// ÀÌ·¸°Ô ¹«½ÄÇÑ ¹æ¹ý ¸»±¸ ¹¹ ÀÖÀ»±î ??
$num = 0;
for($i=99 ; $i > 0 ; $i--) {
$temp_num = sprintf("%02d",$i);
$query = " select * from $morning_category_table where substring(category_id,1,$len) = '$parent_str' and substring(category_id,$next_len,2) = '$temp_num'";
$result = morning_query_error($query);
$list = morning_fetch_array($result);
morning_free_result($result);
if(!$list[category_id]) {
$num = $i;
//$count++;
}
}
if ($num == "0") { return "2"; }
} else {
$num++;
}
$num = sprintf("%02d",$num);
$next_num = substr($parent_str.$num."00000000", 0, $original_len);
return $next_num;
}
################################################################################
// ÆÄÀÏ ¾÷·Îµå
################################################################################
function upload_file($file, $file_name, $file_size, $file_dir, $file_okext, $max_file_size) {
if($file_name == "") return ;
$file_name = str_replace(" ","_",$file_name); // À̸§ÀÌ Áß°£¿¡ ºñ¾î ÀÖÀ¸¸é ¹Ù²Ù±â
$file_name = str_replace("-","_",$file_name); // À̸§ÀÌ Áß°£¿¡ - À» _ÀÌ°É·ç ¹Ù²Ù±â
if ($file_size > $max_file_size) error_msg("¾÷·Îµå ¿ë·®Àº ".getfilesize($max_file_size)." ÀÌÇϸ¸ °¡´ÉÇÕ´Ï´Ù.");
$file_ex = substr(strrchr($file_name,"."),1);
$file_ex = strtolower($file_ex);
if(!in_array($file_ex,$file_okext)) $file_name .= "_bad";
// °°Àº ÆÄÀÏÀÌ ÀÖ´Ù¸é () ¿¡ ¼ýÀÚ¸¦ ´õÇÏ¿© ´Ù¸¥ À̸§À» ¸¸µç´Ù.
$copy_index = 0;
$str = $file_name;
while(file_exists("$file_dir/$str")) {
$str_bit = explode(".", $file_name);
$copy_index++;
$str_bit[0] .= "(".$copy_index.")";
$str = implode(".", $str_bit);
$str = trim($str);
}
$temp_filename = $file_dir."/".$str;
@move_uploaded_file($file, $temp_filename);
return $temp_filename;
}
################################################################################
// ¼±ÅÃ È¸é ¸¸µé±â
################################################################################
function make_select($name,$codename,$data){
$data_bit = explode("/",$data);
$str .= "\n\n";
return $str;
}
################################################################################
// DOT À̹ÌÁö .. »ý¼º
################################################################################
function make_dot($image_link){
$str = "\n";
return $str;
}
################################################################################
// °Ô½ÃÆÇ ³»¿ë °£´Ü ÇÏ°Ô º¸¿©ÁÖ±â
################################################################################
function show_board_list($ps_db="notice",$board_name="morning_bmain_notice",$list_num="5",$lan_cut="30",$mini_image=">",$where_sql="",$order_sql="order by headnum asc"){
global $connect;
$query = "select * from $board_name $where_sql $order_sql limit 0, $list_num";
$mi_result = morning_query_error("$query");
while($mi_list = morning_fetch_array($mi_result)) {
$mi_list[board_subject] = cut_str($mi_list[board_subject],"$lan_cut","..");
$str .= $mini_image." $mi_list[board_subject]
";
}
return $str;
}
?>
if(is_dir("$g_mall_skin_dir/$cf_skin_name")) { include "$g_mall_skin_dir/$cf_skin_name/mall_header.html";
} else { include "$g_board_skin_dir/morning_basic_mall/mall_header.html"; }
?>