streams/Code/Module/Xref.php

30 lines
695 B
PHP
Raw Normal View History

2016-04-19 03:38:38 +00:00
<?php
2022-02-16 04:08:28 +00:00
namespace Code\Module;
2016-04-19 03:38:38 +00:00
2022-02-16 04:08:28 +00:00
use Code\Web\Controller;
2021-12-02 22:33:36 +00:00
2021-12-02 23:02:31 +00:00
class Xref extends Controller
{
public function init()
{
// Sets a referral URL using an xchan directly
// Link format: example.com/xref/[xchan]/[TargetURL]
// Target URL is optional.
// Cookie lasts 24 hours to survive a browser restart. Contains no personal
// information at all - just somebody else's xchan.
$referrer = argv(1);
$expire = time() + 60 * 60 * 2;
$path = 'xref';
setcookie($path, $referrer, $expire, "/");
$url = '';
2021-12-03 03:01:39 +00:00
if (argc() > 2) {
2021-12-02 23:02:31 +00:00
$url = argv(2);
2021-12-03 03:01:39 +00:00
}
2021-12-02 23:02:31 +00:00
goaway(z_root() . '/' . $url);
}
2016-04-19 03:38:38 +00:00
}