/home/mjc1/public_html/onlinecs/mobile/process/ordstateProcess.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
<? session_start(); ?>
<?
include_once("../_common.php");
    if(( 
$id == "" ) && ( $sid == "" )) { 
?>
<script>
    alert("천년스마트발주 로그인 후에 이용가능합니다.");
    parent.location.href = "../../onlinecs/mobile/index.php";
</script>
<?     
     
}

   include(
"../../../onlinecs/commonST.php");
   
   
$charSet_sql "set names utf8";      
   
mysql_query($charSet_sql);

// SMS 발송 관련 option 가져오기 by.jyh
$smsUse    0;
$smsId    "";
$smsPwd    "";
$smsHp    "";

$optionqry "SELECT optname, optvalue FROM options";
$optresult mysql_query($optionqry);
while( 
$optrow mysql_fetch_array($optresult)){    
    if(
$optrow['optname'] == "온주SMS_USE")    $smsUse    $optrow['optvalue'];
    if(
$optrow['optname'] == "온주SMS_ID")    $smsId    $optrow['optvalue'];
    if(
$optrow['optname'] == "온주SMS_PWD")    $smsPwd    $optrow['optvalue'];
    if(
$optrow['optname'] == "온주SMS_HP")    $smsHp    $optrow['optvalue'];
}


$uid $_GET['uid'];
$txtdate $_GET['txtdate'];
$txtdate2 $_GET['txtdate2'];
    if(
$dateop == "1"){
         if(
$state=="1"){
            
$tqry "UPDATE ordbook_m SET ordstate = '$state', ordtime = '$ordtime' WHERE ordno = '$uid' ";
         } else {
             
$tqry "UPDATE ordbook_m SET ordstate = '$state' WHERE ordno = '$uid' ";
         }

    } else {
    
$tqry "UPDATE ordbook_m SET ordstate = '$state' WHERE ordno = '$uid' ";
    }
    
mysql_query($tqry);

    
// sms 발송 로직
    
if($smsUse == && $state=="1"){             
        
// 주문 금액 가져오기
        
$totalPrice 0;
        
$priceSql "SELECT ordqnt, price FROM ordbook_d WHERE ordno = '{$uid}'";
        
$result mysql_query($priceSql);
        while(
$row mysql_fetch_array($result)){
            
$totalPrice $totalPrice + ($row['ordqnt'] * $row['price']);
        }        
        
$msg "<주문접수>\n";
        
$msg .= $sname."\n";
        
$msg .= "주문No:".$uid."\n";
        
$msg .= "금액:".number_format($totalPrice)."\n";

        echo 
"<iframe name='hiddenframe' width='0' height='0' style='border:0px'></iframe>";
        echo 
"<form name='frm' action='http://mijinsoft.co.kr/sms/smssendUtf8.php' method='post' target='hiddenframe'>";
        echo 
"<input type='hidden' name='sendType' value='sms'>";
        echo 
"<input type='hidden' name='userId' value='".$smsId."'>";
        echo 
"<input type='hidden' name='userPw' value='".$smsPwd."'>";
        echo 
"<input type='hidden' name='message' value='".$msg."'>";
        echo 
"<input type='hidden' name='toTel' value='".$smsHp."'>";
        echo 
"<input type='hidden' name='fromTel' value='1566-8680'>";        
        echo 
"</form>";
        echo 
"<script>document.frm.submit();</script>";
        
/*
        echo "
        <script type='text/javascript'>
            var defCharset=document.charset;
            function doSubmit() {
                if (/MSIE/.test(navigator.userAgent)) {
                    document.charset = 'euc-kr';
                }
                document.frm.submit();
                document.charset=defCharset;
            }
            doSubmit();
        </script>"; // 스마트발주는 utf-8 이고 sms Module 는 euc-kr 이므로 전송할때 charset 변경하여 전송.
        */
    
}

    
// 온라인 주문 배송 정보 사용에 다른 옵션 가져오기
    
$sql "select optvalue from options where optname = '온주배송정보사용' ";
    
$res_optval1 mysql_query($sql);
    
$info_optval1 mysql_fetch_array($res_optval1);
    
$sid $sid."x";    $sid substr($sid,0,strlen($sid)-1);

    if(
$mode="sell"){
?>
<script>
parent.alert('진행상태가 저장되었습니다.');
//parent.alert("<?=$tqry?>");
//parent.location.reload();    //부모창 새로고침
<?
// 개구리서적 주문개발
if($sid == "ggrbook" || $sid == "gyu1001" || $sid == "steelhun" || $sid == "hschina"  || $info_optval1['optvalue']=='1'){
?>
    url = "../buyWrite_order.php?uid=<?=$uid?>&detail=y&txtdate=<?=$txtdate?>&txtdate2=<?=$txtdate2?>"
<?}else{?>
    url = "../buyWrite.php?uid=<?=$uid?>&detail=y&txtdate=<?=$txtdate?>&txtdate2=<?=$txtdate2?>"
<?}?>
//parent.location.href = "../buyWrite.php?uid=<?=$uid?>&detail=y&txtdate=<?=$txtdate?>&txtdate2=<?=$txtdate2?>";    //부모창 새로고침
parent.location.replace(url);
</script>
<? } ELSE { ?>
<script>
parent.alert('진행상태가 저장되었습니다.');
//parent.alert("<?=$tqry?>");
//parent.ordersave();    //부모창 새로고침
parent.location.reload();    //부모창 새로고침
</script>
<? ?>