/home/mjc1/public_html/j3demo/adm/sql_log_del.inc.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
<?php

    $day 
date("Y-m-d",time());
    
$m6 strtotime("-3 month $day");
    
$key_date date("Ym",$m6);

    
$path $j3_data_path."/log";
    
$dirs dir($path);
    while(
false !== ($entry $dirs->read())){ // 읽기 
        
if(($entry != '.') && ($entry != '..')) { 
            if(
is_dir($path.'/'.$entry)) { // 폴더이면 
                
$files['dir'][] = $entry
            } else { 
// 파일이면 
                
$files['file'][] = $entry
            } 
        } 
    } 
    
$dirs->close(); // 닫기 

    
sort($files['file']);

    foreach(
$files['file'] as $key=>$val){
        if(
substr($val,0,6)<=$key_date){
            @
unlink($path."/".$val);
        }
    }

    
$day date("Y-m-d",time());
    
$m6 strtotime("-31 day $day");
    
$key_date date("Ymd",$m6);

    
$path $j3_data_path."/log";
    
$dirs dir($path);
    while(
false !== ($entry $dirs->read())){ // 읽기 
        
if(($entry != '.') && ($entry != '..')) { 
            if(
is_dir($path.'/'.$entry)) { // 폴더이면 
                
$files['dir'][] = $entry
            } else { 
// 파일이면 
                
$files['file'][] = $entry
            } 
        } 
    } 
    
$dirs->close(); // 닫기 

    
sort($files['file']);

    foreach(
$files['file'] as $key=>$val){
        if(
substr($val,0,8)<=$key_date){
            @
unlink($path."/".$val);
        }
    }


    
//7일 지난 비회원 장바구니 삭제
    
$date date("Y-m-d H:i:s",time()-(60*60*24*7));
    
$sql "delete from shop_cart where ccode = 0 and sess_id <> '' and ct_state = '0' and ct_time <= '{$date}' ";
    
$res mysql_query($sql,$connect_j3);


?>