| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536 |
- <?php
- @error_reporting(E_ALL ^ E_NOTICE);
- @extract($_GET);
- @extract($_POST);
- @extract($_SERVER);
- @extract($_ENV);
- // Basic Message Function //
- function err_msg($str="์ค๋ฅ๋ฐ์", $url='',$target='') {
- echo "
- <script>
- alert(\"$str\"); ";
- if(!$url) {
- echo "history.back();";
- } else {
- if( $target ) echo $target . ".";
- echo "location.href='$url';";
- }
- echo "</script>";
- die();
- }
- function nvl($str, $replacestr="") {
- if(!$str){
- return $replacestr;
- }else{
- return $str;
- }
- }
- function fnGetDocExt($param){
- $allfile = strtolower($param);
- $fileinfo = pathinfo($allfile);
- $ext = $fileinfo['extension'];
- if($ext=="doc" || $ext=="hwp" || $ext=="ppt" || $ext=="pptx" || $ext=="docx" || $ext=="pdf"){
- return "doc";
- }else{
- return "img";
- }
- }
- FUNCTION error_page($str="์ค๋ฅ๋ฐ์",$url="") {
- $str = addslashes($str);
- if(!$url) $url = $PHP_SELF;
- echo "<script>location.href='error.html?msg=$str&url=$url'</script>";
- die();
- }
- function move_page($path,$time = 0) {
- die("<META http-equiv='refresh' content='$time;URL=$path'>");
- }
- function js_msg($str) {
- $str = addslashes($str);
- echo "<script>alert(\"$str\");</script>";
- }
- FUNCTION login_please($url) {
- $url = urlencode($url);
- if(!session_is_registered(MEM_SESS)) {
- js_msg('๋ก๊ทธ์ธ์ด ํ์ํฉ๋๋ค');
- move_page("/login/login.html?url=$url");
- }
- }
- function message($msg){
- global $head_url,$foot_url,$head_html,$foot_html;
- if ($head_url) include $head_url;
- echo stripslashes($head_html);
- echo "<table width=300 align=center cellspacing=0><tr><td height=50></td></tr><tr bgcolor=#dedfde style='font-family:tahoma;font-size:8pt'><td class=eng heigh=20> <font face=webdings size=2>4</font> <b>ERROR</b></td><td align=right class=eng><a href=javascript:history.back() class=bd><font face=webdings size=2>7</font> <b>BACK</b></a> </td></tr><tr><td colspan=2 bgcolor=#f7f7f7 align=center height=80 style='font-family:๋์;font-size:9pt'><b>$msg</b></td></tr></table>";
- echo stripslashes($foot_html);
- if ($foot_url) include $foot_url;
- exit;
- }
- function avoid_crack($data)
- {
- // Fix &entity\n;
- $data = str_replace(array('&','<','>'), array('&amp;','&lt;','&gt;'), $data);
- $data = preg_replace('/(&#*\w+)[\x00-\x20]+;/u', '$1;', $data);
- $data = preg_replace('/(&#x*[0-9A-F]+);*/iu', '$1;', $data);
- $data = html_entity_decode($data, ENT_COMPAT, 'UTF-8');
- // Remove any attribute starting with "on" or xmlns
- $data = preg_replace('#(<[^>]+?[\x00-\x20"\'])(?:on|xmlns)[^>]*+>#iu', '$1>', $data);
- // Remove javascript: and vbscript: protocols
- $data = preg_replace('#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([`\'"]*)[\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2nojavascript...', $data);
- $data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2novbscript...', $data);
- $data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*-moz-binding[\x00-\x20]*:#u', '$1=$2nomozbinding...', $data);
- // Only works in IE: <span style="width: expression(alert('Ping!'));"></span>
- $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?expression[\x00-\x20]*\([^>]*+>#i', '$1>', $data);
- $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?behaviour[\x00-\x20]*\([^>]*+>#i', '$1>', $data);
- $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*+>#iu', '$1>', $data);
- // Remove namespaced elements (we do not need them)
- $data = preg_replace('#</*\w+:\w[^>]*+>#i', '', $data);
- do
- {
- // Remove really unwanted tags
- $old_data = $data;
- $data = preg_replace('#</*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|i(?:frame|layer)|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|title|xml)[^>]*+>#i', '', $data);
- }
- while ($old_data !== $data);
- $data = preg_replace("/[\"\']/i", '\"', $data); //์๋ฐ์ดํ ์นํ
- $data = preg_replace("/[\"\']/i", "\'", $data); //๋ฐ์ดํ ์นํ
- // we are done...
- return $data;
- }
- function text_cut($str, $len){
- if(strlen($str) > $len){
- if(ord($str[$len - 1]) <= 127) $pos = $len;
- else{
- for($pos = $len - 1; $pos >= 0; $pos--){
- if (ord($str[$pos]) > 127) $h++;
- else break;
- }
- if ($h%2==0) $pos += $h + 1;
- else $pos += $h;
- }
- $str = mb_substr($str, 0, $pos, 'UTF-8');
- $str .="..";
- }
- return $str;
- }
- function validateAuth($dbpwd, $userpwd) {
- global $admin, $uadmin;
- if(session_is_registered("administrator")) {
- return true;
- } else {
- if($userpwd == $admin[passwd]) {
- // js_msg("์ ์ ๊ฐ ์
๋ ฅํ ํจ์ค์๋์ ์ ์ฒด๊ด๋ฆฌ์ ํจ์ค์๋๊ฐ ๋์ผ");
- return true;
- } else if($uadmin[passwd] == crypt($userpwd, $uadmin[passwd])) {
- // js_msg("์ ์ ๊ฐ ์
๋ ฅํ ํจ์ค์๋๊ฐ ๋ก์ปฌ๊ด๋ฆฌ์ ํจ์ค์๋์ ๋์ผ");
- return true;
- }else if(!$dbpwd || !$userpwd) {
- // js_msg("dbํจ์ค์๋๊ฐ ์๊ฑฐ๋ ์ ์ ๊ฐ ํจ์ค์๋๋ฅผ ์
๋ ฅํ์ง ์์");
- return false;
- } else if($dbpwd != $userpwd) {
- // js_msg("DBํจ์ค์๋์ ์ ์ ๊ฐ ์
๋ ฅํ ํจ์ค์๋๋ ์ผ์นํ์ง ์์");
- return false;
- } else return true;
- } // end outer if
- }
- function setLocalAdminSession($db, $pwd) {
- global $uadmin;
- if(!$db || !$pwd) return false;
- if($uadmin[passwd] == crypt($pwd, $uadmin[passwd])) {
- session_register($db);
- return true;
- } else {
- return false;
- }
- }
- function safeHTML($html, $tags = "b|br|i|u|ul|ol|li") {
- $html = preg_replace('/\0/', '', $html);
- $html = preg_replace('/\&/', '\0', $html);
- $html = htmlspecialchars($html);
- $html = str_replace(chr(13).chr(10),"<br>",$html);
- if($tags) {
- $html = preg_replace("/<($tags).*?>/i",'<\1>', $html);
- $html = preg_replace("/<\\/($tags)>/i",'</\1>', $html);
- }
- $html = preg_replace('/\0/', '&', $html);
- // $html = preg_replace("/>(http|https|ftp)(:\/\/\S+)<(.+?)");
- // $pattern = "(http://|ftp://)+([0-9a-zA-Z./@~?&=_]+)";
- // $html = ereg_replace($pattern, "<a href=\"\\1\\2\">\\1\\2</a>", $html);
- return $html;
- }
- function utf8_length($str) {
- $len = strlen($str);
- for ($i = $length = 0; $i < $len; $length++) {
- $high = ord($str[$i]);
- if ($high < 0x80)//0<= code <128 ๋ฒ์์ ๋ฌธ์(ASCII ๋ฌธ์)๋ ์ธ๋ฑ์ค 1์นธ์ด๋
- $i += 1;
- else if ($high < 0xE0)//128 <= code < 224 ๋ฒ์์ ๋ฌธ์(ํ์ฅ ASCII ๋ฌธ์)๋ ์ธ๋ฑ์ค 2์นธ์ด๋
- $i += 2;
- else if ($high < 0xF0)//224 <= code < 240 ๋ฒ์์ ๋ฌธ์(์ ๋์ฝ๋ ํ์ฅ๋ฌธ์)๋ ์ธ๋ฑ์ค 3์นธ์ด๋
- $i += 3;
- else//๊ทธ์ธ 4์นธ์ด๋ (๋ฏธ๋์ ๋์ฌ๋ฌธ์)
- $i += 4;
- }
- return $length;
- }
- function cutstring($str, $chars, $tail = '..') {
- if (utf8_length($str) <= $chars)//์ ์ฒด ๊ธธ์ด๋ฅผ ๋ถ๋ฌ์ฌ ์ ์์ผ๋ฉด tail์ ์ ๊ฑฐํ๋ค.
- $tail = '';
- else
- $chars -= utf8_length($tail);//๊ธ์๊ฐ ์๋ฆฌ๊ฒ ์๊ฒผ๋ค๋ฉด tail ๋ฌธ์์ด์ ๊ธธ์ด๋งํผ ๋ณธ๋ฌธ์ ๋นผ์ค๋ค.
- $len = strlen($str);
- for ($i = $adapted = 0; $i < $len; $adapted = $i) {
- $high = ord($str[$i]);
- if ($high < 0x80)
- $i += 1;
- else if ($high < 0xE0)
- $i += 2;
- else if ($high < 0xF0)
- $i += 3;
- else
- $i += 4;
- if (--$chars < 0)
- break;
- }
- return trim(substr($str, 0, $adapted)) . $tail;
- }
- function getFileType($filename) {
- $ext = substr($filename, strpos($filename, "."));
- }
- // ๋ฌธ์์ด์ ํ๊ธ์ด ํฌํจ๋์ด ์๋์ง ๊ฒ์ฌํ๋ ํจ์
- // ord - ๋ฌธ์์ ASCII ๊ฐ์ ๊ฐ์ ธ์ด
- function is_hangul($str) {
- // ํน์ ๋ฌธ์๊ฐ ํ๊ธ์ ๋ฒ์๋ด(0xA1A1 - 0xFEFE)์ ์๋์ง ๊ฒ์ฌ
- for($i = 0; $i < strlen($str); $i++) {
- $char = ord($str[$i]);
- if($char >= 0xa1 && $char <= 0xfe)
- return 1;
- }
- }
- // ์ํ๋ฒณ์ธ์ง ๊ทธ๋ฆฌ๊ณ ๋๋ฌธ์(0x41 - 0x5a)์ธ์ง ์๋ฌธ์(0x61 - 0x7a)์ธ์ง
- // ๊ฒ์ฌํ๋ ํจ์
- //
- // ord - ๋ฌธ์์ ASCII ๊ฐ์ ๊ฐ์ ธ์ด
- function is_alpha($char) {
- $char = ord($char);
- if($char >= 0x61 && $char <= 0x7a)
- return 1;
- if($char >= 0x41 && $char <= 0x5a)
- return 2;
- }
- // URL์ด ์ ํํ ๊ฒ์ธ์ง ๊ฒ์ฌํ๋ ํจ์
- //
- // eregi - ์ ๊ท ํํ์์ ์ด์ฉํ ๊ฒ์ฌ (๋์๋ฌธ์ ๋ฌด์)
- // eregi_replace - ์ ๊ท ํํ์์ ์ด์ฉํ ์นํ (๋์๋ฌธ์ ๋ฌด์)
- function check_url($url) {
- $url = trim($url);
- if(is_hangul($url))
- return;
- // ํ๋กํ ์ฝ(http://, ftp://...)์ ๋ํ๋ด๋ ๋ถ๋ถ์ด ์์ ๋ ๊ธฐ๋ณธ๊ฐ์ผ๋ก
- // http://๋ฅผ ๋ถ์
- if(!eregi("^(http://|https://|ftp://|telnet://|news://)", $url))
- $url = preg_match("^", "http://", $url);
- if(!eregi("(http|https|ftp|telnet|news):\/\/[a-z0-9-]+\.[][a-zA-Z0-9:&#@=_~%;\?\/\.\+-]+", $url))
- return;
- return $url;
- }
- // E-MAIL ์ฃผ์๊ฐ ์ ํํ ๊ฒ์ธ์ง ๊ฒ์ฌํ๋ ํจ์
- //
- // eregi - ์ ๊ท ํํ์์ ์ด์ฉํ ๊ฒ์ฌ (๋์๋ฌธ์ ๋ฌด์)
- function check_email($email) {
- $email = trim($email);
- if(is_hangul($email))
- return;
- if(!eregi("^[a-z0-9_-]+@[a-z0-9-]+\.[a-z0-9\.-]+", $email))
- return;
- return $email;
- }
- function getLatestList($db, $num=5) {
- global $PHP_SELF;
- $query = "select * from $db order by no desc limit 0, $num";
- $result = sql_query($query);
- if(sql_num_rows($result)) {
- while($list = sql_fetch_array($result)) {
- printLatestList($db,$list);
- }
- } else {
- echo "<tr align=center><td height=40><b>๋ฑ๋ก๋ ๊ธ์ด ์์ต๋๋ค</b></td></tr>";
- }
- sql_free_result($result);
- }
- function printLatestList($db, $list) {
- $list[title] = preg_match("\"",""",$list[title]);
- $title = sprintf("<tr><td background='/mainimg/newgameback.gif'><table width='232' border='0' cellspacing='2' cellpadding='0' align='center'><tr><td><img src='/mainimg/arrow.gif' width='13' height='11' align='absmiddle'> <a href=\"javascript:openwin2('board/read.php?db=%s&no=%s')\">%s</a></td></tr></table></td></tr><tr><td background='/mainimg/newgameback.gif'><img src='/mainimg/newgamespotline.gif' width='260' height='7'></td></tr>", $db, $list[no], $list[title]);
- echo "$title\n";
- }
- function getExt($filename) {
- $filename = trim($filename);
- $right = strrchr($filename, ".");
- return strtolower(substr($right,1));
- }
- /// ๊ฒ์๋ฌผ ์๋๋งํฌ ///
- function autolink($str){
- // URL
- $str=preg_match("(http|https|ftp|telnet|news)://([-/.a-zA-Z0-9_~#%$?&=:\200-\377\(\)]+)"," \\1://\\2",$str);
- $str=str_replace("=","=",$str);
- $str=str_replace("=\" ","=\"",$str);
- $str=str_replace("='","='",$str);
- $str=preg_match(" (http|https|ftp|telnet|news)://([-/.a-zA-Z0-9_~#%$?&=:\200-\377\(\)]+)","<a href=\"\\1://\\2\" target=\"_blank\" class=bd>\\1://\\2</a>",$str);
- // MAIL
- $str=preg_match("([\xA1-\xFEa-z0-9_-]+@[\xA1-\xFEa-z0-9-]+\.[a-z0-9-]+)"," \\1",$str);
- $str=str_replace("mailto:","mailto:",$str);
- $str=preg_match(" ([\xA1-\xFEa-z0-9_-]+@[\xA1-\xFEa-z0-9-]+\.[a-z0-9-]+)","<a href=\"mailto:\\1\" class=bd>\\1</a>",$str);
- return $str;
- }
- //์์คํค ๋ฌธ์์ด์ ํฅ์ฌ ์ฝ๋๋ก..
- function asc_hex($char){
- $j = 0;
- $word_length=strlen($char);
- for($i = 0;$i<$word_length;$i++) {
- if($j == 0){
- if(ord(substr($char,$i,1)) > 0xa1 && ord(substr($char,$i,1)) <= 0xfe) {
- if($i>0)$str .= ' ';
- $j = 1; $str = $str.bin2hex(substr($char,$i,1));
- }else{
- if($i>0)$str .= ' ';
- $str = $str.'00'.bin2hex(substr($char,$i,1));
- }
- }else{
- $str = $str.bin2hex(substr($char,$i,1));
- $j = 0;
- }
- }
- return $str;
- }
- //ํฅ์ฌ ์ฝ๋ ๋ฌธ์์ด์ ์์คํค ์ฝ๋ ๋ฌธ์์ด๋ก
- function hex_asc($str){
- $word_length=strlen($str);
- for($i = 0;$i<$word_length;$i+=5){
- $tmp1=HexDec(substr($str,$i,2));
- if($tmp1==0){
- $tmp2=HexDec(substr($str,$i+2,2));
- $str2.=chr($tmp2);
- }else{
- $tmp2=HexDec(substr($str,$i+2,2));
- $str2.=chr($tmp1).chr($tmp2);
- }
- }
- return $str2;
- }
- // ์ฌ์ฉ๋ฒ
- // $str=fuck2xxx($str,$fil,'XX');
- function fuck2xxx($str,$fil,$replace_str){
- $fil=explode(',',$fil);
- $replace_str=asc_hex($replace_str);
- $filter_str='/(';
- for($i=0;$i<count($fil);$i++){
- if($i>0)$filter_str.='|';
- $filter_str.=asc_hex($fil[$i]);
- }
- $filter_str.=')+/';
- $str=preg_replace($filter_str,$replace_str,asc_hex($str));
- return hex_asc($str);
- }
- // ์ฐ๊ธฐ๊ธ์งํ ๋จ์ด๋ค์ ๊ฒ์ํด์ ์์ผ๋ฉด true
- function is_fuck($str,$fil){
- $fil=explode(',',$fil);
- $filter_str='/(';
- for($i=0;$i<count($fil);$i++){
- if($i>0)$filter_str.='|';
- $filter_str.= $fil[$i];
- }
- $filter_str.=')+/';
- if( preg_match($filter_str,$str) ) {
- return true;
- } else {
- return false;
- }
- }
- function get_microtime($old, $new) {
- $old = explode(" ", $old);
- $new = explode(" ", $new);
- $time[msec] = $new[0] - $old[0];
- $time[sec] = $new[1] - $old[1];
- if($time[msec] < 0) {
- $time[msec] = 1.0 + $time[msec];
- $time[sec]--;
- }
- $time = sprintf("%.2f", $time[sec] + $time[msec]);
- return $time;
- }
- function print_microtime($old, $new) {
- $old = explode(" ", $old);
- $new = explode(" ", $new);
- $time[msec] = $new[0] - $old[0];
- $time[sec] = $new[1] - $old[1];
- if($time[msec] < 0) {
- $time[msec] = 1.0 + $time[msec];
- $time[sec]--;
- }
- $time = sprintf("%.2f", $time[sec] + $time[msec]);
- $str = "PageLoding Time : " . $time ." sec";
- echo "<script>window.status = '$str';</script>";
- }
- // ๋ ์ง๋ฅผ date ํ์์ผ๋ก ๋ฐ์์ ๊ทธ๋ ์์๋๋ UNIX TIMESTAMP ๋ฅผ ๋ฐํํด์ค๋ค
- function str2date($in){
- $t = split("/",$in);
- if (count($t)!=3) $t = split("-",$in);
- if (count($t)!=3) $t = split(" ",$in);
- if (count($t)!=3) return -1;
- if (!is_numeric($t[0])) return -1;
- if (!is_numeric($t[1])) return -2;
- if (!is_numeric($t[2])) return -3;
- if ($t[2]<1902 || $t[2]>2037) return -3;
- return mktime (0,0,0, $t[1], $t[0], $t[2]);
- }
- /* ============================================================================
- Return :
- Comment: ํ์ผ์ด ์ด๋ฏธ์ง์ธ์ง ์ฒดํฌ
- Usage :
- ------------------------------------------------------------------------------*/
- function img_type( $srcimg )
- {
- if(is_file($srcimg)) {
- $image_info = @getimagesize($srcimg);
- switch ($image_info['mime']) {
- case 'image/gif': return true; break;
- case 'image/jpeg': return true; break;
- case 'image/png': return true; break;
- case 'image/bmp': return true; break;
- default : return false; break;
- }
- } else {
- return false;
- }
- }
- //๊ธฐํ์ด๋ํจ์
- function AlertBack($msg){
- echo("
- <html><body>
- <meta charset='UTF-8' />
- <SCRIPT LANGUAGE=\"JavaScript\">
- <!--
- alert(\"$msg\");
- history.back();
- //-->
- </SCRIPT>
- </body></html>
- ");
- exit;
- }
- function Alert($msg){
- echo("
- <html><body>
- <meta charset='UTF-8' />
- <SCRIPT LANGUAGE=\"JavaScript\">
- <!--
- alert(\"$msg\");
- //-->
- </SCRIPT>
- </body></html>
- ");
- exit;
- }
- function AlertExit($msg){
- echo("
- <html><body>
- <meta charset='UTF-8' />
- <SCRIPT LANGUAGE=\"JavaScript\">
- <!--
- alert(\"$msg\");
- self.close();
- //-->
- </SCRIPT>
- </body></html>
- ");
- exit;
- }
- function AlertRedirect($msg,$url){
- echo("
- <html><body>
- <meta http-equiv='Refresh' content='0; URL=$url'>
- <meta charset='UTF-8' />
- <SCRIPT LANGUAGE=\"JavaScript\">
- <!--
- alert(\"$msg\");
- //-->
- </SCRIPT>
- </body></html>
- ");
- exit;
- }
- function AlertRedirectRefresh($msg,$url){
- echo("
- <html><body>
- <meta charset='UTF-8' />
- <SCRIPT LANGUAGE=\"JavaScript\">
- <!--
- opener.location.reload();alert(\"$msg\");
- self.close();
- //-->
- </SCRIPT>
- <meta http-equiv='Refresh' content='0; URL=$url'>
- </body></html>
- ");
- exit;
- }
- function AlertLogin($msg){
- echo("
- <html><body>
- <meta charset='UTF-8' />
- <SCRIPT LANGUAGE=\"JavaScript\">
- <!--
- alert(\"$msg\");
- top.location.href=\"/bkmode/index.html\";
- //-->
- </SCRIPT>
- </body></html>
- ");
- exit;
- }
- function Redirect($url){
- echo("
- <html><body>
- <SCRIPT LANGUAGE=\"JavaScript\">
- <!--
- location.replace('$url');
- //-->
- </SCRIPT>
- </body></html>
- ");
- exit;
- }
- function AlertExitRefresh($msg,$tourl){
- echo("
- <html><body>
- <meta charset='UTF-8' />
- <SCRIPT LANGUAGE=\"JavaScript\">
- <!--
- alert(\"$msg\");
- opener.location.replace('$tourl');
- self.close();
- //-->
- </SCRIPT>
- </body></html>
- ");
- exit;
- }
- function Replace($tourl){
- echo("
- <html><body>
- <SCRIPT LANGUAGE=\"JavaScript\">
- <!--
- location.replace('$tourl');
- //-->
- </SCRIPT>
- </body></html>
- ");
- exit;
- }
- function ExitRedirect($tourl){
- echo("
- <html><body>
- <SCRIPT LANGUAGE=\"JavaScript\">
- <!--
- opener.location.replace('$tourl');
- self.close();
- //-->
- </SCRIPT>
- </body></html>
- ");
- exit;
- }
- function ExitRefresh(){
- echo("
- <html><body>
- <SCRIPT LANGUAGE=\"JavaScript\">
- <!--
- opener.location.reload();
- self.close();
- //-->
- </SCRIPT>
- </body></html>
- ");
- exit;
- }
- function TopExit($tourl){
- echo("
- <html><body>
- <SCRIPT LANGUAGE=\"JavaScript\">
- <!--
- opener.top.location.replace('$tourl');
- self.close();
- //-->
- </SCRIPT>
- </body></html>
- ");
- exit;
- }
- function URL2($tourl,$url){
- echo("
- <html><body>
- <SCRIPT LANGUAGE=\"JavaScript\">
- <!--
- parent.left.location.href='$tourl';
- location.href='$url';
- //-->
- </SCRIPT>
- </body></html>
- ");
- exit;
- }
- /*
- //Ajaxํ์ด์ง
- function ListPgAjax($url,$pageno,$PageSize,$BlockPage,$totalrows)
- {
- $lastpgno=(int)@ceil($totalrows/$PageSize); //๋ง์ง๋ง ํ์ด์ง
- $now_num = (int) @ceil($pageno/$BlockPage);
- $start_num = (int) ($now_num - 1) * $BlockPage;
- $end_num = (int) $now_num * $BlockPage;
- $next_num = (int) $end_num + 1;//๋ง์ง๋ง ํ์ด์ง ๊ฐ ๊ตฌํจ
- $prev_num = (int) $start_num;//์์ ํ์ด์ง ๊ฐ ๊ตฌํจ
- $html = "";
- //์ฒ์
- if($pageno<>1) {
- $html += "<a href=\"javascript:$url(1,$PageSize,'1','#car_list1')\" onFocus=\"this.blur();\" class=\"arr first\">๋งจ ์ฒ์</a>";
- }
- //์ด์
- if($now_num > 1) {
- $html += "<a href=\"javascript:$url($prev_num,$PageSize,'1','#car_list1')\" onFocus=\"this.blur();\" class=\"arr prev\">์ด์ </a>";
- }
- //๋ธ๋ญ๋จ์ ํ์ด์ง
- for ($i = $start_num + 1; $i <= $end_num && $i <= $lastpgno; $i++) {
- if ($i == $pageno) {
- $html += " <strong>$i</strong> ";
- }
- else {
- $html += "<a href=\"javascript:$url($i,$PageSize,'1','#car_list1')\" onFocus=\"this.blur();\">$i</a> ";
- }
- }
- //๋ค์
- if($end_num < $lastpgno) {
- $html += " <a href=\"javascript:$url($next_num,$PageSize,'1','#car_list1')\" onFocus=\"this.blur();\" class=\"arr next\">๋ค์</a>";
- }
- //๋ง์ง๋ง
- if($pageno<>$lastpgno && $lastpgno>0 ) {
- $html += "<a href=\"javascript:$url($lastpgno,$PageSize,'1','#car_list1')\" onFocus=\"this.blur();\" class=\"arr last\">๋งจ ๋ง์ง๋ง</a>";
- }
- return $html;
- }
- */
- //๊ฒ์ํํ์ด์ง
- // function ListPg($url,$pageno,$PageSize,$BlockPage,$totalrows)
- // {
- //
- // $lastpgno=(int)@ceil($totalrows/$PageSize); //๋ง์ง๋ง ํ์ด์ง
- // $now_num = (int) @ceil($pageno/$BlockPage);
- // $start_num = (int) ($now_num - 1) * $BlockPage;
- // $end_num = (int) $now_num * $BlockPage;
- // $next_num = (int) $end_num + 1;//๋ง์ง๋ง ํ์ด์ง ๊ฐ ๊ตฌํจ
- // $prev_num = (int) $start_num;//์์ ํ์ด์ง ๊ฐ ๊ตฌํจ
- //
- // // echo '<div class="btn--right--wrap"></div>';
- // echo '<ul class="pagination">';
- // //์ด์
- // if($now_num > 1) {
- // // echo "<a href=\"$url&pageno=$prev_num\" onFocus=\"this.blur();\"><</a> <font color=\"#cccccc\">|</font>";
- // echo '<li class="page-item ">
- // <a class="page-link" href="#" aria-label="Previous">
- // <span aria-hidden="true">«</span>
- // </a>
- // </li>';
- // }
- // else{
- // echo "< <font color=\"#CCCCCC\">|</font>";
- // }
- //
- // //๋ธ๋ญ๋จ์ ํ์ด์ง
- // for ($i = $start_num + 1; $i <= $end_num && $i <= $lastpgno; $i++) {
- // if ($i == $pageno) {
- // // echo " <font color=\"#00adef\"><B>$i</B></font> <font color=\"#ccccc\">|</font>";
- // echo '<li class="page-item active"><a class="page-link" href="JavaScript">$i</a></li>';
- //
- // }
- // else {
- // // echo " <a href=\"$url&pageno=$i\" onFocus=\"this.blur();\">$i</a> <font color=\"#ccccc\">|</font>";
- // echo '<li class="page-item"><a class="page-link" href="{$url}&pageno={$i}">2</a></li>';
- // }
- // }
- //
- // //๋ค์
- // if($end_num < $lastpgno) {
- // // echo " <a href=\"$url&pageno=$next_num\" onFocus=\"this.blur();\">>";
- // echo '<li class="page-item">
- // <a class="page-link" href="{$url}&pageno={$next_num}" aria-label="Next">
- // <span aria-hidden="true">»</span>
- // </a>
- // </li>';
- // }
- // else{
- // echo " >";
- // }
- // echo '</ul>';
- //
- // // echo '<div class="btn--left--wrap"></div>';
- // }
- //๊ฒ์ํํ์ด์ง - ์ฌ์ฉ์
- function ListPg($url,$pageno,$PageSize,$BlockPage,$totalrows)
- {
- $lastpgno=(int)@ceil($totalrows/$PageSize); //๋ง์ง๋ง ํ์ด์ง
- $now_num = (int) @ceil($pageno/$BlockPage);
- $start_num = (int) ($now_num - 1) * $BlockPage;
- $end_num = (int) $now_num * $BlockPage;
- $next_num = (int) $end_num + 1;//๋ง์ง๋ง ํ์ด์ง ๊ฐ ๊ตฌํจ
- $prev_num = (int) $start_num;//์์ ํ์ด์ง ๊ฐ ๊ตฌํจ
- echo "<div class='btn--right--wrap'></div>";
- echo "<ul class='pagination'>";
- if($pageno<>1 || $now_num > 1) {
- // echo "<span>";
- }
- //์ฒ์
- if($pageno<>1) {
- // echo "<a href=\"$url&pageno=1\" class=\"first\" onFocus=\"this.blur();\">๋งจ์</a>";
- }
- //์ด์
- if($now_num > 1) {
- // echo "<a href=\"$url&pageno=$prev_num\" class=\"prev\" onFocus=\"this.blur();\">์ด์ </a>";
- echo "<li class='page-item '>
- <a class='page-link' href='{$url}&pageno={$prev_num}' aria-label='Previous'>
- <span aria-hidden='true'>«</span>
- </a>
- </li>";
- }
- if($pageno<>1 || $now_num > 1) {
- // echo "</span>";
- }
- //๋ธ๋ญ๋จ์ ํ์ด์ง
- for ($i = $start_num + 1; $i <= $end_num && $i <= $lastpgno; $i++) {
- if ($i == $pageno) {
- // echo "<strong>$i</strong>";
- echo "<li class='page-item active'><a class='page-link' href='javascript:;'>$i</a></li>";
- }
- else {
- // echo "<a href=\"$url&pageno=$i\" onFocus=\"this.blur();\">$i</a> ";
- echo "<li class='page-item'><a class='page-link' href='{$url}&pageno={$i}'>{$i}</a></li>";
- }
- }
- if( $end_num < $lastpgno || ($pageno<>$lastpgno && $lastpgno>0) ){
- // echo "<span>";
- }
- //๋ค์
- if($end_num < $lastpgno) {
- // echo " <a href=\"$url&pageno=$next_num\" class=\"next\" onFocus=\"this.blur();\">๋ค์</a>";
- echo "<li class='page-item'>
- <a class='page-link' href='{$url}&pageno={$next_num}' aria-label='Next'>
- <span aria-hidden='true'>»</span>
- </a>
- </li>";
- }
- //๋ง์ง๋ง
- if($pageno<>$lastpgno && $lastpgno>0 ) {
- // echo "<a href=\"$url&pageno=$lastpgno\" class=\"last\" onFocus=\"this.blur();\">๋งจ๋ค</a>";
- }
- if( $end_num < $lastpgno || ($pageno<>$lastpgno && $lastpgno>0) ){
- // echo "</span>";
- }
- echo "</ul>";
- echo "<div class='btn--left--wrap'></div>";
- }
- //๊ฒ์ํํ์ด์ง - ์ฌ์ฉ์
- function ListMobilePg($url,$pageno,$PageSize,$BlockPage,$totalrows)
- {
- $lastpgno=(int)@ceil($totalrows/$PageSize); //๋ง์ง๋ง ํ์ด์ง
- $now_num = (int) @ceil($pageno/$BlockPage);
- $start_num = (int) ($now_num - 1) * $BlockPage;
- $end_num = (int) $now_num * $BlockPage;
- $next_num = (int) $end_num + 1;//๋ง์ง๋ง ํ์ด์ง ๊ฐ ๊ตฌํจ
- $prev_num = (int) $start_num;//์์ ํ์ด์ง ๊ฐ ๊ตฌํจ
- echo "<ul class='pagination'>";
- if($pageno<>1 || $now_num > 1) {
- // echo "<span>";
- }
- //์ฒ์
- if($pageno<>1) {
- // echo "<a href=\"$url&pageno=1\" class=\"first\" onFocus=\"this.blur();\">๋งจ์</a>";
- }
- //์ด์
- if($now_num > 1) {
- // echo "<a href=\"$url&pageno=$prev_num\" class=\"prev\" onFocus=\"this.blur();\">์ด์ </a>";
- echo "<li class='page-item '>
- <a class='page-link' href='{$url}&pageno={$prev_num}' aria-label='Previous'>
- <span aria-hidden='true'>«</span>
- </a>
- </li>";
- }
- if($pageno<>1 || $now_num > 1) {
- // echo "</span>";
- }
- //๋ธ๋ญ๋จ์ ํ์ด์ง
- for ($i = $start_num + 1; $i <= $end_num && $i <= $lastpgno; $i++) {
- if ($i == $pageno) {
- // echo "<strong>$i</strong>";
- echo "<li class='page-item active'><a class='page-link' href='javascript:;'>$i</a></li>";
- }
- else {
- // echo "<a href=\"$url&pageno=$i\" onFocus=\"this.blur();\">$i</a> ";
- echo "<li class='page-item'><a class='page-link' href='{$url}&pageno={$i}'>{$i}</a></li>";
- }
- }
- if( $end_num < $lastpgno || ($pageno<>$lastpgno && $lastpgno>0) ){
- // echo "<span>";
- }
- //๋ค์
- if($end_num < $lastpgno) {
- // echo " <a href=\"$url&pageno=$next_num\" class=\"next\" onFocus=\"this.blur();\">๋ค์</a>";
- echo "<li class='page-item'>
- <a class='page-link' href='{$url}&pageno={$next_num}' aria-label='Next'>
- <span aria-hidden='true'>»</span>
- </a>
- </li>";
- }
- //๋ง์ง๋ง
- if($pageno<>$lastpgno && $lastpgno>0 ) {
- // echo "<a href=\"$url&pageno=$lastpgno\" class=\"last\" onFocus=\"this.blur();\">๋งจ๋ค</a>";
- }
- if( $end_num < $lastpgno || ($pageno<>$lastpgno && $lastpgno>0) ){
- // echo "</span>";
- }
- echo "</ul>";
- }
- //๊ฒ์ํํ์ด์ง1
- function ListPg1($url,$pageno,$PageSize,$BlockPage,$totalrows)
- {
- $lastpgno=(int)@ceil($totalrows/$PageSize); //๋ง์ง๋ง ํ์ด์ง
- $now_num = (int) @ceil($pageno/$BlockPage);
- $start_num = (int) ($now_num - 1) * $BlockPage;
- $end_num = (int) $now_num * $BlockPage;
- $next_num = (int) $end_num + 1;//๋ง์ง๋ง ํ์ด์ง ๊ฐ ๊ตฌํจ
- $prev_num = (int) $start_num;//์์ ํ์ด์ง ๊ฐ ๊ตฌํจ
- if($pageno<>1 || $now_num > 1) {
- echo "<span>";
- }
- //์ฒ์
- if($pageno<>1) {
- echo "<a href=\"$url&pageno=1\" class=\"first\" onFocus=\"this.blur();\">๋งจ์</a>";
- }
- //์ด์
- if($now_num > 1) {
- echo "<a href=\"$url&pageno=$prev_num\" class=\"prev\" onFocus=\"this.blur();\">์ด์ </a>";
- }
- if($pageno<>1 || $now_num > 1) {
- echo "</span>";
- }
- //๋ธ๋ญ๋จ์ ํ์ด์ง
- for ($i = $start_num + 1; $i <= $end_num && $i <= $lastpgno; $i++) {
- if ($i == $pageno) {
- echo "<strong>$i</strong>";
- }
- else {
- echo "<a href=\"$url&pageno=$i\" onFocus=\"this.blur();\">$i</a> ";
- }
- }
- if( $end_num < $lastpgno || ($pageno<>$lastpgno && $lastpgno>0) ){
- echo "<span>";
- }
- //๋ค์
- if($end_num < $lastpgno) {
- echo " <a href=\"$url&pageno=$next_num\" class=\"next\" onFocus=\"this.blur();\">๋ค์</a>";
- }
- //๋ง์ง๋ง
- if($pageno<>$lastpgno && $lastpgno>0 ) {
- echo "<a href=\"$url&pageno=$lastpgno\" class=\"last\" onFocus=\"this.blur();\">๋งจ๋ค</a>";
- }
- if( $end_num < $lastpgno || ($pageno<>$lastpgno && $lastpgno>0) ){
- echo "</span>";
- }
- }
- function ListPgFront($url,$pageno,$PageSize,$BlockPage,$totalrows)
- {
- /*
- <a href="#" class="arr first">๋งจ ์ฒ์</a>
- <a href="#" class="arr prev">์ด์ </a>
- <strong>1</strong>
- <a href="#">2</a>
- <a href="#">3</a>
- <a href="#">4</a>
- <a href="#">5</a>
- <a href="#" class="arr next">๋ค์</a>
- <a href="#" class="arr last">๋งจ ๋ง์ง๋ง</a>
- */
- $lastpgno=(int)@ceil($totalrows/$PageSize); //๋ง์ง๋ง ํ์ด์ง
- $now_num = (int) @ceil($pageno/$BlockPage);
- $start_num = (int) ($now_num - 1) * $BlockPage;
- $end_num = (int) $now_num * $BlockPage;
- $next_num = (int) $end_num + 1;//๋ง์ง๋ง ํ์ด์ง ๊ฐ ๊ตฌํจ
- $prev_num = (int) $start_num;//์์ ํ์ด์ง ๊ฐ ๊ตฌํจ
- //์ฒ์
- if($pageno<>1) {
- echo "<a href=\"$url&pageno=1\" onFocus=\"this.blur();\" class=\"arr first\">๋งจ์</a>";
- }
- //์ด์
- if($now_num > 1) {
- echo "<a href=\"$url&pageno=$prev_num\" onFocus=\"this.blur();\" class=\"arr prev\">์ด์ </a>";
- }
- //๋ธ๋ญ๋จ์ ํ์ด์ง
- for ($i = $start_num + 1; $i <= $end_num && $i <= $lastpgno; $i++) {
- if ($i == $pageno) {
- echo " <strong>$i</strong> ";
- }
- else {
- echo "<a href=\"$url&pageno=$i\" onFocus=\"this.blur();\">$i</a> ";
- }
- }
- //๋ค์
- if($end_num < $lastpgno) {
- echo " <a href=\"$url&pageno=$next_num\" onFocus=\"this.blur();\" class=\"arr nect\">๋ค์</a>";
- }
- //๋ง์ง๋ง
- if($pageno<>$lastpgno && $lastpgno>0 ) {
- echo "<a href=\"$url&pageno=$lastpgno\" onFocus=\"this.blur();\" class=\"arr last\">๋งจ๋ค</a>";
- }
- }
- //์๊ฒฉ์ง ์์ดํผ ์ป๊ธฐ
- function getIp() {
- return $_SERVER["REMOTE_ADDR"];
- }
- /*
- ํ์ผ์ ๋ค์ด๋ก๋ ๋ฐ๊ณ ์ ํ ๋ ์ฌ์ฉํ๋ ํจ์์ด๋ค.
- ์ฌ์ฉ๋ฒ์ ์๊ธฐ ์์ ์ ํ์ด์ง๋ฅผ ๋ฆฌํ๋์ฌ ํ๋ฉด์
- ํจ์๋ฅผ ํธ์ถํ๋ ๋ฐฉ์์ผ๋ก ํ๋ฉด๋๋ค.
- downloadname : ๋ค์ด๋ก๋ ๋ฐ์๋์ ์ด๋ฆ
- filepath : ํ์ผ์ ์๋ฒ๊ฒฝ๋ก(์์คํ
๊ฒฝ๋ก๋ ์๋๊ฒฝ๋ก)
- */
- function fileDownload($downloadname, $filepath) {
- $HTTP_USER_AGENT=$_SERVER["HTTP_USER_AGENT"];
- Header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
- $filesize=@filesize($filepath);
- if(strstr($HTTP_USER_AGENT, "MSIE 6.")) {
- Header("Content-type: application/x-msdownload");
- Header("Content-Length: $filesize");
- Header("Content-Disposition: attachment; filename=$downloadname");
- Header("Content-Transfer-Encoding: binary");
- Header("Pragma: no-cache");
- Header("Expires: 0");
- }
- else if(strstr($HTTP_USER_AGENT, "MSIE 5.5")) {
- header("Content-Type: doesn/matter");
- header("Content-disposition: filename=$downloadname");
- header("Content-Transfer-Encoding: binary");
- header("Pragma: no-cache");
- header("Expires: 0");
- }
- else if(strstr($HTTP_USER_AGENT, "MSIE 5.0")) {
- Header("Content-type: file/unknown");
- header("Content-Disposition: attachment; filename=$downloadname");
- Header("Content-Description: PHP3 Generated Data");
- header("Pragma: no-cache");
- header("Expires: 0");
- }
- else {
- if (eregi('(htm|php|txt|gif|jpg|jpeg|png)',$tmp1)) {
- $filename .='.file';
- }
- Header("Content-type: file/unknown");
- header("Content-Disposition: attachment; filename=$downloadname");
- Header("Content-Description: PHP3 Generated Data");
- header("Pragma: no-cache");
- header("Expires: 0");
- }
- header("Content-Description: File Transfert");
- @readfile($filepath);
- exit;
- }
- //ํ์ผ์ฌ์ด์ฆ
- function getFileSize($userfile_size) {
- if($userfile_size < 1024) $userfile_size=$userfile_size." B";
- else if ($userfile_size >1024 && $userfile_size < 1024 *1024) $userfile_size=sprintf("%0.1f K",$userfile_size / 1024);
- else $userfile_size=sprintf("%0.1f M",$userfile_size / (1024*1024));
- return $userfile_size;
- }
- function total_size($USER_PATH){
- $quota = exec("du -sk $USER_PATH");
- $Total = explode("$USER_PATH", $quota);
- $Total = trim($Total[0]);
- $Total=getFileSize(($Total*1024));
- return $Total;
- }
- function val_array($userval,$keyval) {
- while(list($key,$val) = each($userval)) {
- if($keyval==$key) $Val_Array=$val;
- }
- return $Val_Array;
- }
- function mod_checked($usercol,$userval) {
- if($usercol==$userval) $Val_Array= "checked"; return $Val_Array;
- }
- function mod_selected($usercol,$userval) {
- if($usercol==$userval) $Val_Array= "selected"; return $Val_Array;
- }
- function mod_filepath($usercol,$userval,$url,$width='35') {
- if(file_exists($usercol)) {
- $Val_Array="<img src='$usercol' width='$width'><input type=hidden name=$userval value='$usercol'> <a href='$url' onclick=\"javascript:var msg='์ญ์ ํ์๊ฒ ์ต๋๊น?';return confirm(msg);\"><font color=\"darkorange\"><B>Del</B></font></a>";
- return $Val_Array;
- }
- }
- function view_filepath($usercol,$userval) {
- if($usercol) {
- $Val_Array="<img src='$usercol' width=73 height=47><input type=hidden name='$userval' value='$usercol'> ";
- return $Val_Array;
- }
- }
- function view_file($usercol,$userval) {
- if($usercol) {
- $Val_Array=" <a href=\"javascript:imgwin('/board/preview.html','$usercol');\"><img src='/usedcar/images/icon_photo.gif' border=0 align=absmiddle></a><input type=hidden name=$userval value='$usercol'>";
- echo $Val_Array;
- }
- }
- function getDatePlus($plus_y,$plus_m,$plus_d,$type)
- {
- return date($type,mktime(0,0,0,date("m")+$plus_m,date("d")+$plus_d,date("Y")+$plus_y));
- }
- function getDateDay($y,$m,$d,$type)
- {
- return date($type,mktime(0,0,0,$m,$d,$y));
- }
- function getDaySearchForm($yp,$mp,$dp,$ys,$ms,$ds,$yg,$mg,$dg,$oc,$nm,$el,$sy)
- {
- //getDaySearchForm(์ถ๋ ฅ(๋
,์,์ผ),์ฝ์
(๋
,์,์ผ),์ด๊ธฐ๊ฐ(๋
,์,์ผ),event,name,๊ธฐ๋ณธ์
ํ
,์์๋
๋)
- $year = (!$yg) ? (!$el) ? date("Y") : substr($el,0,4) : $yg;
- $month = (!$mg) ? (!$el) ? date("m") : substr($el,4,2) : $mg;
- $day = (!$dg) ? (!$el) ? date("d") : substr($el,6,2) : $dg;
- if($yp) {
- $rtn = "<select name='syear$nm'$oc>\n";
- for($i = $sy; $i < date("Y")+2; $i++)
- {$rtn .= ($i != $year) ? "<option value='$i'>$i$ys</option>" : "<option value='$i' selected>$i$ys</option>";}
- $rtn .= "\n</select>\n\n";
- }
- if($mp) {
- $rtn .= "<select name='smonth$nm'$oc>\n";
- for($i = 1; $i < 13; $i++)
- {$o = ($i < 10) ? "0".$i : $i;
- $rtn .= ($i != $month) ? "<option value='$o'>$o$ms</option>" : "<option value='$o' selected>$o$ms</option>";}
- $rtn .= "\n</select>\n\n";
- }
- if($dp){
- $rtn .= "<select name='sday$nm'$oc>\n";
- for($i = 1; $i < 32; $i++)
- {$o = ($i < 10) ? "0".$i : $i;
- $rtn .= ($i != $day) ? "<option value='$o'>$o$ds</option>" : "<option value='$o' selected>$o$ds</option>";}
- $rtn .= "\n</select>\n\n";
- }
- return $rtn;
- }
- function get_excel_content($db,$table,$SQL)
- {
- $result = mysql_db_query($db, "SELECT * FROM $table $SQL");
- print "<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1 WIDTH=100%>\r\n";
- print "<TR BGCOLOR=GOLD ALIGN=CENTER>\r\n";
- for($j = 0; $j < mysql_num_fields($result); $j++) {
- print "<TD width=80 height=16><B>".mysql_field_name($result,$j)."</B></TD>\r\n";
- }
- print "</TR>\r\n";
- while ($row = mysql_fetch_row($result)) {
- print "<TR>\r\n";
- for($j = 0; $j < mysql_num_fields($result); $j++) {
- print "<TD width=80 height=16>".stripslashes($row[$j])."</TD>\r\n";
- }
- print "</TR>\r\n";
- }
- print "</TABLE>\r\n";
- print "</HTML>";
- }
- function FileView($file1_,$w,$h) {
- if($file1_) {
- if(eregi(".(gif|jpg|jpeg|bmp|ico|png)$",$file1_[0])) $viewfile = "<a href=\"javascript:imgwin('preview.html','./upload/$file1_[0]');\">".reSizeImg('/board/upload/'.$file1_[0],$w,$h)."</a>";
- if(eregi(".(asf|mp3|mp2|mp4|avi|wm|wmx|wmp|wax|dat|wvx|mpe|m1v|mpv2|mp2v|mpa|m3u|midi|rmi|ivf|aif|aifc|aiff|au|snd|cda|mpg|mpeg|wma|wmv|asx|wav|mid)$",$file1_[0])) $viewfile = "<embed src='/board/upload/$file1_[0]'>";
- }
- return $viewfile;
- }
- function DownFile($file1_,$url) {
- $downfile=" <a href='$url'><font color=\"000000\">$file1_[1]</font></a> ($file1_[2])";
- return $downfile;
- }
- function generatePassword($length) {
- $lowercase = "qwertyuiopasdfghjklzxcvbnm";
- $numbers = "1234567890";
- $randomCode = "";
- mt_srand(crc32(microtime()));
- $max = strlen($lowercase) - 1;
- for ($x = 0; $x < abs($length/2); $x++) {
- $randomCode .= $lowercase[mt_rand(0, $max)];
- }
- $max = strlen($numbers) - 1;
- for ($x = 0; $x < abs($length/2); $x++) {
- $randomCode .= $numbers[mt_rand(0, $max)];
- }
- return str_shuffle($randomCode);
- }
- function upload($filearray, $targetdir, $max_size, $allowext){
- $max_size = $max_size * 2048 * 2048; // ๋ฐ์ดํธ๋ก ๊ณ์ฐํ๋ค. 1MB = 1024KB = 1048576Byte
- if(!is_dir($targetdir)){
- @mkdir($targetdir, 0777);
- }
- //์ฐจ๋์ด๋ฏธ์ง ๋ฑ๋ก์ ratio๋ ๊ฐ์ด ์์ฑ
- if(strpos($targetdir, 'uploadfile/car/') !== false) {
- if(!is_dir($targetdir.'ratio/')){
- @mkdir($targetdir.'ratio/', 0777);
- }
- }
- if($filearray['size'] > $max_size){
- return false;
- }else {
- $file_ext = strtolower(end(explode('.', $filearray['name'])));
- if($allowext!=null){
- if(in_array($file_ext, array_change_key_case($allowext,CASE_LOWER))){
- $file_name = rand(10000,99999)."_".$filearray['name'];
- $file_name = preg_replace ("/[ #\&\+\-%@=\/\\\:;,\'\"\^`~\|\!\?\*$#<>()\[\]\{\}]/i", "", $file_name);
- $path = $targetdir . '/' . $file_name;
- if(copy($filearray['tmp_name'], $path)){
- return $file_name;
- }else{
- return false;
- // ์คํจ ํ์ ๊ฒฝ์ฐ์๋ false๋ฅผ ์ถ๋ ฅํฉ๋๋ค.
- }
- }else{
- return false;
- }
- }else{
- $file_name = $file_ext."_".time().".".$file_ext;
- $file_name = preg_replace ("/[ #\&\+\-%@=\/\\\:;,\'\"\^`~\|\!\?\*$#<>()\[\]\{\}]/i", "", $file_name);
- $path = $targetdir . '/' . $file_name;
- if(copy($filearray['tmp_name'], $path)){
- return $file_name;
- }else{
- return false;
- }
- }
- }
- }
- function sendMail($to, $to_name, $from, $from_name, $subject, $comment, $type="1", $cc="", $bcc="") {
- $recipient = "=?utf-8?B?".base64_encode($to_name)."?= <$to>";
- // ๊ธ๋ด์ฉ์ด textํ์
- if($type == 2) $comment = nl2br(htmlspecialchars($comment));
- $fmail = 'design@interscope.co.kr';//ํ์ด์ฆ ์ ์ฑ
์ผ๋ก fmail๊ณ ์
- $headers = "From: =?utf-8?B?".base64_encode($from_name)."?= <{$from}>\r\n";
- $headers .= "X-Sender: <$from>\n";
- $headers .= "X-Mailer: PHP ".phpversion()."\n";
- $headers .= "X-Priority: 1\n";
- $headers .= "Return-Path: <$from>\n";
- $headers .= "Content-Type: text/html; ";
- $headers .= "charset=utf-8\n";
- $headers .= "Content-Transfer-Encoding: base64\n";
- if($cc) $headers .= "cc: $cc\n";
- if($bcc) $headers .= "bcc: $bcc";
- $comment = stripslashes($comment);
- $comment = str_replace("\n\r","\n", $comment);
- //return mail($recipient , '=?utf-8?B?'.base64_encode($subject).'?=' , base64_encode($comment) , $headers);
- return mail($recipient , '=?utf-8?B?'.base64_encode($subject).'?=' , base64_encode($comment) , $headers, '-f'.$fmail);//ํ์ด์ฆ ์ ์ฑ
์ผ๋ก ๋ณ๊ฒฝ
- }
- function chk_file($tmpfile, $file) {
- if (!is_uploaded_file($tmpfile)) {
- return false;
- }
- $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
- if (!in_array($ext, array('png','jpeg','jpg'))) {
- echo 'ํ์ฅ์๊ฐpng,jpeg,jpg์ธ ๊ฒ๋ง ์ฌ๋ ค์ฃผ์ธ์';
- return false;
- }
- // ์ฌ๊ธฐ์ ์๋ฌ๊ฐ ๋๋ฉด
- // PHP.ini ํ์ผ์์ extension=fileinfo.so,
- // ํน์extension=php_fileinfo.dll ์ฝ๋ฉํธ ์ ๊ฑฐ ํด์ฃผ์๊ณ ์ฌ๊ธฐ๋
- $finfo = finfo_open(FILEINFO_MIME_TYPE);
- $mime_type = finfo_file($finfo, $tmpfile);
- if (!in_array($mime_type, array('image/png', 'image/jpeg'))) {
- echo '์ด๋ฏธ์ง ํ์ผ์ด ์๋์์';
- return false;
- }
- return true;
- }
- if (!function_exists('json_encode')) {
- function json_encode($data) {
- $json = new Services_JSON();
- return( $json->encode($data) );
- }
- }
- if( !function_exists('json_decode') ) {
- function json_decode($data) {
- $json = new Services_JSON();
- return( $json->decode($data) );
- }
- }
- function mail_send($mail_title, $mail_content, $arr_email, $arr_name){
- try {
- $mail = new PHPMailer(true);
- $mail->IsSMTP(); // send via SMTP
- $mail->Host = MAILHOST;
- $mail->Port = MAILPORT;
- $mail->Mailer = "smtp";
- $mail->CharSet = "euc-kr";
- $mail->Encoding = "base64";
- $mail->Username = GUSER; //SMTP ์ฌ์ฉ์ ์ด๋ฆ
- $mail->Password = GPWD; //SMTP ๋น๋ฐ๋ฒํธ
- $mail->SMTPAuth = true; // turn on SMTP authentication
- $mail->SMTPSecure = 'ssl';
- $webmaster_email = GUSER; // ๋ต๋ณ์ ๋ฐ์ ์ด๋ฉ์ผ
- $mail->From = GUSER;
- $mail->FromName = "WEBMASTER"; // ๋ณด๋ด๋ ์ฌ๋ ์ด๋ฆ
- $email = explode("|", $arr_email);
- $name = explode("|", $arr_name);
- for($i=0; $i<count($email); $i++){
- $mail->AddAddress($email[$i], iconv("UTF-8","EUC-KR",$name[$i]));
- }
- $mail->AddReplyTo($webmaster_email,"Webmaster");
- $mail->WordWrap = 50; // set word wrap
- $mail->IsHTML(true); // HTML์ ํ์์ผ๋ก ๋ณด๋
- $mail->Subject = iconv("UTF-8","EUC-KR",$mail_title); // ๋ฉ์ผ ์ด๋ฆ
- $mail_fileName = $_SERVER['DOCUMENT_ROOT'].'/common/templet/admin_mail.html';
- $fp = fopen($mail_fileName, "r");
- $fr = fread($fp, filesize($mail_fileName));
- fclose($fp);
- $fr = str_replace("[[nm_title]]",$mail_title, $fr); // ์ ๋ชฉ
- $fr = str_replace("[[nm_cont]]",$mail_content, $fr); // ๋ด์ฉ
- $mail->Body = iconv("UTF-8","EUC-KR",$fr); // ๋ด์ฉ
- $mail->AltBody = $mail_content;
- $mail->IsSMTP();
- $mail->Send();
- return true;
- } catch (phpmailerException $e) {
- //echo $e->errorMessage(); //Pretty error messages from PHPMailer
- //die();
- return false;
- } catch (Exception $e) {
- //echo $e->getMessage(); //Boring error messages from anything else!
- //die();
- return false;
- }
- }
- function getCode($table, $column , $code){
- $code=@mysql_result(mysql_query("select nm_name
- from code_master
- where nm_table='".$table."'
- and nm_column='".$column."'
- and nm_code='".$code."'
- and ds_delind='N'"),0,0);
- return $code;
- }
- //๋จ์ํ ์น์ฐ๋ ๊ฐ์ : SMS๋ฅผ ๋ฐ์กํ ๋ POST ๋ฐฉ์์ผ๋ก ๋ฉ์์ง๋ฅผ ๋ ๋ ค์ค๋๋ค.
- //์น๋ชจ๋์ ๋ฑ๋ก๋ ์ฌ์ฉ์๋ง ๋ฉ์์ง ์ ์ก์ด ๊ฐ๋ฅํ๋ฉฐ, ํน์ ์์ดํผ์์๋ง ๋ฐ์ก์ ์ํ์๋ ๊ฒฝ์ฐ ์น์ฐ๋ ์ฌ์ฉ์ ๋ฑ๋กํ "ํ์์ ๋ณด ์์ " ์์ ์์ดํผ๋ฅผ ๋ฑ๋กํด์ฃผ์๋ฉด ๋ฉ๋๋ค.
- //๋จ์ํ ๋ชจ๋์ ํ๋ฒ์ ๊ด๋ฆฌ์1๋ช
์๊ฒ๋ง ๋ฌธ์๊ฐ ํต๋ณด๊ฐ ๋๋ ํํ์ด๋ฉฐ, ๋ค์ค์ ๊ด๋ฆฌ์๊ฐ ์๋๊ฒฝ์ฐ ๊ฐ๊ฐ์ ๊ด๋ฆฌ์ ์๋งํผ ๋ฃจํ๋ฅผ ๋๋ฆฐํ 1๋ช
๋จ์๋ก get_url_fsockopen์ ํธ์ถํ์๋ฉด ๋ฉ๋๋ค.
- function get_url_fsockopen($url,$vars){
- $result = array();
- $URL_parsed = parse_url($url);
- $host = $URL_parsed["host"];
- $port = ($URL_parsed["port"]) ? $URL_parsed["port"] : 80;
- $path = $URL_parsed["path"];
- $request.="POST ".$path." HTTP/1.1\r\n";
- $request.="Host: ".$host.":".$port."\r\n";
- $request.="Referer: $referer\r\n";
- $request.="Content-type: application/x-www-form-urlencoded\r\n";
- $request.="Content-length: ".strlen($vars)."\r\n";
- $request.="Connection: close\r\n";
- $request.="\r\n";
- $request.=$vars."\r\n";
- $fp = fsockopen($host, $port, $errno, $errstr, 30);
- fputs($fp, $request);
- while(!feof($fp)) {
- $result[] .= fgets($fp, 128);
- }
- fclose($fp);
- return $result[10];
- }
- //์ค๋ ๋ฐํ
- function now(){
- return date ("Y-m-d H:i:s");
- }
- function getymd(){
- return date ("Ymd");
- }
- function nowDate(){
- $week = array("์ผ", "์", "ํ", "์", "๋ชฉ", "๊ธ", "ํ ");
- $s = $week[date("w")];
- return date ("Y"."๋
"."m"."์ "."d"."์ผ "). "(".$s.")";
- }
- function tag($str,$len){
- return cutstring(stripslashes(strip_tags($str)),$len);
- }
- function databr($str){
- return str_replace("\n","<br/>", $str);
- }
- /*ExcelPrint*/
- function to_excel($array, $filename) {
- header('Content-type: application/vnd.ms-excel');
- header('Content-Disposition: attachment; filename='.$filename.'.xls');
- $h = array();
- foreach($array->result_array() as $row){
- foreach($row as $key=>$val){
- if(!in_array($key, $h)){
- $h[] = $key;
- }
- }
- }
- //echo the entire table headers
- echo '<table><tr>';
- foreach($h as $key) {
- $key = ucwords($key);
- echo '<th>'.$key.'</th>';
- }
- echo '</tr>';
- foreach($array->result_array() as $row){
- echo '<tr>';
- foreach($row as $val){
- echo '<td>'.utf8_decode($val).'</td>';
- }
- }
- echo '</tr>';
- echo '</table>';
- }
- //FTP ํ์ผ์ ์ก(ํ์๋ฒ์ ์ก๋จ)
- function ftp_upload($files, $source_dir, $target_dir){
- $ftp_host = "alis2.news.naver.com";
- $ftp_user = "ktnews_s";
- $ftp_pass = "ktnews_sb4UYdxD=jn";
- $result = 0;
- $conn_id = ftp_connect($ftp_host);
- $login_result = ftp_login($conn_id, $ftp_user, $ftp_pass);
- if(!$conn_id || !$login_result) {
- $result = 999;
- return;
- }
- $dir = ftp_chdir($conn_id, $target_dir);
- $files = explode(',',$files);
- foreach($files as $file){
- $file = trim($file);
- $d = explode('/',$file);
- if(count($d)>1){
- $dir_sub = "";
- for($i=0;$i<count($d)-1;$i++) {
- if($dir_sub){
- $dir_sub .= "/".$d[$i];
- }else{
- $dir_sub = $d[$i];
- }
- @ftp_mkdir($conn_id, $dir_sub);
- }
- }
- $up = ftp_put($conn_id, $file, $source_dir."/".$file, FTP_BINARY);
- if($up){
- $result++;
- }
- }
- ftp_close($conn_id);
- return $result;
- }
- function random_string($length) {
- $key = '';
- $keys = array_merge(range(0, 9), range('a', 'z'));
- for ($i = 0; $i < $length; $i++) {
- $key .= $keys[array_rand($keys)];
- }
- return $key;
- }
- function getRequestType($type){
- if($type=="A0"){
- return "์์น์ ์ฒญ";
- }elseif($type=="B0"){
- return "๋ธ๋ก์
์ ์ฒญ";
- }else{
- return "๊ฒฌ์ ์์ฒญ";
- }
- }
- function fnGetBbsTitle($type){
- if($type=="01"){
- return "๊ณต์ง์ฌํญ";
- }else if($type=="02"){
- return "1:1๋ฌธ์";
- }else if($type=="03"){
- return "์์ฃผ๋ฌป๋ ์ง๋ฌธ";
- }else{
- return "๊ฒ์ํ";
- }
- }
- function reArrayFiles(&$file_post) {
- $file_ary = array();
- $file_count = count($file_post['name']);
- $file_keys = array_keys($file_post);
- for ($i=0; $i<$file_count; $i++) {
- foreach ($file_keys as $key) {
- $file_ary[$i][$key] = $file_post[$key][$i];
- }
- }
- return $file_ary;
- }
- function MobileCheck() {
- global $HTTP_USER_AGENT;
- $MobileArray = array("iphone","lgtelecom","skt","mobile","samsung","nokia","blackberry","android","android","sony","phone");
- $checkCount = 0;
- for($i=0; $i<sizeof($MobileArray); $i++){
- if(preg_match("/$MobileArray[$i]/", strtolower($HTTP_USER_AGENT))){ $checkCount++; break; }
- }
- return ($checkCount >= 1) ? "Mobile" : "Computer";
- }
- //์ด๋ฏธ์ง ํ์ผ ์
๋ก๋
- function _upload_car_image($upload_path, $upload_ratio_path, $param_filename, $max_size, $thumb = false) {
- $res = array("result" => true, "msg"=> "", "filename"=> "", "thumb_info" => array());
- //์ด๋ฏธ์ง ์ฒจ๋ถํ์ผ ๋ฑ๋ก ์ฌ๋ถ ์ฒดํฌ
- if (is_uploaded_file($_FILES[$param_filename]['tmp_name'])) {
- if($_FILES[$param_filename]['size'] > 0 ){
- $upload_file_name = upload($_FILES[$param_filename],$upload_path, $max_size, array('gif', 'jpeg', 'jpg','png','bmp' ,'ttif'));
- //์ฒจ๋ถํ์ผ ์
๋ก๋ ์คํจ
- if($upload_file_name==false){
- $res["result"] = false;
- $res["msg"] = "์ฒจ๋ถํ์ผ ์
๋ก๋ ์คํจ ํ์์ต๋๋ค";
- }
- //์
๋ก๋ ์ฑ๊ณต
- else {
- $res["filename"] = $upload_file_name;
- // create_watermark($upload_path.$upload_file_name);
- if($thumb == true) {
- // echo $upload_path.$upload_file_name.'<br/>';
- // echo $upload_ratio_path.$upload_file_name.'<br/>';
- // exit;
- $thumb = array(
- 'o_path' => $upload_path.$upload_file_name, 'n_path' => $upload_ratio_path.$upload_file_name,
- 'mode' => 'ratio', 'width' => CAR_THUM2_WIDTH, 'height' => CAR_THUM2_HEIGHT, 'preview_yn' => 'N','o_name' =>$upload_file_name
- );
- $thumb_info = getThumb($thumb);
- if($_SERVER['REMOTE_ADDR'] == '220.86.24.199') {
- // print_r($thumb_info);
- // exit;
- }
- $res["thumb_info"] = $thumb_info;
- }
- }
- }
- }
- return $res;
- }
- //์ฐจ๋ ์ด๋ฏธ์ง๋ฅผ ๊ฐ์ ธ์ด
- function getCarBasicImage($cd_car, $img, $title = "์ด๋ฏธ์ง", $bsumogallery = false, $sumogallery_group='basic') {
- $sumo_tag = "";
- $no_image = "/img/car_basic_no_image_1000x600.png";
- $no_thumb_image = "/img/car_basic_no_image_90x70.png";
- $img_src = UPLOAD_PATH_CAR.$cd_car."_main/".$img;//."nm_file_main/".$img;
- $img_thumb_src = UPLOAD_PATH_CAR.$cd_car."_main/ratio/".$img;
- $img_thumb_src = UPLOAD_PATH_CAR.$cd_car."_main/".$img;
- //ํด๋น ํ์ผ์ด ์๋ค๋ฉด no์ด๋ฏธ์ง๋ก ๋์ฒด
- if(!is_file($_SERVER['DOCUMENT_ROOT'].$img_src)) {
- $img_src = $no_image;
- $img_thumb_src = $no_thumb_image;
- }
- //์กด์ฌํ๋ฉด ํ์ผํ์์ ํ๋ผ๋ฏธํฐ๋ก ์ฌ์ฉ
- else {
- $img_filemtime = filemtime($_SERVER['DOCUMENT_ROOT'].$img_src);
- $img_src.= '?time='.$img_filemtime;
- $img_thumb_src.= '?time='.$img_filemtime;
- }
- //sumo gallery ์ฉ
- if($bsumogallery == true) {
- $sumo_tag = " data-sgallery='".$sumogallery_group."' data-full='".$img_src."' data-thumb='".$img_thumb_src."' ";
- }
- $img_tag = "<img src='".$img_thumb_src."' title='".$title."' $sumo_tag />";
- return $img_tag;
- }
- //์ฐจ๋ ์ด๋ฏธ์ง๋ฅผ ๊ฐ์ ธ์ด
- function getCarBasicImageString($cd_car, $img, $title = "์ด๋ฏธ์ง") {
- $sumo_tag = "";
- $no_image = "/img/car_basic_no_image_1000x600.png";
- $no_thumb_image = "/img/car_basic_no_image_90x70.png";
- $img_src = UPLOAD_PATH_CAR.$cd_car."_main/".$img;//."nm_file_main/".$img;
- $img_thumb_src = UPLOAD_PATH_CAR.$cd_car."_main/ratio/".$img;
- $img_thumb_src = UPLOAD_PATH_CAR.$cd_car."_main/".$img;
- //ํด๋น ํ์ผ์ด ์๋ค๋ฉด no์ด๋ฏธ์ง๋ก ๋์ฒด
- if(!is_file($_SERVER['DOCUMENT_ROOT'].$img_src)) {
- $img_src = $no_image;
- $img_thumb_src = $no_thumb_image;
- }
- //sumo gallery ์ฉ
- // if($bsumogallery == true) {
- // $sumo_tag = " data-sgallery='".$sumogallery_group."' data-full='".$img_src."' data-thumb='".$img_thumb_src."' ";
- // }
- //
- // $img_tag = "<img src='".$img_thumb_src."' title='".$title."' $sumo_tag />";
- return $img_thumb_src;
- }
- //์ฐจ๋ ์ด๋ฏธ์ง๋ฅผ ๊ฐ์ ธ์ด
- function getCarBasicThumbImage($cd_car, $img, $title = "์ด๋ฏธ์ง", $bsumogallery = false, $sumogallery_group='basic') {
- $sumo_tag = "";
- $no_image = "/img/car_basic_no_image_1000x600.png";
- $no_thumb_image = "/img/car_basic_no_image_90x70.png";
- $img_src = UPLOAD_PATH_CAR.$cd_car."_main/".$img;//."nm_file_main/".$img;
- $img_thumb_src = UPLOAD_PATH_CAR.$cd_car."_main/ratio/".$img;
- //ํด๋น ํ์ผ์ด ์๋ค๋ฉด no์ด๋ฏธ์ง๋ก ๋์ฒด
- if(!is_file($_SERVER['DOCUMENT_ROOT'].$img_src)) {
- $img_src = $no_image;
- $img_thumb_src = $no_thumb_image;
- }
- //์กด์ฌํ๋ฉด ํ์ผํ์์ ํ๋ผ๋ฏธํฐ๋ก ์ฌ์ฉ
- else {
- // echo $img_src;
- // exit;
- $img_filemtime = filemtime($_SERVER['DOCUMENT_ROOT'].$img_src);
- $img_src.= '?time='.$img_filemtime;
- $img_thumb_src.= '?time='.$img_filemtime;
- }
- // echo $_SERVER['DOCUMENT_ROOT'].$img_src;
- // exit;
- //sumo gallery ์ฉ
- if($bsumogallery == true) {
- $sumo_tag = " data-sgallery='".$sumogallery_group."' data-full='".$img_src."' data-thumb='".$img_thumb_src."' ";
- }
- $img_tag = "<img src='".$img_thumb_src."' title='".$title."' $sumo_tag />";
- return $img_tag;
- }
- //์ฐจ๋ ์ด๋ฏธ์ง๋ฅผ ๊ฐ์ ธ์ด
- function getCarAddtionalImage($cd_car, $img, $title = "์ด๋ฏธ์ง", $bsumogallery = false, $sumogallery_group='basic') {
- $sumo_tag = "";
- $no_image = "/img/car_basic_no_image_1000x600.png";
- $no_thumb_image = "/img/car_basic_no_image_90x70.png";
- $img_src = UPLOAD_PATH_CAR.$cd_car."_detail/".$img;
- $img_thumb_src = UPLOAD_PATH_CAR.$cd_car."_detail/".$img;
- //ํด๋น ํ์ผ์ด ์๋ค๋ฉด no์ด๋ฏธ์ง๋ก ๋์ฒด
- if(!is_file($_SERVER['DOCUMENT_ROOT'].$img_src)) {
- $img_src = $no_image;
- $img_thumb_src = $no_thumb_image;
- }
- //์กด์ฌํ๋ฉด ํ์ผํ์์ ํ๋ผ๋ฏธํฐ๋ก ์ฌ์ฉ
- else {
- // echo $img_src;
- // exit;
- $img_filemtime = filemtime($_SERVER['DOCUMENT_ROOT'].$img_src);
- $img_src.= '?time='.$img_filemtime;
- $img_thumb_src.= '?time='.$img_filemtime;
- }
- //sumo gallery ์ฉ
- if($bsumogallery == true) {
- $sumo_tag = " data-sgallery='".$sumogallery_group."' data-full='".$img_src."' data-thumb='".$img_thumb_src."' ";
- }
- $img_tag = "<img src='".$img_thumb_src."' title='".$title."' $sumo_tag />";
- return $img_tag;
- }
- //์ฐจ๋ ์ด๋ฏธ์ง๋ฅผ ๊ฐ์ ธ์ด
- function getCarAddtionalThumbImage($cd_car, $img, $title = "์ด๋ฏธ์ง", $bsumogallery = false, $sumogallery_group='basic') {
- $sumo_tag = "";
- $no_image = "/img/car_basic_no_image_1000x600.png";
- $no_thumb_image = "/img/car_basic_no_image_90x70.png";
- $img_src = UPLOAD_PATH_CAR.$cd_car."_detail/".$img;
- $img_thumb_src = UPLOAD_PATH_CAR.$cd_car."_detail/".$img;
- //ํด๋น ํ์ผ์ด ์๋ค๋ฉด no์ด๋ฏธ์ง๋ก ๋์ฒด
- if(!is_file($_SERVER['DOCUMENT_ROOT'].$img_src)) {
- $img_src = $no_image;
- $img_thumb_src = $no_thumb_image;
- }
- //์กด์ฌํ๋ฉด ํ์ผํ์์ ํ๋ผ๋ฏธํฐ๋ก ์ฌ์ฉ
- else {
- // echo $img_src;
- // exit;
- $img_filemtime = filemtime($_SERVER['DOCUMENT_ROOT'].$img_src);
- $img_src.= '?time='.$img_filemtime;
- $img_thumb_src.= '?time='.$img_filemtime;
- }
- //sumo gallery ์ฉ
- if($bsumogallery == true) {
- $sumo_tag = " data-sgallery='".$sumogallery_group."' data-full='".$img_src."' data-thumb='".$img_thumb_src."' ";
- }
- $img_tag = "<img src='".$img_thumb_src."' title='".$title."' $sumo_tag />";
- return $img_tag;
- }
- //์ฐจ๋ ๋์ฐฐ ์ดํ ์ด๋ฏธ์ง๋ฅผ ๊ฐ์ ธ์ด
- function getCarContractImage($cd_sale, $img, $title = "์ด๋ฏธ์ง", $bsumogallery = false, $sumogallery_group='basic') {
- $sumo_tag = "";
- $no_image = "/img/car_basic_no_image_1000x600.png";
- $no_thumb_image = "/img/car_basic_no_image_90x70.png";
- $img_src = UPLOAD_PATH.'aap/contract_step/'.$cd_sale.'_detail/'.$img;
- $img_thumb_src = UPLOAD_PATH.'aap/contract_step/'.$cd_sale.'_detail/'.$img;
- // echo $img_src;
- //ํด๋น ํ์ผ์ด ์๋ค๋ฉด no์ด๋ฏธ์ง๋ก ๋์ฒด
- if(!is_file($_SERVER['DOCUMENT_ROOT'].$img_src)) {
- $img_src = $no_image;
- $img_thumb_src = $no_thumb_image;
- }
- //์กด์ฌํ๋ฉด ํ์ผํ์์ ํ๋ผ๋ฏธํฐ๋ก ์ฌ์ฉ
- else {
- // echo $img_src;
- // exit;
- $img_filemtime = filemtime($_SERVER['DOCUMENT_ROOT'].$img_src);
- $img_src.= '?time='.$img_filemtime;
- $img_thumb_src.= '?time='.$img_filemtime;
- }
- //sumo gallery ์ฉ
- if($bsumogallery == true) {
- $sumo_tag = " data-sgallery='".$sumogallery_group."' data-full='".$img_src."' data-thumb='".$img_thumb_src."' ";
- }
- $img_tag = "<img src='".$img_thumb_src."' title='".$title."' $sumo_tag />";
- return $img_tag;
- }
- function getThumb($param){
- if(empty($param['o_path'])) return array('bool' => false, 'msg' => '์๋ณธ ํ์ผ ๊ฒฝ๋ก๊ฐ ์์ต๋๋ค.');
- if(empty($param['n_path'])) return array('bool' => false, 'msg' => '์๋ณธ ํ์ผ ๊ฒฝ๋ก๊ฐ ์์ต๋๋ค.');
- if(!in_array($param['mode'], array('ratio', 'fixed'))) $param['mode'] = 'ratio';
- if(empty($param['width'])) $param['width'] = 300;
- if(empty($param['height'])) $param['height'] = 300;
- if(!in_array($param['fill_yn'], array('Y', 'N'))) $param['fill_yn'] = 'N';
- if(!in_array($param['preview_yn'], array('Y', 'N'))) $param['preview_yn'] = 'Y';
- if(empty($param['o_name'])) $param['o_name'] = '';
- // ๋ฏธ๋ฆฌ๋ณด๊ธฐ ๋ฐฉ์ง ์ด๋ฏธ์ง url
- //if($param['preview_yn'] == 'N') $param['o_path'] = './hidden.png';
- $src = array();
- $dst = array();
- $src['path'] = $param['o_path'];
- $dst['path'] = $param['n_path'];
- // ์ธ๋ค์ผ ์ด๋ฏธ์ง ๊ฐฑ์ ๊ธฐ๊ฐ (1์ฃผ์ผ)
- if(file_exists($dst['path'])){
- // if(mktime() - filemtime($dst['path']) < 60 * 60 * 24 * 7)
- return array('bool' => true, 'src' => $dst['path']);
- }
- $imginfo = getimagesize($src['path']);
- $src['mime'] = $imginfo['mime'];
- // if($_SERVER['REMOTE_ADDR'] == '220.86.24.199') {
- // print_r($imginfo);
- // exit;
- // }
- // ์๋ณธ ์ด๋ฏธ์ง ๋ฆฌ์์ค ํธ์ถ
- switch($src['mime']){
- case 'image/jpeg' : $src['img'] = imagecreatefromjpeg($src['path']); break;
- case 'image/gif' : $src['img'] = imagecreatefromgif($src['path']); break;
- case 'image/png' : $src['img'] = @imagecreatefrompng($src['path']); break;
- case 'image/bmp' : $src['img'] = imagecreatefrombmp($src['path']); break;
- case 'image/webp' : $src['img'] = imagecreatefromwebp($src['path']); break;
- // mime ํ์
์ด ํด๋น๋์ง ์์ผ๋ฉด return false
- default : return array('bool' => false, 'msg' => '์ด๋ฏธ์ง ํ์ผ์ด ์๋๋๋ค.'); break;
- }
- // ์๋ณธ ์ด๋ฏธ์ง ํฌ๊ธฐ / ์ขํ ์ด๊ธฐ๊ฐ
- $src['w'] = $imginfo[0];
- $src['h'] = $imginfo[1];
- $src['x'] = 0;
- $src['y'] = 0;
- // ์ธ๋ค์ผ ์ด๋ฏธ์ง ์ขํ ์ด๊ธฐ๊ฐ ์ค์
- $dst['x'] = 0;
- $dst['y'] = 0;
- // ์ธ๋ค์ผ ์ด๋ฏธ์ง ๊ฐ๋ก, ์ธ๋ก ๋น์จ ๊ณ์ฐ
- $dst['ratio']['w'] = $src['w'] / $param['width'];
- $dst['ratio']['h'] = $src['h'] / $param['height'];
- switch($param['mode']){
- case 'ratio' :
- // ์ธ๋ค์ผ ์ด๋ฏธ์ง์ ๋น์จ๊ณ์ฐ (๊ฐ๋ก == ์ธ๋ก)
- if($dst['ratio']['w'] == $dst['ratio']['h']){
- $dst['w'] = $param['width'];
- $dst['h'] = $param['height'];
- }
- // ์ธ๋ค์ผ ์ด๋ฏธ์ง์ ๋น์จ๊ณ์ฐ (๊ฐ๋ก > ์ธ๋ก)
- elseif($dst['ratio']['w'] > $dst['ratio']['h']){
- $dst['w'] = $param['width'];
- $dst['h'] = round(($param['width'] * $src['h']) / $src['w']);
- }
- // ์ธ๋ค์ผ ์ด๋ฏธ์ง์ ๋น์จ๊ณ์ฐ (๊ฐ๋ก < ์ธ๋ก)
- elseif($dst['ratio']['w'] < $dst['ratio']['h']){
- $dst['w'] = round(($param['height'] * $src['w']) / $src['h']);
- $dst['h'] = $param['height'];
- }
- if($param['fill_yn'] == 'Y'){
- $dst['canvas']['w'] = $param['width'];
- $dst['canvas']['h'] = $param['height'];
- $dst['x'] = $param['width'] > $dst['w'] ? ($param['width'] - $dst['w']) / 2 : 0;
- $dst['y'] = $param['height'] > $dst['h'] ? ($param['height'] - $dst['h']) / 2 : 0;
- }
- else{
- $dst['canvas']['w'] = $dst['w'];
- $dst['canvas']['h'] = $dst['h'];
- }
- break;
- case 'fixed' :
- // ์ธ๋ค์ผ ์ด๋ฏธ์ง์ ๋น์จ๊ณ์ฐ (๊ฐ๋ก == ์ธ๋ก)
- if($dst['ratio']['w'] == $dst['ratio']['h']){
- $dst['w'] = $param['width'];
- $dst['h'] = $param['height'];
- }
- // ์ธ๋ค์ผ ์ด๋ฏธ์ง์ ๋น์จ๊ณ์ฐ (๊ฐ๋ก > ์ธ๋ก)
- elseif($dst['ratio']['w'] > $dst['ratio']['h']){
- $dst['w'] = $src['w'] / $dst['ratio']['h'];
- $dst['h'] = $param['height'];
- $src['x'] = ($dst['w'] - $param['width']) / 2;
- }
- // ์ธ๋ค์ผ ์ด๋ฏธ์ง์ ๋น์จ๊ณ์ฐ (๊ฐ๋ก < ์ธ๋ก)
- elseif($dst['ratio']['w'] < $dst['ratio']['h']){
- $dst['w'] = $param['width'];
- $dst['h'] = $src['h'] / $dst['ratio']['w'];
- $dst['y'] = 0;
- }
- $dst['canvas']['w'] = $param['width'];
- $dst['canvas']['h'] = $param['height'];
- break;
- }
- // ์ธ๋ค์ผ ์ด๋ฏธ์ง ๋ฆฌ์์ค ์์ฑ
- $dst['img'] = imagecreatetruecolor($dst['canvas']['w'], $dst['canvas']['h']);
- // ๋ฐฐ๊ฒฝ์ ์ฒ๋ฆฌ
- //๋ฐฐ๊ฒฝ์ ๊ธฐ๋ฅ ์์ฐ 2020-05-28
- // if(in_array($src['mime'], array('image/png', 'image/gif'))){
- // // ๋ฐฐ๊ฒฝ ํฌ๋ช
์ฒ๋ฆฌ
- // imagetruecolortopalette($dst['img'], false, 255);
- // $bgcolor = imagecolorallocatealpha($dst['img'], 255, 255, 255, 127);
- // imagefilledrectangle($dst['img'], 0, 0, $dst['canvas']['w'],$dst['canvas']['h'], $bgcolor);
- // }
- // else{
- // // ๋ฐฐ๊ฒฝ ํฐ์ ์ฒ๋ฆฌ
- // $bgclear = imagecolorallocate($dst['img'],255,255,255);
- // imagefill($dst['img'],0,0,$bgclear);
- // }
- // ์๋ณธ ์ด๋ฏธ์ง ์ธ๋ค์ผ ์ด๋ฏธ์ง ํฌ๊ธฐ์ ๋ง๊ฒ ๋ณต์ฌ
- imagecopyresampled($dst['img'],$src['img'],$dst['x'],$dst['y'],$src['x'],$src['y'],$dst['w'],$dst['h'],$src['w'],$src['h']);
- // imagecopyresampled ํจ์ ์ฌ์ฉ ๋ถ๊ฐ์ ์ฌ์ฉ
- //imagecopyresized($dst['img'],$src['img'],$dst['x'],$dst['y'],$src['x'],$src['y'],$dst['w'],$dst['h'],$src['w'],$src['h']);
- ImageInterlace($dst['img']);
- // ์ธ๋ค์ผ ์ด๋ฏธ์ง ๋ฆฌ์์ค๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ์ค์ ์ด๋ฏธ์ง ์์ฑ
- switch($src['mime']){
- case 'image/jpeg' : imagejpeg($dst['img'], $dst['path']); break;
- case 'image/gif' : imagegif($dst['img'], $dst['path']); break;
- case 'image/png' : imagepng($dst['img'], $dst['path']); break;
- case 'image/bmp' : imagebmp($dst['img'], $dst['path']); break;
- case 'image/webp' : imagewebp($dst['img'], $dst['path']); break;
- }
- // ์๋ณธ ์ด๋ฏธ์ง ๋ฆฌ์์ค ์ข
๋ฃ
- imagedestroy($src['img']);
- // ์ธ๋ค์ผ ์ด๋ฏธ์ง ๋ฆฌ์์ค ์ข
๋ฃ
- imagedestroy($dst['img']);
- // ์ธ๋ค์ผ ํ์ผ๊ฒฝ๋ก ์กด์ฌ ์ฌ๋ถ ํ์ธํ ๋ฆฌํด
- return file_exists($dst['path']) ? array('bool' => true, 'src' => $dst['path'],'fileName'=>$param['o_name']) : array('bool' => false, 'msg' => 'ํ์ผ ์์ฑ์ ์คํจํ์์ต๋๋ค.');
- }
- function date_diff_d($str1, $str2) {
- $frdt = strtotime($str1);
- $todt = strtotime($str2);
- $diff = ($todt - $frdt)/(60*60*24);
- return $diff;
- }
- if(!function_exists('right')) {
- function right($value, $count){
- $value = mb_substr($value, (mb_strlen($value) - $count), mb_strlen($value));
- return $value;
- }
- }
- if(!function_exists('left')) {
- function left($string, $count){
- return mb_substr($string, 0, $count);
- }
- }
- if(!function_exists('conv_date')) {
- function conv_date($date, $format){
- $datetime = date_create($date);
- return date_format($datetime, $format);
- }
- }
- if(!function_exists('add_birth_hyphen')) {
- // ์ ํ๋ฒํธ์ ์ซ์๋ง ์ทจํ ํ ์ค๊ฐ์ ํ์ดํ(-)์ ๋ฃ๋๋ค.
- function add_birth_hyphen($birth)
- {
- return preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})$/", "\\1-\\2-\\3", $birth);
- }
- }
- if(!function_exists('add_hyphen')) {
- // ์ ํ๋ฒํธ์ ์ซ์๋ง ์ทจํ ํ ์ค๊ฐ์ ํ์ดํ(-)์ ๋ฃ๋๋ค.
- function add_hyphen($tel)
- {
- $tel = preg_replace("/[^0-9]/", "", $tel); // ์ซ์ ์ด์ธ ์ ๊ฑฐ
- if (substr($tel,0,2)=='02')
- return preg_replace("/([0-9]{2})([0-9]{3,4})([0-9]{4})$/", "\\1-\\2-\\3", $tel);
- // else if (is_numeric(substr($tel,0,1)))
- // return preg_replace("/([0-9]{2})([0-9]{3})([0-9]{3,4})([0-9]{4})$/", "\\1-\\2-\\3\\4", $tel);
- else if (strlen($tel)=='8' && (substr($tel,0,2)=='15' || substr($tel,0,2)=='16' || substr($tel,0,2)=='18'))
- // ์ง๋ฅ๋ง ๋ฒํธ์ด๋ฉด
- return preg_replace("/([0-9]{4})([0-9]{4})$/", "\\1-\\2", $tel);
- else
- return preg_replace("/([0-9]{3})([0-9]{3,4})([0-9]{4})$/", "\\1-\\2-\\3", $tel);
- }
- }
- //๊ธฐ์กด ํ์์์ ์ผ๋ฐํ์, ์ ํ๋ก ์ง์์ผ๋ก ๋ถ๋ฅ๋จ์ ๋ฐ๋ผ ์์ฑ
- //๊ตฌ๋ถ์ ํ์์ ๋ณด์ ๊ด๊ณ์ฌ(ds_company_bp)๊ฐ ์์ ๊ฒฝ์ฐ ์ ํ๋ก ์ง์์ด๋ผ ํจ
- //return true ์ ์ ํ๋ก ์ง์, false : ์ผ๋ฐํ์
- function getUproMember($cd_user) {
- $ret = false;
- $sql=mysql_query("select ds_company_bp from member_master mm where cd_user = '$cd_user' and ds_delind='N' limit 1");
- $row = mysql_fetch_array($sql);
- if(!empty($row[ds_company_bp])) {
- $ret = true;
- }
- return $ret;
- }
- //๋ฐ์ก์ทจ์ ์ํด
- function cancel_tender_sms($connect, $cd_tender_sms) {
- $sms_sql = "update tender_sms_master set ds_send_status = 'B0' where cd_tender_sms = '$cd_tender_sms' ";
- // echo $sms_sql;
- mysql_query($sms_sql, $connect);
- }
- //ํด๋น ๋งค๋ฌผ์ lock ์ํ๋ก ์
๋ฐ์ดํธ ์ํด
- function lock_status_tender_sms($connect, $cd_tender_sms) {
- $sms_sql = "update tender_sms_master set ds_lock_status = 'B0' where cd_tender_sms = '$cd_tender_sms' ";
- mysql_query($sms_sql, $connect);
- }
- //SMS ๋ฑ๋ก
- function insert_tender_sms($connect, $DATA) {
- //ds_send_status = ๋ฐ์ก์ํ ๋ฐ์ก์๋ฃ
- //ds_lock_status = ๋ฝ์ฒ๋ฆฌ ํ์์์
- $sql = "insert into tender_sms_master set
- cd_sale = '$DATA[cd_sale]'
- , cd_tender = '$DATA[cd_tender]'
- , depth = '$DATA[depth]'
- , nm_hp = '$DATA[tender_nm_hp]'
- , nm_content = '$DATA[nm_content]'
- , ds_status = '$DATA[ds_status]'
- , ds_send_status = '$DATA[ds_send_status]'
- , ds_lock_status = 'A0'
- , dt_send = '$DATA[dt_send]'
- , nm_send = '$DATA[cd_userid]'
- , dt_insert = now()
- , nm_insert = '$DATA[cd_userid]'
- ";
- $result = mysql_query($sql,$connect);
- return $result;
- }
- //๋ฝ ํ์์น ์์์ผ๋ก ์
๋ฐ์ดํธ
- function no_lock_tender_sms($connect, $cd_tender_sms) {
- $sms_sql = "update tender_sms_master set ds_lock_status = 'A0' where cd_tender_sms = '$cd_tender_sms' ";
- // echo $sms_sql;
- mysql_query($sms_sql, $connect);
- }
- //๋ฝ ์ค์
- function lock_tender_sms($connect, $cd_tender, $cd_tender_sms) {
- //tender master update
- $tender_sql = "update tender_master set
- ds_lock_status = 'A0'
- , dt_lock = now()
- where cd_tender = '$cd_tender'
- ";
- // echo $tender_sql;
- mysql_query($tender_sql, $connect);
- //tender sms master update
- $sms_sql = "update tender_sms_master set ds_lock_status = 'Z0' where cd_tender_sms = '$cd_tender_sms' ";
- // echo $sms_sql;
- mysql_query($sms_sql);
- }
- function tender_sms_msg() {
- $sms_msg = array(
- 'Z0' => "๋์ฐฐ์ค ํ์ด์ง {CAR_INFO} ๊ฑฐ๋ ์งํ์ฒ๋ฆฌ ์งํ ๋ถํ๋๋ฆฝ๋๋ค. {PERIOD}์ผ์ด๋ด ๋ฏธ์ฒ๋ฆฌ์ ์
์ฐฐ์ด ์ ์ง ๋ฉ๋๋ค.",
- 'Z1' => "์งํ์ค ํ์ด์ง {CAR_INFO} ๊ฑฐ๋ ์งํ์ฒ๋ฆฌ ์งํ ๋ถํ๋๋ฆฝ๋๋ค. {PERIOD}์ผ์ด๋ด ๋ฏธ์ฒ๋ฆฌ์ ์
์ฐฐ์ด ์ ์ง ๋ฉ๋๋ค.",
- );
- return $sms_msg;
- }
- function tender_sms_period() {
- //1์ฐจ 5์ผ, 2์ฐจ 3์ผ, 3์ฐจ 2์ผ
- $sms_period = array(1 => 5, 2 => 3, 3 => 2);
- return $sms_period;
- }
- //ํ์ผ์ ์์ ์ผ์ ๊ธฐ์ค์ผ๋ก ํ์ผ ๋ฒ์ ์ ๊ฐ์ ธ์ด
- //ํ์ฌ๋ ์ด๋ฏธ์ง์ ๊ฐฑ์ ์ ์ํด ์ฌ์ฉ
- function get_file_mtime($file_web_path) {
- $file_path = $_SERVER['DOCUMENT_ROOT'].'/'.$file_web_path;
- if(file_exists($file_path) && is_file($file_path)) {
- $file_mtime = filemtime($file_path);
- }else {
- $file_mtime = "1";
- }
- return $file_mtime;
- }
- if(!function_exists('string_to_asterisk')) {
- function string_to_asterisk($mode, $str) {
- $ret = "";
- switch($mode) {
- case 'id':
- case 'name':
- $str = trim($str);
- $length = mb_strlen($str, 'utf-8');
- $string_changed = $str;
- if ($length <= 2) {
- // ํ๋ ๊ธ์๋ฉด ๊ทธ๋ฅ ๋ค์ ๋ณํ ๋ถ์ฌ์ ๋ด๋ณด๋ธ๋ค.
- $ret = mb_substr($str, 0, 1, 'utf-8') . '*';
- }
- if ($length >= 3) {
- // 3์ผ๋ก ๋๋ ์ ์๋ค.
- $leave_length = floor($length/3); // ๋จ๊ฒจ ๋ ๊ธธ์ด. ๋ฐ์ฌ๋ฆผํ๋ ๋๋ฌด ๋ง์ด ๋จ๊ธฐ๊ฒ ๋ผ, ๋ด๋ฆผ์ผ๋ก ํด์ ๋จ๊ธฐ๋ ๊ฑธ ์ค์๋ค.
- $asterisk_length = $length - ($leave_length * 2);
- $offset = $leave_length + $asterisk_length;
- $head = mb_substr($str, 0, $leave_length, 'utf-8');
- $tail = mb_substr($str, $offset, $leave_length, 'utf-8');
- $ret = $head . implode('', array_fill(0, $asterisk_length, '*')) . $tail;
- }
- break;
- case 'phone':
- $str = trim($str);
- $length = mb_strlen($str, 'utf-8');
- $string_changed = $str;
- if ($length <= 2) {
- // ํ๋ ๊ธ์๋ฉด ๊ทธ๋ฅ ๋ค์ ๋ณํ ๋ถ์ฌ์ ๋ด๋ณด๋ธ๋ค.
- $ret = mb_substr($str, 0, 1, 'utf-8') . '*';
- }
- if ($length >= 3) {
- // 3์ผ๋ก ๋๋ ์ ์๋ค.
- $leave_length = floor($length/3); // ๋จ๊ฒจ ๋ ๊ธธ์ด. ๋ฐ์ฌ๋ฆผํ๋ ๋๋ฌด ๋ง์ด ๋จ๊ธฐ๊ฒ ๋ผ, ๋ด๋ฆผ์ผ๋ก ํด์ ๋จ๊ธฐ๋ ๊ฑธ ์ค์๋ค.
- $asterisk_length = $length - ($leave_length * 2);
- $offset = $leave_length + $asterisk_length;
- $head = mb_substr($str, 0, $leave_length, 'utf-8');
- $tail = mb_substr($str, $offset, $leave_length, 'utf-8');
- $ret = $head . implode('', array_fill(0, $asterisk_length, '*')) . $tail;
- }
- break;
- }
- return $ret;
- }
- }
- function create_watermark($image_path, $watermark_path = "") {
- if(empty($watermark_path)) {
- $watermark_path = $_SERVER['DOCUMENT_ROOT'].'/img/logo_watermark.png';
- }
- // $img_path = "/image.jpg"; // ์๋ณธ ์ด๋ฏธ์ง ์ ๋๊ฒฝ๋ก
- // $watermark_img_path = "/watermark.png"; // ์ํฐ๋งํฌ ์ด๋ฏธ์ง ์ ๋๊ฒฝ๋ก
- // $image_path, $watermark_path ๋ ๋ฐ๋์ ์ ๋๊ฒฝ๋ก๋ก ์ง์ ํด์ผํจ (url์ด ์๋ path)
- $array_img_chk = array("jpg", "jpeg", "png", "gif", "bmp");
- // ์ด๋ฏธ์ง ํ์ฅ์
- $img_ext = explode(".", strrev($image_path));
- $img_ext = strrev($img_ext[0]);
- $img_ext = strtolower($img_ext);
- $opacity = 0.5;
- $quality = 90;
- // ์ด๋ฏธ์ง ํ์ผ์ธ ๊ฒฝ์ฐ์๋ง ์งํ
- if(in_array($img_ext, $array_img_chk)) {
- $img_info = getimagesize($image_path);
- //ํ์ฅ์๋ jpg์ธ๋ฐ mime์ image/webp์ผ ๊ฒฝ์ฐ ์๋ฌ๊ฐ ๋จ
- //๋ฐฉ๋ฒ์ด ์์
- // print_r($img_info);
- // exit;
- if($img_ext == 'jpg' || $img_ext == 'jpeg')
- $create_img = imagecreatefromjpeg($image_path);
- if($img_ext == 'png')
- $create_img = imagecreatefrompng($image_path);
- if($img_ext == 'gif')
- $create_img = imagecreatefromgif($image_path);
- if($img_ext == 'bmp')
- $create_img = imagecreatefromwbmp($image_path);
- if($create_img) {
- // ์ํฐ๋งํฌ ์ด๋ฏธ์ง ํ์ฅ์
- $watermark_img_ext = explode(".", strrev($watermark_path));
- $watermark_img_ext = strrev($watermark_img_ext[0]);
- $watermark_img_ext = strtolower($watermark_img_ext);
- if($watermark_img_ext == 'jpg' || $watermark_img_ext == 'jpeg')
- $create_watermark_img = imagecreatefromjpeg($watermark_path);
- if($watermark_img_ext == 'png')
- $create_watermark_img = imagecreatefrompng($watermark_path);
- if($watermark_img_ext == 'gif')
- $create_watermark_img = imagecreatefromgif($watermark_path);
- if($watermark_img_ext == 'bmp')
- $create_watermark_img = imagecreatefromwbmp($watermark_path);
- if($create_watermark_img) {
- list($img_w, $img_h) = getimagesize($image_path);
- list($watermark_img_w, $watermark_img_h) = getimagesize($watermark_path);
- imagealphablending($create_img, true);
- $create_watermark_opacity_img = imagesetopacity($create_watermark_img, $opacity);
- // ์ํฐ๋งํฌ ์์น ์ง์
- // $pos_x = 50;
- // $pos_y = 50;
- // (์์) ์ํฐ๋งํฌ๋ฅผ ์ ์ค์์ผ๋ก
- $pos_x = ceil(($img_w - $watermark_img_w) / 2);
- $pos_y = ceil(($img_h - $watermark_img_h) / 2);
- imagecopy($create_img, $create_watermark_opacity_img, $pos_x, $pos_y, 0, 0, $watermark_img_w, $watermark_img_h);
- // imagecopymerge($create_img, $create_watermark_opacity_img, $pos_x, $pos_y, 0, 0, $watermark_img_w, $watermark_img_h, $opacity);
- /* imagecopy ์ค๋ช
*/
- // ์๋ณธ ์ด๋ฏธ์ง ๋ฆฌ์์ค : $create_img
- // ์ํฐ๋งํฌ ์ด๋ฏธ์ง ๋ฆฌ์์ค : $create_watermark_img
- // ์ํฐ๋งํฌ ์ด๋ฏธ์ง x ์ขํ : $pos_x
- // ์ํฐ๋งํฌ ์ด๋ฏธ์ง y ์ขํ : $pos_y
- // ์๋ณธ ์ด๋ฏธ์ง x ์ขํ : 0
- // ์๋ณธ ์ด๋ฏธ์ง y ์ขํ : 0
- // ์ํฐ๋งํฌ ์ด๋ฏธ์ง ๊ฐ๋กํฌ๊ธฐ : $watermark_img_w
- // ์ํฐ๋งํฌ ์ด๋ฏธ์ง ์ธ๋กํฌ๊ธฐ : $watermark_img_h
- //ํ
์คํธ์ฉ
- // header("Content-type: image/jpeg");
- //์ค์ ์ด๋ฏธ์ง ์์ฑ
- imagejpeg($create_img, $image_path, $quality);
- imagedestroy($create_img);
- imagedestroy($create_watermark_opacity_img);
- }
- }
- }
- }
- function imagesetopacity( $imageSrc, $opacity )
- {
- $width = imagesx( $imageSrc );
- $height = imagesy( $imageSrc );
- // Duplicate image and convert to TrueColor
- $imageDst = imagecreatetruecolor( $width, $height );
- imagealphablending( $imageDst, false );
- imagefill( $imageDst, 0, 0, imagecolortransparent( $imageDst ));
- imagecopy( $imageDst, $imageSrc, 0, 0, 0, 0, $width, $height );
- // Set new opacity to each pixel
- for ( $x = 0; $x < $width; ++$x )
- for ( $y = 0; $y < $height; ++$y ) {
- $pixelColor = imagecolorat( $imageDst, $x, $y );
- $pixelOpacity = 127 - (( $pixelColor >> 24 ) & 0xFF );
- if ( $pixelOpacity > 0 ) {
- $pixelOpacity = $pixelOpacity * $opacity;
- $pixelColor = ( $pixelColor & 0xFFFFFF ) | ( (int)round( 127 - $pixelOpacity ) << 24 );
- imagesetpixel( $imageDst, $x, $y, $pixelColor );
- }
- }
- return $imageDst;
- }
- function emailCheck($_str)
- {
- if (preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $_str) == false)
- {
- return false;
- // array(false, "์ฌ๋ฐ๋ฅธ ์ด๋ฉ์ผ ์ฃผ์๋ฅผ ์
๋ ฅํด์ฃผ์ธ์.");
- }
- else
- {
- return true;
- // return array(true);
- }
- }
- //common.js ์์ ๋์ผํ ํจ์๋ช
์ผ๋ก ์คํฌ๋ฆฝ์ฉ์ด ์กด์ฌํ๋๋ก ์ค๊ณ ํ์ผ๋ ๋ฐฑ๋จ์์ ์ฒ๋ฆฌํด๋ ๋ ๊ฒ ๊ฐ์ ์คํฌ๋ฆฝํธ ์๋ง๋ฌ
- function get_sa_aap_commission($price, $ds_tradein, $nm_brand, $is_staff = "N") {
- $commission = "";
- $price = preg_replace("/[^0-9]*/s", "", $price);
- if(empty($price)) {
- return $commission;
- }
- $price = (int)$price;
- if($price < 1) {
- return $commission;
- }
- //SA๊ฐ ์ฌ๋ฆฐ ๋งค๋ฌผ๋ง ์์๋ฃ๊ฐ ์กด์ฌ
- if($is_staff != 'Y') {
- return $commission;
- }
- $SA_AAP_SALE_CONDITION = array();
- //ํธ๋ ์ด๋์ธ ์์ฐ๋ ์ฐจ๋
- $SA_AAP_SALE_CONDITION['A0']['AUDI'] = array(
- "0" => 255000,
- "1" => 310000,
- "2" => 365000,
- "3" => 520000,
- "4" => 675000,
- );
- //ํธ๋ ์ด๋์ธ ์์ฐ์ด ์ด์ธ
- $SA_AAP_SALE_CONDITION['A0']['ETC'] = array(
- "0" => 155000,
- "1" => 210000,
- "2" => 315000,
- "3" => 420000,
- "4" => 575000,
- );
- $SA_AAP_SALE_CONDITION['B0']['AUDI'] = array(
- "0" => 155000,
- "1" => 210000,
- "2" => 315000,
- "3" => 420000,
- "4" => 575000,
- );
- $SA_AAP_SALE_CONDITION['B0']['ETC'] = array(
- "0" => 55000,
- "1" => 110000,
- "2" => 165000,
- "3" => 220000,
- "4" => 275000,
- );
- $brand = "";
- if(strtoupper($nm_brand) == "AUDI" || $nm_brand == "์๋ฌด๋") {
- $brand = "AUDI";
- }else {
- $brand = "ETC";
- }
- $condition_index = 0;
- //100๋ง์ ๋ฏธ๋ง
- if($price < 100) {
- $condition_index = 0;
- }
- //100๋ง์ ์ด์ 1000๋ง์ ๋ฏธ๋ง
- else if($price >= 100 && $price < 1000) {
- $condition_index = 1;
- }
- //1000๋ง์ ์ด์ 2000๋ง์ ๋ฏธ๋ง
- else if($price >= 1000 && $price < 2000) {
- $condition_index = 2;
- }
- else if($price >= 2000 && $price < 2850) {
- $condition_index = 3;
- }
- else if($price >= 2850) {
- $condition_index = 4;
- }
- // if($_SERVER['REMOTE_ADDR'] == '220.86.24.199') {
- // echo 'price:'.$price;
- // echo 'condition_index:'.$condition_index;
- // echo 'ds_tradein:'.$ds_tradein;
- // print_r($SA_AAP_SALE_CONDITION);
- // exit;
- // }
- $commission = $SA_AAP_SALE_CONDITION[$ds_tradein][$brand][$condition_index];
- //๊ด๋ฆฌ์ ๊ธ์ก์ด ๋ง์ ๋จ์๋ก ํํ์ด ๋๋ฏ๋ก
- // $commission = left($commission, 3);
- return $commission;
- }
- ?>
|