BitTorrent Трекер RusTrek.ru http://5.45.70.241/ |
|
Редирект ссылок http://5.45.70.241/viewtopic.php?f=817&t=10483 |
Страница 1 из 1 |
Автор: | oartemka178 [ 2011-02-05 17:06 ] |
Заголовок сообщения: | Редирект ссылок |
еще один редирект внешних ссылок, который запрещен роботсом Создаем файл go.php со следующим содержанием Код: <?php header('Location: '.urldecode($_GET['url'])); ?> в robots.txt добавить: Код: User-agent: * Disallow: /go.php в bbcode.php найти Код: function make_clickable ($text) { global $bb_cfg; $url_regexp = "# (?<![\"'=]) \b ( (https?://|ftp://|www\.|ftp\.) [\w\#!$%&~/.\-;:=?@\[\]+]+ ) (?![\"']|\[/url|\[/img|</a) (?=[,!]?\s|[\)<!]) #xi"; $text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text); // pad it with a space so we can match things at the start of the 1st line. $ret = " $text "; if ($bb_cfg['parse_ed2k_links']) { // ed2k file links (Meithar): // ed2k://|file|fileName|fileSize|fileHash|(optional params)|(optional params)|etc| $ret = preg_replace_callback("#\b(ed2k://\|file\|([^\\/\|:<>\*\?\"]+?)\|(\d+?)\|([a-f0-9]{32})\|(.*?)/?)(?![\"'])(?=([,\.]*?[\s<\[])|[,\.]*?$)#i", "ed2k_link_callback", $ret); // ed2k server links: // ed2k://|server|serverIP|serverPort $ret = preg_replace("#\b(ed2k://\|server\|([\d\.]+?)\|(\d+?)\|/?)\B#i", "<a href=\"\\1\" class=\"postLink\">\\2:\\3</a>", $ret); } // hide passkey $ret = preg_replace('#\?'. $bb_cfg['passkey_key'] .'=[a-zA-Z0-9]{'. BT_AUTH_KEY_LENGTH .'}&#', '?passkey&', $ret); // hide sid $ret = preg_replace('#([\?&;])sid=[a-zA-Z0-9]{'. SID_LENGTH .'}#', '$1sid', $ret); // matches an "xxxx://yyyy" URL at the start of a line, or after a space. // xxxx can only be alpha characters. // yyyy is anything up to the first space, newline, comma, double quote or < # $ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"\\2\" class=\"postLink\">\\2</a>", $ret); $ret = preg_replace_callback($url_regexp, 'make_url_clickable_callback', $ret); // matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing // Must contain at least 2 dots. xxxx contains either alphanum, or "-" // zzzz is optional.. will contain everything up to the first space, newline, // comma, double quote or <. # $ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"http://\\2\" class=\"postLink\">\\2</a>", $ret); // matches an email@domain type address at the start of a line, or after a space. // Note: Only the followed chars are valid; alphanums, "-", "_" and or ".". $ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\" class=\"postLink\">\\2@\\3</a>", $ret); // Remove our padding.. $ret = substr(substr($ret, 0, -1), 1); return($ret); } /** * Nathan Codding - Feb 6, 2001 * Reverses the effects of make_clickable(), for use in editpost. * - Does not distinguish between "www.xxxx.yyyy" and "http://aaaa.bbbb" type URLs. * */ function undo_make_clickable($text) { $text = preg_replace("#<!-- BBCode auto-link start --><a href=\"(.*?)\">.*?</a><!-- BBCode auto-link end -->#i", "\\1", $text); $text = preg_replace("#<!-- BBcode auto-mailto start --><a href=\"mailto:(.*?)\">.*?</a><!-- BBCode auto-mailto end -->#i", "\\1", $text); return $text; } заменить на это Код: function make_clickable ($text) { global $bb_cfg; $url_regexp = "# (?<![\"'=]) \b ( (https?://|ftp://|www\.|ftp\.) [\w\#!$%&~/.\-;:=?@\[\]+]+ ) (?![\"']|\[/url|\[/img|</a) (?=[,!]?\s|[\)<!]) #xi"; $text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text); // pad it with a space so we can match things at the start of the 1st line. $ret = ' ' . $text; if ($bb_cfg['parse_ed2k_links']) { // ed2k file links (Meithar): // ed2k://|file|fileName|fileSize|fileHash|(optional params)|(optional params)|etc| $ret = preg_replace_callback("#\b(ed2k://\|file\|([^\\/\|:<>\*\?\"]+?)\|(\d+?)\|([a-f0-9]{32})\|(.*?)/?)(?![\"'])(?=([,\.]*?[\s<\[])|[,\.]*?$)#i", "ed2k_link_callback", $ret); // ed2k server links: // ed2k://|server|serverIP|serverPort $ret = preg_replace("#\b(ed2k://\|server\|([\d\.]+?)\|(\d+?)\|/?)\B#i", "<a href=\"\\1\" class=\"postLink\">\\2:\\3</a>", $ret); } // hide passkey $ret = preg_replace('#\?'. $bb_cfg['passkey_key'] .'=[a-zA-Z0-9]{'. BT_AUTH_KEY_LENGTH .'}&#', '?passkey&', $ret); // hide sid $ret = preg_replace('#([\?&;])sid=[a-zA-Z0-9]{'. SID_LENGTH .'}#', '$1sid', $ret); // matches an "xxxx://yyyy" URL at the start of a line, or after a space. // xxxx can only be alpha characters. // yyyy is anything up to the first space, newline, comma, double quote or < $ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"http://rustrek.ru/go.php?url=\\2\" target=\"_blank\" rel=\"nofollow\" class=\"postLink\">\\2</a>", $ret); // matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing // Must contain at least 2 dots. xxxx contains either alphanum, or "-" // zzzz is optional.. will contain everything up to the first space, newline, // comma, double quote or <. $ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"http://rustrek.ru/go.php?url=http://\\2\" target=\"_blank\" rel=\"nofollow\" class=\"postLink\">\\2</a>", $ret); // matches an email@domain type address at the start of a line, or after a space. // Note: Only the followed chars are valid; alphanums, "-", "_" and or ".". $ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret); // Remove our padding.. $ret = substr($ret, 1); return($ret); } /** * Nathan Codding - Feb 6, 2001 * Reverses the effects of make_clickable(), for use in editpost. * - Does not distinguish between "www.xxxx.yyyy" and "http://aaaa.bbbb" type URLs. * */ function undo_make_clickable($text) { $text = preg_replace("#<!-- BBCode auto-link start --><a href=\"http://rustrek.ru/go.php?url=(.*?)\" target=\"_blank\">.*?</a><!-- BBCode auto-link end -->#i", "\\1", $text); $text = preg_replace("#<!-- BBcode auto-mailto start --><a href=\"mailto:(.*?)\">.*?</a><!-- BBCode auto-mailto end -->#i", "\\1", $text); return $text; } открыть bbcode.tpl, найти Код: <!-- BEGIN url --><a href="{URL}" class="postLink">{DESCRIPTION}</a><!-- END url --> заменить на это Код: <!-- BEGIN url --><a href="http://rustrek.ru/go.php?url={URL}" {NOFOLLOW} target="_blank" class="postlink">{DESCRIPTION}</a><!-- END url --> Все готово! |
Автор: | oartemka178 [ 2011-02-05 17:16 ] |
Заголовок сообщения: | |
да, поменяйте в место http://rustrek.ru , на адрес вашего сайта |
Автор: | vons4 [ 2011-02-14 18:55 ] |
Заголовок сообщения: | |
Так правильнее go.php Код: <meta http-equiv="content-type" content="text/html; charset=UTF-8">
Перенаправление <?php $url = isset($_REQUEST['url']) ? $_REQUEST['url'] : ''; if(preg_match('#(http?|ftp)://\S+[^\s.,>)\];\'\"!?]#i',$url)){ sleep(0); //header("Location: $url"); echo "<html><head><meta http-equiv=\"refresh\" content=\"0;url=$url\"></head></html>"; exit(); } ?> |
Автор: | vons4 [ 2011-02-15 11:20 ] |
Заголовок сообщения: | |
как обновить в старых топиках одни махом , а то в новых топиках отображаются ссылки через go.php, а в старых остались прямые ссылки |
Автор: | oartemka178 [ 2011-02-15 15:58 ] |
Заголовок сообщения: | |
я читал на тп твой последний ответ, я так понимаю, что ты уже решил проблему с этим |
Автор: | Varius [ 2011-02-18 07:55 ] |
Заголовок сообщения: | |
vons4 Написали бы решение. |
Автор: | ZerocooL [ 2011-03-15 22:00 ] |
Заголовок сообщения: | |
http://***************/ |
Автор: | ZerocooL [ 2011-03-15 22:01 ] |
Заголовок сообщения: | |
http://rustrek.ru/privmsg.php?mode=post&u=3785 |
Автор: | Varius [ 2011-03-15 23:08 ] |
Заголовок сообщения: | |
еще этот гоу ставился при наведении на ссылку т.файла |
Автор: | oartemka178 [ 2011-03-16 01:10 ] |
Заголовок сообщения: | |
ну тут два варианта или кривовато поставил или в твоей версии двига что то уже нового, видать нужно делать под себя отдельно |
Автор: | SET [ 2011-08-31 21:52 ] |
Заголовок сообщения: | |
admin а как сделать так, что-бы показывало картинку перенаправления? |
Страница 1 из 1 | Часовой пояс: UTC + 3 часа |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |