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
|
<?php include("./_common.php"); include("../../manage/category/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);
function filter_SQL($content){ $content = str_replace("&", "&", $content); $content = str_replace("<", "<", $content); $content = str_replace(">", ">", $content); $content = str_replace("'", "&apos", $content); $content = str_replace("\"", """, $content); $content = str_replace("\r", "", $content); $content = str_replace("'", "", $content); $content = str_replace('"', "", $content); $content = str_replace("--", "", $content); $content = str_replace(";", "", $content); $content = str_replace("%", "", $content); //$content = str_replace("+", "", $content); // 상담분야 선택에서 +가 들어가기때문에 코멘트 $content = str_replace("script", "", $content); $content = str_replace("alert", "", $content); $content = str_replace("cookie", "", $content); $content = SQL_Injection($content); return $content; }
function SQL_Injection($get_Str) { $Str = preg_replace("/(select|union|insert|update|delete|drop|\"|\'|#|\/\*|\*\/|\\\|\;)/i","", $get_Str); return $Str; }
foreach($_POST as $key => $val) { $_POST[$key] = filter_SQL($val); }
@extract($_POST);
$mobile_agent = "/(iPod|iPhone|Android|BlackBerry|SymbianOS|SCH-M\d+|Opera Mini|Windows CE|Nokia|SonyEricsson|webOS|PalmOS)/";
if(preg_match($mobile_agent, $_SERVER['HTTP_USER_AGENT'])){ $txt = "(모바일)"; }else{ $txt = "(PC)"; }
$today = date("Y-m-d H:i:s",time()); $ip = $_SERVER['REMOTE_ADDR']; $n_fix_select2 = iconv("UTF-8","EUC-KR",$n_fix_select); $inflow = iconv("UTF-8","EUC-KR","하단유입".$txt); if(trim($n_fix_select2) != "" && trim($n_fix_tel) != "") {
$stmt = mysqli_prepare($sqli_dbcon, "insert into mBoard_install_req (smtitle, smtel, reg_date, ipadd, inflow) values (?, ?, NOW(), ?, ?)"); // 파라미터를 바인딩 (데이터 타입에 따라 'i'는 정수, 'd'는 실수, 's'는 문자열) mysqli_stmt_bind_param($stmt, "ssss", $n_fix_select2, $n_fix_tel, $ip, $inflow);
// 쿼리 실행 if (!mysqli_stmt_execute($stmt)) { mysqli_close($sqli_dbcon); die("ERROR"); }
// 쿼리 실행 후 정리 mysqli_stmt_close($stmt); }
mysqli_close($sqli_dbcon);
echo "도입상담 신청 되었습니다. *근무시간 기준 20분내 연락 드리겠습니다. *비근무 시간 신청은 근무시간에 연락 드립니다. 감사합니다."; ?>
|