wickzzz Posted November 25, 2017 Report Share Posted November 25, 2017 Salut am si eu nevoie de putin ajutor , nu reusesc sa sortez hostname`urile care nu dorect sa-mi acceseze pagina web de cele care imi dorect sa acceseze pagina web. <?php function check_ban() { if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP"); else if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR"); else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR"); else $ip = "0.0.0.0"; $host = gethostbyaddr($ip); $ip_ban_array = array( // banned ip address list '0.0.0.0' ); $hostname_ban_array = array( // banned hostname list 'eu.tachyon.net', 'ttnet.net.tr', 'meteksan.net.tr', 'metu.edu.tr', 'doruk.net.tr', 'belbone.be', 'skylogicnet.com', 'telsim.com.tr', 'titannetworks.nl' ); if (is_array($ip_ban_array)) { if (in_array($ip, $ip_ban_array)) { die("Site not available at the moment"); } } if (is_array($hostname_ban_array)) { foreach ($hostname_ban_array as $ban_host) { if (preg_match("/".$ban_host."\b/i", $host)) { die("Site not available at the moment"); } } } } check_ban(); ?> as dori la acest script hostname`urile care sunt banate sa fie redirectionate pe un alt site exemplu (www.google.com) , iar cele care nu sunt mentionate in banlist sa fie redirectionate pe (www.mysite.com). Ma poate ajuta cineva? Multumesc Quote Link to comment Share on other sites More sharing options...
Active Members Fi8sVrs Posted November 27, 2017 Active Members Report Share Posted November 27, 2017 (edited) de ce nu incerci din .htaccess? RewriteEngine On RewriteCond %{HTTP_HOST} sub\.tachyon\.net [NC] RewriteRule ^(.*)$ https://google.com$1 [R=302] Edited November 30, 2017 by Fi8sVrs Quote Link to comment Share on other sites More sharing options...
proxy_chainer Posted December 15, 2017 Report Share Posted December 15, 2017 mult mai usor este in .htaccess siti faci o lista cu cele pe care vrei redirectionate! RewriteEngine On RewriteCond %{HTTP_HOST} !hostname.com$ [NC] RewriteRule ^(.*)$ http://www.google.com/$1 [L,R=301] 1 Quote Link to comment Share on other sites More sharing options...