Last active
April 9, 2021 19:49
-
-
Save phecdaDia/a7f2a1b9bd786a55d4728ff9a5a9208f to your computer and use it in GitHub Desktop.
Redirect discord
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$discord_user_agent = 'Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com)'; | |
$title = ''; | |
$description = ''; | |
$image_url = ''; | |
$redirect_url = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'; | |
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; | |
if ($_SERVER['HTTP_USER_AGENT'] == $discord_user_agent) { | |
?> | |
<!DOCTYPE html> | |
<html lang="en-US"> | |
<head> | |
<title><?php echo($title); ?></title> | |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous"> | |
<meta charset="utf-8"> | |
<meta content="<?php echo($title); ?>" property="og:title"> | |
<meta content="<?php echo($title); ?>" property="og:description"> | |
<meta content="<?php echo($actual_link); ?>" property="og:url"> | |
<meta content="<?php echo($image_url); ?>" property="og:image"> | |
<meta content="#43B581" data-react-helmet="true" name="theme-color"> | |
</head> | |
<body> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf" crossorigin="anonymous"></script> | |
<img src="<?php echo($image_url); ?>"/> | |
</body> | |
</html> | |
<?php | |
} else { | |
http_response_code(302); | |
header('Location: '.$redirect_url); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment