/home/mjc1/public_html/html/millennium/ajax.customermovie.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
<?php
include_once("./_common.php");

$DB_HOST  =  "localhost";
$DB_USER  =  "WebHostUser";
$DB_PWD   =  "WebHost5263";
$DB_NAME  =  "webhost";
$sqli_dbcon mysqli_connect($DB_HOST$DB_USER$DB_PWD$DB_NAME);

@
extract($_POST);

$mode_ok "Y";

if(
$mode_ok == "Y" && $type == "impromovie") {

    
$content iconv("utf-8","euckr",$impromovietext);
    
$content addslashes($content);
    
$content nl2br($content);
    
$today date("Y-m-d H:i:s");
    
$type_txt "customermovie";

    
$stmt mysqli_prepare($sqli_dbcon"insert into mBoard_simple_content set type = ?, content = ?, reg_date = ?");
    
// 파라미터를 바인딩 (데이터 타입에 따라 'i'는 정수, 'd'는 실수, 's'는 문자열)
    
$bind mysqli_stmt_bind_param($stmt"sss"$type_txt$contentdate("Y-m-d H:i:s"));

    
// 쿼리 실행
    
$exec mysqli_stmt_execute($stmt);

    
// 쿼리 실행 후 정리
    
mysqli_stmt_close($stmt);

    
//$sql = "insert into mBoard_simple_content set type = 'customermovie', content = '{$content}', reg_date = '{$today}'";
    //mysql_query($sql,$connect_web);

} else if($mode_ok == "Y") {

    
$page_kr_iconv iconv("utf-8","euc-kr",$page_kr);

    if(
$_SESSION['youtube_cnt_flg'] != "1") {

        
// 몇명이 이 페이지에 들어왔는지 카운팅
        
$today date("Y-m-d"); // 오늘날짜
        
$time date("H");
        
$stmt mysqli_prepare($sqli_dbcon"SELECT * FROM mBoard_page_count WHERE inflow_date = ? AND page = ? AND page_kr = ? ORDER BY inflow_time DESC");
        
// 파라미터를 바인딩 (데이터 타입에 따라 'i'는 정수, 'd'는 실수, 's'는 문자열)
        
$bind mysqli_stmt_bind_param($stmt"sss"$today$page$page_kr_iconv);
        
$exec mysqli_stmt_execute($stmt);
        
$result mysqli_stmt_get_result($stmt);
        
$row mysqli_fetch_assoc($result);

        if(
mysqli_num_rows($result) <= || $row['inflow_time'] != $time){ // 데이터가 없을 때
            
$stmt2 mysqli_prepare($sqli_dbcon"INSERT INTO mBoard_page_count(inflow_date, inflow_time, count, page, page_kr) VALUES (?, ?, ?, ?, ?)");
            
// 파라미터를 바인딩 (데이터 타입에 따라 'i'는 정수, 'd'는 실수, 's'는 문자열)
            
$count 1;
            
$bind mysqli_stmt_bind_param($stmt2"siiss"$today$time$count$page$page_kr_iconv);
            
// 쿼리 실행
            
$exec mysqli_stmt_execute($stmt2);
            
// 쿼리 실행 후 정리
            
mysqli_stmt_close($stmt2);

        } else { 
// 데이터가 있을 때
            
$stmt2 mysqli_prepare($sqli_dbcon"UPDATE mBoard_page_count SET count = count+1 WHERE inflow_date = ? AND inflow_time = ? AND page = ?");
            
// 파라미터를 바인딩 (데이터 타입에 따라 'i'는 정수, 'd'는 실수, 's'는 문자열)
            
$count 1;
            
$bind mysqli_stmt_bind_param($stmt2"sis"$today$time$page);
            
// 쿼리 실행
            
$exec mysqli_stmt_execute($stmt2);
            
// 쿼리 실행 후 정리
            
mysqli_stmt_close($stmt2);
        }
        
/*
        $today = date("Y-m-d"); // 오늘날짜
        $time = date("H");
        $sql = "SELECT * FROM mBoard_page_count WHERE inflow_date = '{$today}' AND page = '{$page}' AND page_kr = '{$page_kr}' ORDER BY inflow_time DESC";
        $res = mysql_query($sql,$connect_web);
        $row = mysql_fetch_array($res);

        if(!$row || $row['inflow_time'] != $time){ // 데이터가 없을 때
            $insertsql = "INSERT INTO mBoard_page_count(inflow_date, inflow_time, count, page, page_kr) VALUES ('{$today}', '{$time}', 1, '{$page}', '{$page_kr}')";
            mysql_query($insertsql,$connect_web);
        } else { // 데이터가 있을 때
            $updatesql = "UPDATE mBoard_page_count SET count = count+1 WHERE inflow_date = '{$today}' AND inflow_time = '{$time}' AND page = '{$page}'";
            mysql_query($updatesql,$connect_web);
        }
        */

        
$_SESSION['youtube_cnt_flg'] = "1";
    }
}

mysqli_close($sqli_dbcon);

echo 
"<?php xml version='1.0' encoding='utf-8'?><output>";
echo 
"<mode>".$mode."</mode>";
echo 
"<mode_ok>".$mode_ok."</mode_ok>";
echo 
"<msg>".$msg."</msg>";
echo 
"</output>";
?>