old-finger-url-redirect.php
author Ryan C. Gordon <icculus@icculus.org>
Sat, 27 May 2017 13:48:17 -0400
changeset 93 7f693fc30b66
permissions -rw-r--r--
PHP scripts that deal with new URL style.

Eventually we should dump index.php and just have the perl script do it. Laziness.
icculus@93
     1
<?php
icculus@93
     2
$vhost = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'icculus.org';
icculus@93
     3
$user = isset($_REQUEST['user']) ? $_REQUEST['user'] : '';
icculus@93
     4
icculus@93
     5
$args = '';
icculus@93
     6
if (isset($_REQUEST) && (count($_REQUEST) > 0)) {
icculus@93
     7
    $ch = '?';
icculus@93
     8
    foreach ($_REQUEST as $key => $val) {
icculus@93
     9
        if ($key == 'user') {
icculus@93
    10
            continue;
icculus@93
    11
        }
icculus@93
    12
        $args .= "$ch$key=$val";
icculus@93
    13
        $ch = '&';
icculus@93
    14
    }
icculus@93
    15
}
icculus@93
    16
icculus@93
    17
$url = "https://$vhost/finger/$user$args";
icculus@93
    18
header("Location: $url", true, 301);
icculus@93
    19
print("<html><head><title>Moved Permanently</title></head><body><center>\nThis URL has moved to <a href='$url'>\n\n$url\n\n</a></center></body></html>\n");
icculus@93
    20
exit(0);
icculus@93
    21
?>