- Destek istenen forum
- https://xenforo.com
Merhaba arkadaşlar xenforo da external link üzerinde bi ufak çalışma yapmaya çalışıyorum ama bunun içine örnek verecek olursak üçretli üyeliğim var ama sayfamda dış bağlantılara giderken uyarı göstermesini istiyorum göstermesini sağladığımızı farz edersek reklam geliyor hani bu link kısaltma servislerinkinden sonra ise tıkladığı bağlantıya gidiyor ama ben üçretli kullanıcıya sadece sayfa dışına çıktığı external link olanı göstermek istiyorum bunu nasıl yapabilirim şuan elimdeki çalışmalar ile yapmış olduğum kod ile bütün hepsini kapsıyor dış bağlantıların
Bu kod : redirect.html olarak sunucunun ana dizinde bulunanı .
Bu kod ise PAGE_CONTAINER şablonu içerisine </body> etiketden önce koyduğum kod
Bu kod : redirect.html olarak sunucunun ana dizinde bulunanı .
HTML:
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<title>Dış Bağlantı Uyarısı</title>
<style>
body {
font-family: 'Segoe UI', sans-serif;
margin: 0;
padding: 0;
background-color: #f9f9f9;
color: #333;
text-align: center;
}
header {
background-color: #2c3e50;
color: white;
padding: 10px 0 5px;
}
.logo {
display: inline-block;
margin: 10px 0;
}
.logo img {
height: 50px;
}
.container {
max-width: 600px;
margin: 30px auto;
background: white;
padding: 30px;
border-radius: 12px;
box-shadow: 0 0 20px rgba(0,0,0,0.05);
}
.warning {
font-size: 20px;
color: #e74c3c;
margin-bottom: 20px;
}
.countdown {
font-size: 18px;
margin-bottom: 10px;
}
#convertedLink {
display: inline-block;
padding: 12px 24px;
background-color: #27ae60;
color: white;
border-radius: 8px;
text-decoration: none;
font-weight: bold;
margin-top: 20px;
}
.ad-banner {
margin: 20px 0;
padding: 10px;
background: #ececec;
border: 1px dashed #ccc;
}
.back {
margin-top: 20px;
display: inline-block;
color: #2980b9;
text-decoration: none;
}
</style>
</head>
<body>
<header>
<a href="https://www.site.net" class="logo" title="Ana Sayfa">
<img src="https://site.net/logo8.png" alt="Site Logosu">
</a>
</header>
<div class="ad-banner">
<!-- Start of ouo.io banner code -->
<a href="http://ouo.io/ref/JjrBv8rG"><img src="http://ouo.io/images/banners/r1.jpg" title="ouo.io - Make short links and earn the biggest money" /></a>
<!-- End of ouo.io banner code -->
</div>
<div class="container">
<div class="warning">Bu bağlantı site dışına yönlendiriyor!</div>
<div class="countdown">Yönlendirme <span id="timer">5</span> saniye içinde gerçekleşecek.</div>
<a id="convertedLink" href="#" rel="nofollow" target="_blank">Şimdi Git</a>
<br>
<a class="back" id="backButton" href="#">← Geri dön</a>
</div>
<div class="ad-banner">
<!-- Start of ouo.io banner code -->
<a href="http://ouo.io/ref/JjrBv8rG"><img src="http://ouo.io/images/banners/r1.jpg" title="ouo.io - Make short links and earn the biggest money" /></a>
<!-- End of ouo.io banner code -->
</div>
<!-- aylink script -->
<script type="text/javascript">
var link_api_token = '***************';
var link_domains = ['drive.google.com', '', 'mega.nz', 'pixeldrain.com', 'www.mediafire.com', 'gofile.io', 'krakenfiles.com', 'apkadmin.com'];
</script>
<script src='//aylink.co/full-api.js'></script>
<script>
const urlParams = new URLSearchParams(window.location.search);
const realUrl = decodeURIComponent(urlParams.get("url"));
const linkElement = document.getElementById("convertedLink");
linkElement.href = realUrl;
// Geri sayım ve otomatik tıklama
let countdown = 15;
const timerEl = document.getElementById("timer");
const interval = setInterval(() => {
countdown--;
timerEl.textContent = countdown;
if (countdown <= 0) {
clearInterval(interval);
linkElement.click();
}
}, 1000);
// Geri dön butonu
document.getElementById("backButton").addEventListener("click", function(e) {
e.preventDefault();
if (document.referrer && document.referrer !== window.location.href) {
window.location.href = document.referrer;
} else {
window.location.href = "https://www.site.net"; // fallback URL
}
});
</script>
</body>
</html>
Bu kod ise PAGE_CONTAINER şablonu içerisine </body> etiketden önce koyduğum kod
Kod:
<script>
document.addEventListener("DOMContentLoaded", () => {
const links = document.querySelectorAll("a[href^='http']");
const currentHost = window.location.hostname;
const whiteList = [
'drive.google.com', 'mega.nz', 'pixeldrain.com', 'www.mediafire.com',
'gofile.io', 'krakenfiles.com', 'apkadmin.com'
];
links.forEach(link => {
const href = link.getAttribute("href");
try {
const linkHost = new URL(href).hostname;
if (linkHost !== currentHost) {
const encoded = encodeURIComponent(href);
link.setAttribute("href", "/redirect.html?url=" + encoded);
}
} catch (e) {
console.warn("Link hatalı olabilir:", href);
}
});
});
</script>