/home/mjc1/public_html/html/ProgramRegist/pdargstProcess.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?
header
("Content-type:text/html;charset=euc-kr");
    include_once(
"../../manage/category/opcommon.php");

    
//print_r($_POST); exit;

$sCDKey preg_replace('/[^\da-z]/i','',$_POST['sCDKey']);    //¿µ¹®¼ýÀÚ¸¸ °¡´É
$sCDKey strtoupper($sCDKey);    //´ë¹®ÀÚº¯È¯
$sName $_POST['sName'];

$typeStr $_POST['typeCheck'];

//echo $sCDKey;

    //ÀÔ·ÂÈ®ÀÎ
    
$csql "SELECT r.license_pc, r.user_id, count(d.cdkey) AS cdnum,sum(case when d.opt1 = 0 then 1 else 0 end) as fullType,sum(case when d.opt1 = 1 then 1 else 0 end) as lightType,r.license_pda,r.license_pc,(r.license_pc-r.license_pda) as full 
            FROM regist_user r
            LEFT JOIN mac_detail d ON r.cdkey = d.cdkey
            WHERE r.cdkey = '
$sCDKey
            AND r.app_code = '
$parm_app_code'
            AND r.app_block = 0"
;

    
$cresult mysql_query($csql);
    
$crow mysql_fetch_array($cresult);

    
$regnum $crow['license_pc'] - $crow['cdnum'];

    
$userid $crow['user_id'];

    
$resultStr =$crow['license_pda'] - $crow['lightType'];

    
$resultFull $crow['full'] - $crow['fullType'];

//echo $sCDKey;
//echo $parm_app_code;
    
