2018-10-09 19:39:09 -05:00
|
|
|
<?php
|
|
|
|
|
2019-02-14 09:39:29 -06:00
|
|
|
include("../res/config.php");
|
|
|
|
include("../res/library/main.php");
|
2018-10-09 19:39:09 -05:00
|
|
|
|
|
|
|
|
|
|
|
$url_target = $_POST["url_target"];
|
|
|
|
$url_alias = sanitize_filename($_POST["url_alias"]);
|
|
|
|
|
|
|
|
$visible_name = $url_alias . $GLOBALS["url_aliasize_visible_suffix"];
|
|
|
|
$visible_dest = $GLOBALS["url_aliasize_dir"] . $visible_name;
|
|
|
|
$dest_name = $GLOBALS["url_aliasize_dir"] . $url_alias
|
|
|
|
. $GLOBALS["url_aliasize_suffix"];
|
2019-02-14 19:20:06 -06:00
|
|
|
$dest_file = root("/" . $dest_name);
|
2018-10-09 19:39:09 -05:00
|
|
|
|
|
|
|
|
|
|
|
switch (true) {
|
|
|
|
case (empty($url_target) || empty($url_alias)):
|
|
|
|
redirect(make_url("result/create.php?error=1"));
|
|
|
|
break;
|
|
|
|
case (file_exists($dest_file)):
|
|
|
|
redirect(make_url("result/create.php?error=2"));
|
|
|
|
break;
|
|
|
|
case (!valid_url($url_target)):
|
|
|
|
redirect(make_url("result/create.php?error=3"));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case (write_alias($dest_file, $url_target)):
|
|
|
|
redirect(make_url("result/create.php?success="
|
|
|
|
. $visible_name));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
redirect(make_url("result/create.php"));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|