website/tesses.net/s/shorten.php

34 lines
774 B
PHP
Raw Normal View History

2022-07-23 13:29:59 +00:00
<?php
if(!isset($_POST["url"]))
{
echo "Error no url";
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>This is the link</title>
</head>
<body>
<h1>This is the link</h1>
<?php
$dirname = uniqid();
mkdir($dirname);
$myfile = fopen($dirname."/index.php", "w") or die("Unable to open file!");
$txt="<?php header('Location: ".$_POST["url"]."'); exit; ?>";
fwrite($myfile, $txt);
fclose($myfile);
?>
<a href="<?php echo htmlspecialchars($dirname); ?>">https://tesses.net/s/<?php echo htmlspecialchars($dirname); ?></a>
<?php ?>
</body>
</html>