/home/mjc1/public_html/onlinecs/commonST.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?
    
@error_reportingE_CORE_ERROR E_CORE_WARNING E_COMPILE_ERROR E_ERROR E_WARNING E_PARSE E_USER_ERROR E_USER_WARNING );
    
//20130906 Ãß°¡
    
if (!isset($sa_dbip)) $sa_dbip "";
    if (!isset(
$sa_dbname)) $sa_dbname "";
    if (!isset(
$sa_uid)) $sa_uid "";

    
$DB_PWDCAR   =  "mj007700";

    include(
'csclass_db.php');
    
    
$dbconcar    = new DBCAR($sa_dbip$sa_dbname$sa_uid$DB_PWDCAR);

    function 
sb_log_write($post$sql$midx){ // post, sql, midx ·Î±×
    
Global $sid;
    if(
$post!=''){
        foreach(
$post['c_pname'] as $key=>$val){
            
$post['c_pname'][$key] = iconv("utf-8","euc-kr",$val);
        }
        foreach(
$post['c_bigo'] as $key=>$val){
            
$post['c_bigo'][$key] = iconv("utf-8","euc-kr",$val);
        }
        
$post['shop_memo'] = iconv("utf-8","euc-kr",$post['shop_memo']);
        
ob_start();
        
print_r($post);
        
$res ob_get_contents();
        
ob_end_clean();
        
//$res = iconv("euckr","utf-8",$res);
    
}
    if(
$sql!=""){
        
$sql addslashes($sql);
        
ob_start();
        
print_r($sql);
        
$res ob_get_contents();
        
ob_end_clean();
    }
    if(
$midx!=""){
        
$sql "select * from ordbook_m a inner join ordbook_d b on a.ordno = b.ordno where a.ordno = '{$midx}';";
        
$result mysql_query($sql);
        
ob_start();
        while(
$info=mysql_fetch_object($result)){
            
print_r($info); echo "¡×";
        }
        
$res ob_get_contents();
        
$res str_replace(chr(10),"",$res);
        
$res str_replace("¡×",chr(10),$res);
        
ob_end_clean();

    }

    
$datetime date("[Y-m-d H:i:s]",time());
    
$date_dir date("Y-m-d",time());
    
$month_dir date("Y-m",time());
    
$file_name "{$sid}-{$date_dir}";

    @
mkdir($_SERVER['DOCUMENT_ROOT']."/onlinecs/mobile/log/{$month_dir}");
    @
chmod($_SERVER['DOCUMENT_ROOT']."/onlinecs/mobile/log/{$month_dir}",0707);

    
$fp fopen($_SERVER['DOCUMENT_ROOT']."/onlinecs/mobile/log/{$month_dir}/{$file_name}",'a');
    
fwrite($fp,$datetime.chr(10).$res);
    
fclose($fp);

    @
chmod($_SERVER['DOCUMENT_ROOT']."/onlinecs/mobile/log/{$month_dir}/{$file_name}",0707);

    if(
$handle opendir($_SERVER['DOCUMENT_ROOT']."/onlinecs/mobile/log/")) {
        while(
false !== ($entry readdir($handle))) {
            if(
$entry == '.' || $entry == '..')
                continue;

            
$path $_SERVER['DOCUMENT_ROOT']."/onlinecs/mobile/log/".$entry;

            if(
is_dir($path))
                
$directory[] = $path;
        }
    }

    
flush();

    
$m6 strtotime("-2 month $day"); // 2°³¿ù ÀÌÀü²« »èÁ¦
    
$key_date date("Y-m",$m6);

    foreach(
$directory as $dir){
        
$v explode("/",$dir);
        
$vv $v[count($v)-1];
        if(
$vv<$key_date){
            if(
$dir!=''){
                
exec("rm -rf {$dir}");
            }
        }
    }

}


?>