<?php
define('_IN_JOHNCMS', 1);
$server = $_SERVER['DOCUMENT_ROOT'];
require($server . '/system/bootstrap.php');

$headmod='ShortLink';
$textl='Short Link tool';
require($server . '/system/head.php');

if (!$systemUser->isValid()) {
header('Location: ../login.php');
}
echo '<div class="mainblok">';
$n=rand(0000,9999);
$pathname=base_convert($n,10,36);
mkdir($pathname);
$file=$pathname . "/" . "index.php";
$fh= fopen($file,'w');
$string = "<?php header('Location:". $_POST["url"]."'); ?>";
fwrite($fh,$string);
fclose($fh);
echo '<div class="phdr">Shorter Link</div><div class="menu">';
echo "Your Link: <br/>" . "<a href =" . $config['homeurl'] . "/u/" . $pathname . ">" . $config['homeurl'] . "/u/" . $pathname . "</a>";
echo '<br/>';
echo 'copy:<br/><p align="center"><input type="text" value="' . $config['homeurl'] . '/u/' . $pathname . '"></p>';


echo '</div><div class="phdr"><a href="../index.php">Home</a></div></div>';

require('../system/end.php');
?>

