接收请求
IP.php
<?php
// 定义日志文件路径
$logFile = 'hackip.txt';
// 处理删除请求
if (isset($_POST['delete'])) {
$ipToDelete = $_POST['ip'];
$lines = file($logFile, FILE_IGNORE_NEW_LINES);
$newLines = array();
foreach ($lines as $line) {
$parts = explode(' | ', $line);
if ($parts[1] !== $ipToDelete) {
$newLines[] = $line;
}
}
file_put_contents($logFile, implode(PHP_EOL, $newLines));
header("Location: ".$_SERVER['PHP_SELF']);
exit;
}
// 记录当前访问者IP
$ipAddress = $_SERVER['REMOTE_ADDR'];
$timestamp = date('Y-m-d H:i:s');
$logEntry = "[$timestamp] | $ipAddress | " . gethostbyaddr($ipAddress);
file_put_contents($logFile, $logEntry.PHP_EOL, FILE_APPEND);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>// IP_TRACKER v4.2.0 //</title>
<style>
:root {
--hacker-green: #00ff41;
--matrix-green: #00ff9d;
--dark-bg: #0d0208;
--darker-bg: #030303;
}
body {
background-color: var(--dark-bg);
color: var(--hacker-green);
font-family: 'Courier New', monospace;
margin: 0;
padding: 0;
overflow-x: hidden;
line-height: 1.6;
}
.scanlines {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(
to bottom,
rgba(0, 255, 65, 0.03) 0%,
rgba(0, 255, 65, 0.1) 50%,
rgba(0, 255, 65, 0.03) 100%
);
background-size: 100% 4px;
pointer-events: none;
z-index: 1000;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
position: relative;
}
header {
border-bottom: 1px solid var(--matrix-green);
padding-bottom: 10px;
margin-bottom: 30px;
text-align: center;
position: relative;
}
h1 {
font-size: 2.8rem;
text-shadow: 0 0 10px var(--matrix-green);
letter-spacing: 3px;
margin: 20px 0;
animation: glitch 1s linear infinite;
position: relative;
}
h1::after {
content: "_";
animation: blink 1s step-end infinite;
}
.status-bar {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
padding: 10px;
background-color: rgba(0, 0, 0, 0.5);
border: 1px solid var(--hacker-green);
}
.terminal {
background-color: rgba(0, 0, 0, 0.7);
border: 2px solid var(--matrix-green);
padding: 20px;
height: 60vh;
overflow-y: auto;
margin-bottom: 20px;
box-shadow: 0 0 20px var(--matrix-green);
position: relative;
}
.terminal::before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
height: 30px;
background: linear-gradient(to bottom, rgba(0,255,65,0.2), transparent);
}
.log-entry {
margin-bottom: 15px;
padding-left: 20px;
position: relative;
border-bottom: 1px dotted rgba(0, 255, 65, 0.3);
padding-bottom: 10px;
}
.log-entry::before {
content: ">";
position: absolute;
left: 0;
color: var(--matrix-green);
}
.ip-address {
color: var(--matrix-green);
font-weight: bold;
}
.delete-btn {
background: transparent;
color: #ff5555;
border: 1px solid #ff5555;
padding: 3px 10px;
margin-left: 15px;
cursor: pointer;
transition: all 0.3s;
font-family: 'Courier New', monospace;
}
.delete-btn:hover {
background: #ff5555;
color: #000;
box-shadow: 0 0 10px #ff5555;
}
.command-line {
display: flex;
align-items: center;
margin-top: 20px;
}
.prompt {
color: var(--matrix-green);
margin-right: 10px;
white-space: nowrap;
}
#command {
background: transparent;
border: none;
border-bottom: 1px solid var(--matrix-green);
color: var(--hacker-green);
font-family: 'Courier New', monospace;
width: 100%;
padding: 5px;
outline: none;
flex-grow: 1;
}
@keyframes blink {
50% { opacity: 0; }
}
@keyframes glitch {
0% { text-shadow: 2px 0 0 #ff00ff, -2px 0 0 #00ffff; }
25% { text-shadow: -2px 0 0 #ff00ff, 2px 0 0 #00ffff; }
50% { text-shadow: 2px 0 0 #ff00ff, -2px 0 0 #00ffff; }
75% { text-shadow: -2px 0 0 #ff00ff, 2px 0 0 #00ffff; }
100% { text-shadow: 2px 0 0 #ff00ff, -2px 0 0 #00ffff; }
}
.rain {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -1;
pointer-events: none;
overflow: hidden;
}
.rain span {
position: absolute;
display: block;
width: 1px;
height: 50px;
background: linear-gradient(to bottom, transparent, var(--matrix-green));
animation: rain 3s linear infinite;
opacity: 0.6;
}
@keyframes rain {
0% { transform: translateY(-100px) translateX(-10px); opacity: 0; }
10% { opacity: 0.6; }
90% { opacity: 0.6; }
100% { transform: translateY(100vh) translateX(10px); opacity: 0; }
}
.pulse {
animation: pulse 2s infinite alternate;
}
@keyframes pulse {
from { box-shadow: 0 0 5px var(--matrix-green); }
to { box-shadow: 0 0 20px var(--matrix-green); }
}
</style>
</head>
<body>
<div class="rain" id="rain"></div>
<div class="scanlines"></div>
<div class="container">
<header>
<h1>▓▓▓ 黑客IP追踪系统 ▓▓▓</h1>
<div class="status-bar pulse">
<span>> 系统激活</span>
<span>> 用户: <?php echo htmlspecialchars(gethostbyaddr($ipAddress)); ?></span>
<span>> 时间: <?php echo date('H:i:s'); ?></span>
</div>
</header>
<div class="terminal">
<div class="log-entry">
<span class="ip-address"><?php echo htmlspecialchars($ipAddress); ?></span> - INITIALIZING CONNECTION...
</div>
<?php
if (file_exists($logFile)) {
$logs = array_reverse(file($logFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES));
if (empty($logs)) {
echo '<div class="log-entry">NO RECORDS FOUND...</div>';
} else {
foreach ($logs as $log) {
$parts = explode(' | ', $log);
if (count($parts) >= 2) {
echo '<div class="log-entry">';
echo '<span class="ip-address">'.htmlspecialchars($parts[1]).'</span>';
echo ' - ACCESSED @ '.htmlspecialchars($parts[0]);
if (isset($parts[2])) {
echo ' - HOST: '.htmlspecialchars($parts[2]);
}
echo '<form method="post" style="display:inline;">';
echo '<input type="hidden" name="ip" value="'.htmlspecialchars($parts[1]).'">';
echo '<button type="submit" name="delete" class="delete-btn">TERMINATE</button>';
echo '</form>';
echo '</div>';
}
}
}
} else {
echo '<div class="log-entry">INITIALIZING DATABASE...</div>';
}
?>
</div>
</div>
<script>
// 创建黑客雨效果
function createRain() {
const rain = document.getElementById('rain');
for (let i = 0; i < 150; i++) {
const span = document.createElement('span');
span.style.left = Math.random() * 100 + 'vw';
span.style.animationDelay = Math.random() * 5 + 's';
span.style.animationDuration = (Math.random() * 2 + 1.5) + 's';
rain.appendChild(span);
}
}
// 模拟终端输入效果
document.getElementById('command').addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
const command = this.value.trim().toLowerCase();
if (command.startsWith('delete ')) {
const ip = command.substring(7);
// 这里可以添加AJAX请求来删除IP
alert(`COMMAND EXECUTED: TERMINATE CONNECTION TO ${ip}`);
} else if (command === 'clear') {
document.querySelector('.terminal').innerHTML = '<div class="log-entry">SYSTEM LOG CLEARED</div>';
} else if (command === 'help') {
alert('AVAILABLE COMMANDS:\n\ndelete [IP] - Terminate connection\nscan - Scan network\ntrace [IP] - Trace location\nclear - Clear log');
} else {
alert(`UNRECOGNIZED COMMAND: ${command}`);
}
this.value = '';
}
});
// 自动滚动到终端底部
function scrollToBottom() {
const terminal = document.querySelector('.terminal');
terminal.scrollTop = terminal.scrollHeight;
}
// 初始化
window.onload = function() {
createRain();
scrollToBottom();
// 模拟系统启动效果
setTimeout(() => {
const terminal = document.querySelector('.terminal');
const initialEntry = terminal.querySelector('.log-entry');
if (initialEntry) {
initialEntry.innerHTML = `<span class="ip-address">${initialEntry.querySelector('.ip-address').textContent}</span> - CONNECTION ESTABLISHED`;
}
}, 1000);
};
</script>
</body>
</html>
效果
会把请求的ip记录到hackip.txt文件内