/home/mjc1/public_html/manage/01_newcert_xls.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
<?php
header
('Content-Type: text/html; charset=utf-8');
include(
"../common.php");

$sql "set names utf8";
$res mysql_query($sql,$connect_appmon);

$sql "SELECT r.idx, r.user_id, r.cdkey, r.user_name, r.enddate, r.license_pc, r.license_pda, r.sale_amount, r.bigo, r.rgst_dtm, r.rgster, c.cde_nm, COUNT(d.cdkey) AS use_cdkey 
FROM regist_user r 
LEFT JOIN mac_detail d ON (d.cdkey = r.cdkey) 
LEFT JOIN codes c ON (r.app_code = c.cde and c.cdiv='01') where r.idx > 0 AND r.app_code = '080' 
GROUP BY r.idx, r.user_id, r.cdkey, r.user_name, r.enddate, r.license_pc, r.license_pda, r.sale_amount, r.bigo, r.rgst_dtm, r.rgster, c.cde_nm 
order by idx "
;

$res mysql_query($sql,$connect_appmon);
$rowcnt mysql_num_rows($res);

while(
$info=mysql_fetch_array($res)){
    
$sql "select Mtel1, Mhp from member where Mid = '{$info['user_id']}' ";
    
$res2 mysql_query($sql,$connect_web);
    
$info2 mysql_fetch_array($res2);

    
$info['Mtel1'] = $info2['Mtel1'];
    
$info['Mhp'] = $info2['Mhp'];

    
$mac_array[] = $info;
}

header"Content-type: application/vnd.ms-excel" ); 
header"Content-Disposition: attachment; filename=pda_xls.xls"); 
header"Content-Description: PHP4 Generated Data" ); 

?>
<table>
    <tr>
        <th>회원아이디</th>
        <th>상호명</th>
        <th>핸드폰</th>
        <th>전화</th>
        <th>프로그램</th>
        <th>CD-KEY</th>
        <th>라이센스</th>
        <th>PDA/천S조회전용</th>
        <th>등록/만료일</th>
        <th>비고</th>
    </tr>
<?php
    
foreach($mac_array as $key=>$info){
?>
    <tr>
        <td><?php echo $info['user_id'];?></td>
        <td><?php echo $info['user_name'];?></td>
        <td><?php echo $info['Mhp'];?></td>
        <td><?php echo $info['Mtel1'];?></td>
        <td><?php echo $info['cde_nm'];?></td>
        <td><?php echo $info['cdkey'];?></td>
        <td><?php echo $info['license_pc']." (".$info['use_cdkey'].")";?></td>
        <td><?php echo $info['license_pda'];?></td>
        <td><?php echo substr($info['rgst_dtm'],0,10)." / ".$info['enddate'];?></td>
        <td><?php echo $info['bigo'];?></td>
    </tr>
<?php
    
}
?>
</table>
<?php

?>