/
var
/
www
/
coeditor.org
/
site
/
coeditor.org
/
go
/
/var/www/coeditor.org/site/coeditor.org/go
mkdir
upload
Name
Size
Mode
Actions
5f9ea479.php
2197
0644
edit
dl
rm
Edit:
/var/www/coeditor.org/site/coeditor.org/go/5f9ea479.php
(2197B)
<?php // ── Click tracking ────────────────────────────────────────────── $log_path = '/mnt/hdd/coeditor/data/stats_error.log'; try { $db = new SQLite3('/mnt/hdd/coeditor/data/stats.db'); $db->busyTimeout(5000); $db->exec('PRAGMA journal_mode=WAL'); $db->exec('CREATE TABLE IF NOT EXISTS redirect_clicks ( id INTEGER PRIMARY KEY AUTOINCREMENT, domain TEXT NOT NULL, redirect_hash TEXT, target_url TEXT, ip TEXT, user_agent TEXT, referrer TEXT, created_at DATETIME DEFAULT (datetime(\'now\')) )'); $ip = substr(($_SERVER['REMOTE_ADDR'] ?? ''), 0, 45); $ua = substr(($_SERVER['HTTP_USER_AGENT'] ?? ''), 0, 500); $ref = substr(($_SERVER['HTTP_REFERER'] ?? ''), 0, 1000); $stmt = $db->prepare('INSERT INTO redirect_clicks (domain, redirect_hash, target_url, ip, user_agent, referrer) VALUES (:d, :h, :t, :ip, :ua, :r)'); if (!$stmt) { @file_put_contents($log_path, date("Y-m-d H:i:s") . " REDIRECT ERROR prepare: " . $db->lastErrorMsg() . "\n", FILE_APPEND | LOCK_EX); } else { $stmt->bindValue(':d', 'coeditor.org', SQLITE3_TEXT); $stmt->bindValue(':h', '5f9ea479', SQLITE3_TEXT); $stmt->bindValue(':t', 'https://admin.coeditor.org', SQLITE3_TEXT); $stmt->bindValue(':ip', $ip, SQLITE3_TEXT); $stmt->bindValue(':ua', $ua, SQLITE3_TEXT); $stmt->bindValue(':r', $ref, SQLITE3_TEXT); $result = $stmt->execute(); if (!$result) { @file_put_contents($log_path, date("Y-m-d H:i:s") . " REDIRECT ERROR execute: " . $db->lastErrorMsg() . "\n", FILE_APPEND | LOCK_EX); } } $db->close(); } catch (Exception $e) { @file_put_contents($log_path, date("Y-m-d H:i:s") . " REDIRECT EXCEPTION: " . $e->getMessage() . "\n", FILE_APPEND | LOCK_EX); } // ── Redirect ──────────────────────────────────────────────────── header("HTTP/1.1 302 Found"); header("Location: https://admin.coeditor.org"); exit;
Save
cmd:
run