View Full Version : Ban Browser
DelFDgfd_gT
05-23-2003, 01:16 AM
Im sessions table in PHPMyAdmin You can view browsers. I wanted to know, How can I can a certain browser from my forums?
Seems small and easy, can anyone help?
Erwin
05-23-2003, 01:28 AM
Are you sure?
You can add this to the bottom of your "phpinclude" template:
To allow IE only:
if (!eregi("MSIE",$HTTP_USER_AGENT)) show_nopermission();
To allow Netscape only:
if (!eregi("Netscape",$HTTP_USER_AGENT)) show_nopermission();
To allow Mozilla only:
if (!eregi("Mozilla",$HTTP_USER_AGENT)) show_nopermission();
filburt1
05-23-2003, 01:59 AM
:eek: For shame, using the ereg functions!
Better (according to php.net):
if (preg_match("/.*MSIE.*/siU", $_SERVER['HTTP_USER_AGENT'])) show_nopermission();
Faster (according to my completely untested theories):
if (strpos("MSIE", $_SERVER['HTTP_USER_AGENT']) != false) show_nopermission();
DelFDgfd_gT
05-23-2003, 11:31 PM
Actually, I didnt wanna "allow IE only" or "allow mozilla only" thats completely irrelevant to what I asked.
What I want is to BAN a user using the browser:
Internet Explorer V Hohoh , i bet you wish you knew :) ++++ you though.
Block browsers. :)
Linux
08-30-2003, 08:49 PM
Hi
I am not sure but this is a pseuocode if some one can recheck it will be grateful
$agent = $_SERVER['HTTP_USER_AGENT'];
if($agent == "AGENT_NAME"){
header("Location:htt p : //url_to_e-direct_the_user");
exit();
}
change AGENT_NAME to whatever brower you want to ban
for ex : IE = Mozilla/4.0
NTLDR
08-30-2003, 08:58 PM
Provided that AGENT_NAME is the full name and not a subsring of it like Mozilla/4.0 then that will work fine.
Linux
08-31-2003, 03:20 AM
yes
You must Provided the full name of the AGENT
for example you cannot just add WebCopier
it must be WebCopier v3.5
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.