Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

PHP 

Block all useragent except one

Hello can someone help me with this i want to block all useragents except one which is "Globelexic 2.7"

PHP Code

<?php 
if(!empty($_SERVER['HTTP_USER_AGENT'])) {
    
$userAgents = array("Google", "Slurp", "MSNBot", "ia_archiver", "Yandex", "Rambler");
    if(
preg_match('/' . implode('|', $userAgents) . '/i', $_SERVER['HTTP_USER_AGENT'])) {
        
header('HTTP/1.0 404 Not Found');
        exit;
    }
} 
PHP Code

<?php 
if ($_SERVER['HTTP_USER_AGENT'] !== "Globelexic 2.7") header('HTTP/1.0 404 Not Found'); 
New to trading cryptocurrencies but don't know where to start? Join Binance here! Binance is my favourite exchange for cryptocurrencies w/ low fees.

[Image: 793854efd3c9ee7d90ddd413ae9deed6.png]
(Jul 11, 2016 04:25 AM)Chickendipper Wrote:  
PHP Code

<?php 
if ($_SERVER['HTTP_USER_AGENT'] !== "Globelexic 2.7") header('HTTP/1.0 404 Not Found'); 

page still showing :(
(Jul 11, 2016 04:32 AM)3yZtwglFSCUs Wrote:  page still showing :(

Try using exit after header?
it's perfect :D

if ($_SERVER['HTTP_USER_AGENT'] !== "Globelexic 2.7") {
header('HTTP/1.0 404 Not Found');
exit;
}


Possibly Related Threads...
Thread / Author Replies Views Last Post
[PHP] by T i e rMay 18, 2020 05:45 PM 0 97 May 18, 2020 05:45 PM
Last Post: T i e r
[PHP] by 2073436Jun 16, 2018 11:15 AM 3 234 Jun 16, 2018 11:15 AM
Last Post: 2073436
[PHP] by ๖ۣۜMrRootJul 2, 2015 09:34 AM 5 203 Jul 2, 2015 09:34 AM
Last Post: ๖ۣۜMrRoot