AlexUA
Нашел perl скрипт, в который забиваешь ссылки, ставишь урл вида mysite.com/redirect.cgi?goto=линк, скрипт достает из списка урл равный параметру линк, и перенаправляет. Но есть одна проблема, в скрипте есть проверка по рефереру, если человеку не установился реферер, отправляет на default url. Можно как-то отключить проверку реферера? Там в начале написано в условиях If you comment, or delete this varuable, then referring URL will not be checked, но я не уверен что это отключит проверку реферера. Не посмотрите по коду? Код скрипта:
Код:
# Allowed Referrals - Uncomment next line if you want to check the referral URL. Use this array to define which referring URLs are allowed. If you comment, or delete this varuable, then referring URL will not be checked.
-Example:
If you set @allow = "mywebsite.com"; then only people comming from the
domain sharpcash.com will be able to redirect through this script.
-Note:
If the referring URL is not allowed, then the users will be redirected
to the $default URL
# @allow = ('sharpcash.com','yahoo.com', '/scripts');
#Check param Case - 0 = Do not check, 1 = Check. Use this varuable to switch case sensitivity on/off - 0 = Doesn't matter, 1 = Matters.
$case = 0;
#Default URL - If param is not found, or referrer is not allowed, user will be redirected to this page. This varuable defines a default URL.
Will be used:
- User entered an incorrect 'goto' param
- Referring URL is not in @allow
$default = "http://www.MainCentral.com/";
#param, and URL - See readme.txt for more information
@Redirection = (
"scripts", "http://www.MainCentral.com/",
"cash", "http://sharpcash.hypermart.net/",
"microsoft", "http://www.Microsoft.com/"
);
# That's It! - END to configuration! - Do not modify anything below.
print "Location: ";
&CheckRefer;
&Redir;
&Default;
sub Redir {
$goto = $ENV{'QUERY_STRING'};
($null,$param) = split /goto=/, $goto;
$goo = $param;
$goo = lc($goo) if ($case == 0);
for ($i = 0; $i < @Redirection; $i+=2) {
if ($case == 0) {
if ($goo eq lc($Redirection[$i])) { $i++; print "$Redirection[$i]\n\n"; exit; }
}
else {
if ($goo eq $Redirection[$i]) { $i++; print "$Redirection[$i]\n\n"; exit; }
}
}
&Default;
}
sub CheckRefer {
foreach (@allow) {
$o = "1";
next unless $_;
$ok = "1" if ($ENV{'HTTP_REFERER'} =~ m!$_!);
}
if (($ok ne "1") && ($o eq "1")) { &Default; }
}
sub Default {
print "$default\n\n";
exit;
}
Последний раз редактировалось: AlexUA (08/09/09 в 17:06), всего редактировалось 1 раз
CryptLine
Код:
# @allow = ('sharpcash.com','yahoo.com', '/scripts');
решетка перед текстом в перле - комментарий. да, можешь оставить перед этой строкой решетку и все - проверка будет не активна. можешь сделать и как советовал
gimcnuk парой постов выше - тоже сработает.
AlexUA
Там еще есть параметр case. А он для чего нужен?
Код:
#Check param Case - 0 = Do not check, 1 = Check. Use this varuable to switch case sensitivity on/off - 0 = Doesn't matter, 1 = Matters.