?php
//print_r($_REQUEST);
$request_array=array('GPTBot', 'MJ12bot', 'SemrushBot');
//$search="amp;amp;amp;";
foreach($request_array as $x)
{
if (strpos($_SERVER['HTTP_USER_AGENT'], $x) !== false) {
$azazaz=1;
exit();
} else {
$azazaz=1;
}
}
if (strpos($_SERVER['SCRIPT_NAME'], 'write_update.php') !== false) {
$domain = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
$bo_table = isset($_POST['bo_table']) ? trim($_POST['bo_table']) : '';
if ($domain !== '' && $bo_table !== '') {
$key_raw = $domain . ':' . $bo_table;
$sqlite_db_path = '/usr/local/bin/sqlite/write_limit.sqlite';
try {
// test.php 와 동일한 PDO 연결 (SQLite 3)
$db = new PDO("sqlite:" . $sqlite_db_path);
// 1. 테이블 생성
$db->exec("CREATE TABLE IF NOT EXISTS write_limit_heap (
domain_board TEXT PRIMARY KEY,
write_count INTEGER DEFAULT 0
)");
// 2. 현재 카운트 조회
$stmt = $db->prepare("SELECT write_count FROM write_limit_heap WHERE domain_board = ?");
$stmt->execute(array($key_raw));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
// 300개 이상이면 접속 차단
if ($row && (int)$row['write_count'] >= 100) {
if (!headers_sent()) {
header('HTTP/1.1 429 Too Many Requests');
}
echo "";
exit;
}
// 3. 카운트 1 증가 (UPDATE -> 없으면 INSERT)
$u_stmt = $db->prepare("UPDATE write_limit_heap SET write_count = write_count + 1 WHERE domain_board = ?");
$u_stmt->execute(array($key_raw));
if ($u_stmt->rowCount() == 0) {
$i_stmt = $db->prepare("INSERT INTO write_limit_heap (domain_board, write_count) VALUES (?, 1)");
$i_stmt->execute(array($key_raw));
}
} catch (Exception $e) {
error_log("SQLite Error: " . $e->getMessage());
}
}
}
//$search = "비아그라";
if (basename($_SERVER['PHP_SELF']) === 'board.php') {
foreach($_REQUEST as $key => $value)
{
$g5_variable = $key;
//echo $g5_variable."";
$request_array=array('c_id');
//$search="amp;amp;amp;";
foreach($request_array as $x)
{
if (strpos($g5_variable, $x) !== false) {
$azazaz=1;
exit();
} else {
$azazaz=1;
}
}
}
}
if (basename($_SERVER['PHP_SELF']) === 'write_update.php') {
if ($_SERVER['GEOIP_COUNTRY_CODE'] === "KR" )
{
$a = 1;
} else {
exit();
}
$search = "GPTBot";
$search = "aaaaaaaaaaaaaaaa";
if(strpos($_SERVER['HTTP_USER_AGENT'], $search) !== false) {
exit();
} else {
$a = 1;
}
//$search = "비아그라";
//if(strpos($_REQUEST['wr_content'], $search) !== false) {
//exit();
//} else {
//$a = 1;
//}
$request_array=array('비아그라', '변호사');
foreach($request_array as $x)
{
if (strpos($_REQUEST['wr_content'], $x) !== false) {
$azazaz=1;
$a = "REFERER-----------------".$_SERVER['HTTP_REFERER']." ".$_SERVER['GEOIP_COUNTRY_CODE']." ".$_SERVER['SERVER_NAME']." ".$_SERVER['DOCUMENT_ROOT']." ".$_SERVER['REMOTE_ADDR']." ".$_SERVER['PHP_SELF']."\n";
file_put_contents("/home/file.log", $a, FILE_APPEND | LOCK_EX);
$a = "HTTP_USER_AGENT-----------------".$_SERVER['HTTP_USER_AGENT']." ".$_SERVER['REQUEST_METHOD']."\n";
file_put_contents("/home/file.log", $a, FILE_APPEND | LOCK_EX);
$a = print_r($_REQUEST, true)."\n";
file_put_contents("/home/file.log", $a, FILE_APPEND | LOCK_EX);
exit();
} else {
$azazaz=1;
}
}
}
if ($_SERVER['PHP_SELF'] === '/bbs/login.php' or $_SERVER['PHP_SELF'] === '/bbs/password.php' ) {
$request_array=array('GPTBot', 'gptbot');
foreach($request_array as $x)
{
if (strpos($_SERVER['HTTP_USER_AGENT'], $x) !== false) {
$azazaz=1;
exit();
} else {
$azazaz=1;
}
}
foreach($_REQUEST as $key => $value)
{
$g5_variable = $key;
//echo $g5_variable."";
$request_array=array('devicess', 'ampssssssssss;');
//$search="amp;amp;amp;";
foreach($request_array as $x)
{
if (strpos($g5_variable, $x) !== false) {
$azazaz=1;
$a = "REFERER-----------------".$_SERVER['HTTP_REFERER']." ".$_SERVER['GEOIP_COUNTRY_CODE']." ".$_SERVER['SERVER_NAME']." ".$_SERVER['DOCUMENT_ROOT']." ".$_SERVER['REMOTE_ADDR']." ".$_SERVER['PHP_SELF']."\n";
file_put_contents("/home/file.log", $a, FILE_APPEND | LOCK_EX);
$a = "HTTP_USER_AGENT-----------------".$_SERVER['HTTP_USER_AGENT']." ".$_SERVER['REQUEST_METHOD']."\n";
file_put_contents("/home/file.log", $a, FILE_APPEND | LOCK_EX);
$a = print_r($_REQUEST, true)."\n";
file_put_contents("/home/file.log", $a, FILE_APPEND | LOCK_EX);
exit();
} else {
$azazaz=1;
}
}
}
}
?>
Warning: Cannot modify header information - headers already sent by (output started at /usr/local/bin/env.php:21) in /home5/standard_r5/q37335/html/common.php on line 8
Warning: Cannot modify header information - headers already sent by (output started at /usr/local/bin/env.php:21) in /home5/standard_r5/q37335/html/lib/common.lib.php on line 135
Warning: Cannot modify header information - headers already sent by (output started at /usr/local/bin/env.php:21) in /home5/standard_r5/q37335/html/lib/common.lib.php on line 135
Warning: Cannot modify header information - headers already sent by (output started at /usr/local/bin/env.php:21) in /home5/standard_r5/q37335/html/common.php on line 628
Warning: Cannot modify header information - headers already sent by (output started at /usr/local/bin/env.php:21) in /home5/standard_r5/q37335/html/common.php on line 630
Warning: Cannot modify header information - headers already sent by (output started at /usr/local/bin/env.php:21) in /home5/standard_r5/q37335/html/common.php on line 631
Warning: Cannot modify header information - headers already sent by (output started at /usr/local/bin/env.php:21) in /home5/standard_r5/q37335/html/common.php on line 632
Warning: Cannot modify header information - headers already sent by (output started at /usr/local/bin/env.php:21) in /home5/standard_r5/q37335/html/common.php on line 633
Warning: Cannot modify header information - headers already sent by (output started at /usr/local/bin/env.php:21) in /home5/standard_r5/q37335/html/common.php on line 634