/home/mjc1/public_html/mjpoint/usepointsave.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
<?
// include Á¤ÀÇ
include_once("dbconnect.php");    // DB Connect Information

// Notice Error ¹æÁö
if(!isset($_POST['userId']))    $_POST['userId']    = ""//»ç¿ëÀÚ ID
if(!isset($_POST['usepoint']))    $_POST['usepoint']    = ""//»ç¿ëÆ÷ÀÎÆ®
if(!isset($_POST['usetype']))    $_POST['usetype']    = ""//»ç¿ë±¸ºÐ( 1:ÀüÀÚ¼¼±Ý°è»ê¼­, 2:¸ÞÀÏ¸í¼¼¼­, 3:SMSÃæÀü, 4:±Þ¿©¸í¼¼E¸ÞÀÏ, 5:E¸ÞÀÏ °è»ê¼­)  
if(!isset($_POST['foreignkey']))    $_POST['foreignkey']    = ""//ÀüÀÚ¼¼±Ý°è»ê¼­ ÀÏ °æ¿ì (°ü¸®¹øÈ£)
if(!isset($_POST['bigo']))    $_POST['bigo']    = ""// ºñ°í


// º¯¼ö ¼±¾ð
$userId        $_POST['userId'];                // »ç¿ëÀÚ ID
$usepoint        $_POST['usepoint'];        // »ç¿ëÆ÷ÀÎÆ®
$usetype        $_POST['usetype'];        // »ç¿ë±¸ºÐ
$foreignkey        $_POST['foreignkey'];        // foreignkey
$bigo        $_POST['bigo'];        // ºñ°í


// ÇʼöÇ׸ñÀÌ ´©¶ô µÇ¾úÀ» °æ¿ì Error Message Ãâ·Â ÈÄ Á¾·á.
if($userId == "" ){
    echo 
$errorMsg "ÇʼöÇ׸ñÀÌ ´©¶ô µÇ¾ú½À´Ï´Ù.";
    
// µð¹ö±ë ¸ðµå
    /*/
    foreach($_POST as $k => $value){
        echo $k."=>".$v."<br>";
    }
    */
    
exit;
}

$sql "INSERT cash_use SET 
            cust_id    = '
{$userId}',
            usepoint     = 
{$usepoint},
            use_type    = 
{$usetype},
            use_fkey    = '
{$foreignkey}',
            bigo    = '
{$bigo}'
            "
;                
mysql_query($sql$conn);
$check mysql_affected_rows();

if(
$check != 0){
  
  
$sql "select a.id as userid, b.custname as custname, b.custnum as custnum, a.curpoint as curpoint, a.expire_date as expire_date from cust_cash as a ";
  
$sql $sql " inner join customers as b on a.id = b.id ";
  
$sql $sql " where a.id = '{$userId}' LIMIT 1 ";
  
  
$result mysql_query($sql$conn);
  
  while(
$row mysql_fetch_assoc($result)){
      
$userInfo $row;
  }
  
  echo 
"[ok];succ = ".$userInfo['curpoint'].";";
  exit;      
}else{
  echo 
"Æ÷ÀÎÆ®»ç¿ëÀ̷ µî·ÏÁß ¿À·ù°¡ ¹ß»ýÇÏ¿´½À´Ï´Ù.";
  exit;      
}

?>