Hi there. I've seen few bad plugins without sharing full code (I mean php code):
WebLinks -
https://forums.alliedmods.net/showthread.php?t=300313
WebLync -
https://forums.alliedmods.net/showthread.php?t=298458
Isn't it against alliedmodders forum rules? Well, as moderators are doing nothing about that, I've spent some time testing possible solutions (idk if it's the same method used in above plugins - but probably it is).
So, you will need some php code, example below (redirect.php)
PHP Code:
<?php
if(isset($_GET['url']))
{
$url = $_GET['url'];
}
else
{
die('No redirection url set!');
}
header("Content-Encoding: none");
ob_end_clean();
ignore_user_abort(true);
ob_start();
echo "<script type=\"text/javascript\">
window.open('$url', 'www', false);
</script>
";
$size = ob_get_length();
header("Content-Length: $size");
header("Connection: close");
ob_end_flush();
ob_flush();
flush();
exit();
?>
Example SourcePawn plugin below (webshortcuts_test.sp)
PHP Code:
#include <sourcemod>
#pragma semicolon 1
#define PLUGIN_VERSION "1.0.0"
public Plugin:myinfo =
{
name = "CS: GO Webshortcuts",
author = "root",
description = "Just simple webshortcuts.",
version = PLUGIN_VERSION,
url = "http://uwujka.pl"
}
char sRedirectPHP[] = "http://ADDRESS_TO_YOUR_WEB_PAGE/redirect.php?url=";
char sUrl2[MAXPLAYERS+1][256];
public OnPluginStart()
{
RegConsoleCmd("sm_www", www);
RegConsoleCmd("sm_sail", sail);
}
public Action:www(client, args)
{
char sUrl[] = "http://uwujka.pl";
Format(sUrl2[client], 256, "%s%s", sRedirectPHP, sUrl);
ShowMOTDPanel(client, "", sUrl, MOTDPANEL_TYPE_URL);
CreateTimer(0.5, ShowReloadedUrl, client);
return Plugin_Handled;
}
public Action:sail(client, args)
{
char sUrl[] = "https://www.youtube.com/watch?v=YS4fXhiVEQM";
Format(sUrl2[client], 256, "%s%s", sRedirectPHP, sUrl);
ShowMOTDPanel(client, "", sUrl, MOTDPANEL_TYPE_URL);
CreateTimer(0.5, ShowReloadedUrl, client);
return Plugin_Handled;
}
public Action:ShowReloadedUrl(Handle:timer, any:client)
{
ShowMOTDPanel(client, "", sUrl2[client], MOTDPANEL_TYPE_URL);
}
You can easily adapt code to any web shortcuts plugin. Have fun, but please - give me credits if you use my code. I've made many plugins which I'm not sharing with you because many people just took my code and gave credits to themselves (sadly most of them are from Poland).
WARNING: IT WILL NOT WORK IF YOUR WEB SERVER USES SERVICE LIKE CLOUDFLARE WHICH MODIFICATES HEADERS!
EDIT:
It seems it's not reloading this page now for unknown reason - showing the same page, no mather if I change url. I will look at this...
EDIT2:
Fixed above bug with new plugin code.
__________________