Файл: ADLT.BIZ Clone/index.php
Строк: 77
<?
error_reporting(0);
if (!file_exists('config.php')) {
header('Location: install');
exit;
}
include('config.php');
function copyright() {$copy = 'IC0gUG93ZXJlZCBieSA8YSBocmVmPSJodHRwOi8vYWRsdC5iaXovIiB0aXRsZT0iRnJlZSBVUkwgU2hvcnRlbmVyIFNlcnZpY2UiIHRhcmdldD0iX2JsYW5rIj5BZGx0LkJpejwvYT4=';return base64_decode($copy);}
if(!function_exists('copyright')){echo base64_decode('UGxlYXNlIGRvblwndCByZW1vdmUgY29weXJpZ2h0IQ=='); exit;}
if(isset($_POST['shorten']) && $_POST['shorten'] == "true" && isset($_POST['url'])){
$url = strip_tags($_POST['url']);
if(filter_var($url, FILTER_VALIDATE_URL) !== false){
$query = mysql_query("SELECT * FROM urls WHERE url='".$url."'");
if(mysql_num_rows($query) > 0){
$fetch_short = mysql_fetch_array($query);
echo $domain."/".$fetch_short['short'];
}else{
$length = 5;
$characters = '0123456789abcdefghijklmnopqrstuvwxyz';
$short = "";
for ($p = 0; $p < $length; $p++) {
$short .= $characters[mt_rand(0, strlen($characters))];
}
$short_query = mysql_query("SELECT short FROM urls WHERE short='".$short."'");
while(mysql_num_rows($short_query) > 0){
$length = 5;
$characters = '0123456789abcdefghijklmnopqrstuvwxyz';
$short = "";
for ($p = 0; $p < $length; $p++) {
$short .= $characters[mt_rand(0, strlen($characters))];
}
$short_query = mysql_query("SELECT short FROM urls WHERE short='".$short."'");
if(mysql_num_rows($short_query) == 0){
break;
}
}
mysql_query("INSERT INTO urls VALUES('','".$url."','".$short."','0')");
echo $domain."/".$short;
}
}else{
echo "Please enter an valid URL!";
}
}else{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title><? echo $website_title; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="ADLT.BIZ a Free URL shortener service!" />
<meta name="keywords" content="url, shortener, url cut, adlt.biz" />
<meta name="author" content="ADLT.BIZ" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="container">
<a href="<? echo $domain ?>"><div id="logo"></div></a>
<input id="url" type="text" name="URL" value="Enter URL to shorten" onclick="if(this.value=='Enter URL to shorten')this.value='';" onblur="if(this.value=='')this.value='Enter URL to shorten';" />
<input id="shorten" type="submit" name="submit" value="Shorten" />
<div id="correct"></div><div id="error"></div>
</div>
<div id="footer"><span style="float:right;margin-right:20px;">© <?=date('Y').' '.$website_title.copyright()?></div>
<script src="http://code.jquery.com/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="js.js" type="text/javascript"></script>
<!-- Powered by ADLT.BIZ -->
</body>
</html>
<? } ?>