if ( $userid == ''){    //À¯Àú¾ÆÀ̵ð ¹Ìµî·Ï
?>
<SCRIPT LANGUAGE="JavaScript">
    //parent.alert("<?=$sCDKey?>");
    //parent.alert("<?=$parm_app_code?>");
    parent.alert("<?=$sCDKey?> / <?=$parm_app_code?> / Á¤Ç°¹øÈ£°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
    parent.location.href='pda_rgst2.php';

</SCRIPT>
<?
    
return;
    }

    if ( 
$regnum == "0" || $regnum "0" ){    //Á¤Ç°µî·Ï¼ö Ãʰú
?>
<SCRIPT LANGUAGE="JavaScript">
    parent.alert("Á¤Ç°µî·Ï °¡´ÉÇÑ »ç¿ëÀÚ¼ö¸¦ ÃʰúÇÏ¿´½À´Ï´Ù.");
    parent.location.href='pda_rgst2.php';
</SCRIPT>
<?
    
return;
    }
    if (
$typeStr == "1" && ($resultStr == "0" || $resultStr "0") ){    //Á¤Ç°µî·Ï¼ö Ãʰú
?>
<SCRIPT LANGUAGE="JavaScript">
    parent.alert("Á¶È¸±â´É»ç¿ëÀÚ¼ö¸¦ ÃʰúÇÏ¿´½À´Ï´Ù.");
    parent.location.href='pda_rgst2.php';
</SCRIPT>
<?
    
return;
    }
    if (
$typeStr == "0" && ($resultFull == "0" || $resultFull "0") ){    //Á¤Ç°µî·Ï¼ö Ãʰú
?>
<SCRIPT LANGUAGE="JavaScript">
    parent.alert("Àüü±â´É»ç¿ëÀÚ¼ö¸¦ ÃʰúÇÏ¿´½À´Ï´Ù.");
    parent.location.href='pda_rgst2.php';
</SCRIPT>
<?
    
return;
    }
?>
<? 
    mysql_close
();




//rgst2 ÀÇ ¸Æµî·Ï
    
if($parm_user_mac == ""){    //¸ÆÁÖ¼Ò°¡ ¾øÀ¸¸é ¾Æ¹«ÀÛ¾÷ ¾ÊÇÔ
        
    
} else {
        include(
"../../manage/category/common.php");
        
$websql "SELECT CONCAT(Mcompany,'[', Mname,']')  FROM member WHERE MID = '$userid' ";
        
$webresult mysql_query($websql);
        
$webrow mysql_fetch_array($webresult);
        
$newusername $webrow[0];


        
mysql_close();

        include(
"common.php");    //DBÁ¢¼Ó

#------------ mac »ó¼¼Á¤º¸ °»½Å --------------#
            
$sql "SELECT idx FROM macs WHERE mac_addr = '$parm_user_mac' AND app_code = '$parm_app_code'";
            
$result mysql_query($sql);
            
            if( 
mysql_num_rows($result) > 0){    //°ªÀÌ ÀÖÀ¸¸é
                
$row mysql_fetch_array($result);
                
$var_idx $row['idx'];
                
$usql "UPDATE macs SET app_rgsted = 1, uninstalled = 0 WHERE idx = '$var_idx'";    //Á¤Ç°µî·ÏÁ¤º¸ ¾÷µ¥ÀÌÆ®
                
mysql_query($usql);

#------------ mac_detail »ó¼¼Á¤º¸ °»½Å --------------#
                
$dsql "SELECT mac_idx FROM mac_detail WHERE mac_idx = '$var_idx'"
                
$dresult mysql_query($dsql);

                    if( 
mysql_num_rows($dresult) > 0){    //mac_detail¿¡ °ªÀÌ ÀÖÀ¸¸é ¾÷µ¥ÀÌÆ®
                        
if($sName == ""){
                            
$dusql "UPDATE mac_detail SET  pc_name = '$parm_pc_name', os_type = '$parm_os_type', user_id = '$userid', user_name = '$newusername',
                                                 screen_w = '
$parm_screen_w', screen_h = '$parm_screen_h', cdkey = '$sCDKey',opt1 = '$typeStr'
                                  WHERE mac_idx = '
$var_idx' ";
                        }else{    
//»ç¿ëÀÚ¸íÀ» ÀÔ·ÂÇßÀ¸¸é ±×°ª ¾÷µ¥ÀÌÆ®
                            
$dusql "UPDATE mac_detail SET  pc_name = '$sName', os_type = '$parm_os_type', user_id = '$userid', user_name = '$newusername',
                                                 screen_w = '
$parm_screen_w', screen_h = '$parm_screen_h', cdkey = '$sCDKey' ,opt1 = '$typeStr'
                                  WHERE mac_idx = '
$var_idx' ";
                        }
                        
                        
mysql_query($dusql);

                    } else { 
//mac_detail¿¡ °ªÀÌ ¾øÀ¸¸é Ãß°¡  + CDKEYÃß°¡
                        
                        
if($sName == ""){
                            
$disql "INSERT INTO mac_detail (  mac_idx, mac_addr, app_code, pc_name, os_type, screen_w, screen_h, user_id, user_name , cdkey , opt1 )
                                                VALUES     ( '
$var_idx', '$parm_user_mac', '$parm_app_code', '$parm_pc_name', '$parm_os_type', '$parm_screen_w', '$parm_screen_h', '$userid', '$newusername', '$sCDKey' ,'$typeStr' )";
                        }else{    
//»ç¿ëÀÚ¸íÀ» ÀÔ·ÂÇßÀ¸¸é ±×°ª ¾÷µ¥ÀÌÆ®
                            
$disql "INSERT INTO mac_detail (  mac_idx, mac_addr, app_code, pc_name, os_type, screen_w, screen_h, user_id, user_name , cdkey , opt1 )
                                                VALUES     ( '
$var_idx', '$parm_user_mac', '$parm_app_code', '$sName', '$parm_os_type', '$parm_screen_w', '$parm_screen_h', '$userid', '$newusername', '$sCDKey'  ,'$typeStr')";
                        }
                        
                        
mysql_query($disql);
                    }


            }




    }

?>
Á¤Ç°µî·Ï ¿Ï·á
<SCRIPT LANGUAGE="JavaScript">
<!--
    parent.alert("Á¤Ç°µî·ÏÀÌ ¿Ï·áµÇ¾ú½À´Ï´Ù!\nÇÁ·Î±×·¥À» »õ·Î ½ÃÀÛÇØ Áֽʽÿä.");
    parent.history.go(-2);
//-->
</SCRIPT>