Only logged in users may shorten links. Did you mean to log in?";
require_once('layout-footerlg.php');
die();
}
}
function bve($bv) {
global $mysqli;
$query1 = "SELECT `rid` FROM `redirinfo` WHERE baseval='{$bv}'"; // check if URL exists
$result = $mysqli->query($query1);
$row = mysqli_fetch_assoc($result);
$existing = $row['rid'];
if ($existing != NULL ) {
return true;
}
else {
return false;
}
}
if (!strstr($_POST['urlr'], $protocol)) {
$urlr = "http".$protocol.trim($_POST['urlr']); //add http:// if :// not there
}
else {
$urlr = trim($_POST['urlr']);
}
if (!filterurl($urlr)) {
echo "You entered an invalid url
";
echo "Back";
die();
}
if ($hpi !== $hp) {
echo "We have detected that you may be using automated methods to shorten links.
We offer a free API, please do not use our shorten page as an API.
If you are getting this message, but you are not a bot, please email support@polr.cf
Thanks.";
die();
}
function rStr($length = 4) {
return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
}
if ($ps == "s") {
// if secret url
$rstr = rStr(4);
}
$userinfo = $polrauth->islogged();
if(!is_array($userinfo)) {
$il = false;
}
else {
$il = true;
}
$urlr = $mysqli->real_escape_string($urlr);
$isshort = array('polr.me', 'polr.cf','bit.ly','is.gd','tiny.cc','adf.ly','ur1.ca','goo.gl','ow.ly','j.mp','t.co', $wsa);
foreach ($isshort as $url_shorteners) {
if(strstr($urlr, $protocol.$url_shorteners)) {
echo "You entered an already shortened URL.
";
echo "Back";
die();
}
}$query1 = "SELECT `rid`,`lkey` FROM `redirinfo` WHERE `rurl`='{$urlr}' AND iscustom='no';"; // check if URL exists
$result = $mysqli->query($query1);
$row = mysqli_fetch_assoc($result);
$existing = $row['rid'];
$lkey_ex = $row['lkey'];
$decodescript = "";
$ip = $mysqli->real_escape_string($ip);
$customurl = $mysqli->real_escape_string($_POST['custom']);
if($customurl == "") {
$iscustom = "no";
}
// check if the custom URL ending is allowed
if ($customurl!="") {
if (!ctype_alnum($customurl)) {
echo "Symbols or spaces are not allowed in a customized URL - alphanumeric only. Try again";
die();
}
if (strlen($customurl)>20) {
echo "The maximum length for a custom url is 20 letters. Try again";
die();
}
}
if(!$existing || $customurl!="" || $ps=="s" || $lkey_ex) {
// if URL does not exist, creating custom URL, or requesting a secret link, recreate the URL.
$query1 = "SELECT MAX(rid) AS `rid` FROM `redirinfo` WHERE `iscustom`='no';";
$result = $mysqli->query($query1);
$row = mysqli_fetch_assoc($result);
$ridr = $row['rid'];
// check if next baseval in base32 has been occupied by a custom url
$q_checkbv = "SELECT `baseval` FROM `redirinfo` WHERE `rid`='{$ridr}';";
$perform_cbv = $mysqli->query($q_checkbv);
$cbvr = mysqli_fetch_assoc($perform_cbv);
$based_val = $cbvr['baseval'];
$nbnum = base_convert($based_val,36,10);
$baseval = base_convert($nbnum+1,10,36);
while (bve($baseval) == true) {
$nbnum = base_convert($baseval,36,10);
$baseval = base_convert($nbnum+1,10,36);
}
if ($customurl!="") {
// if user is creating a custom URL
$baseval = $customurl;
$iscustom = "yes";
$query = "SELECT `rid` FROM `redirinfo` WHERE `baseval`='{$customurl}';"; // check if baseval is occupied
$result = $mysqli->query($query);
$row = mysqli_fetch_assoc($result);
$custom_existing = $row['rid'];
if ($custom_existing) {
echo "The custom shorturl ending you specified is already in use. Try again";
die();
}
}
if ($ps == "p" || !$ps) {
$query2 = "INSERT INTO `redirinfo` (baseval,rurl,ip,user,iscustom,country) VALUES ('{$baseval}','{$urlr}','{$ip}','{$userinfo['username']}','{$iscustom}','{$country_code}');";
}
else if ($ps=="s") {
$query2 = "INSERT INTO `redirinfo` (baseval,rurl,ip,user,iscustom,lkey,country) VALUES ('{$baseval}','{$urlr}','{$ip}','{$userinfo['username']}','{$iscustom}','{$rstr}','{$country_code}');";
$baseval .= "?".$rstr;
}
$result2r = $mysqli->query($query2);
$basewsa = base64_encode($wsa);
$basebv =base64_encode($baseval);
echo "";
echo $decodescript;
echo "