-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcheck_duplicates.php
39 lines (33 loc) · 1.27 KB
/
check_duplicates.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
require_once('inc/common.php');
function sortLen($a,$b){
return strlen($a) - strlen($b);
}
$yoursite = "jdarchive.org"; //Your site url without http://
$yoursite2 = "www.jdarchive.org"; //Type your domain with www. this time
$referer = $_SERVER['HTTP_REFERER'];
//Check if browser sends referrer url or not
if ($referer == "") //If not, set referrer as your domain
$domain = $yoursite;
else
$domain = parse_url($referer); //If yes, parse referrer
if($domain['host'] == $yoursite || $domain['host'] == $yoursite2) {
if(isset ($_GET['url'])){
$url = $_GET['url'];
if($url != "") {
$sQuery = "SELECT url FROM seeds WHERE url LIKE '%" . mysql_real_escape_string($url) . "%'";
$result = mysql_query($sQuery);
$rArr = array();
while ($row = mysql_fetch_array($result,MYSQLI_ASSOC)){
$rArr[] = $row['url'];
}
usort($rArr, 'sortLen');
echo json_encode($rArr);
}
}
} else {
//The referrer is not your site, we redirect to your home page
header("Location: http://jdarchive.org");
exit(); //Stop running the script
}
?>