Browser
Started on the old forum in July 2012 · view the original in the archive · old links redirect here
if you want to ban all ppl using a particular browser.
lets say opera for example:
you can do this. go to ipban.php in tools folder.
and then add this to the file.
$browser = explode ('/', $_SERVER['HTTP_USER_AGENT']);
if($browser[0] == "Opera")
{
echo '<meta http-equiv="Refresh" content="0; url=../tools/yourbanned.php">';
}
this will ban all people using opera browsers
what the code does: it grabs the users browser information. breaks it down into an array of words. looks for the word opera in the array and sees if it matches begining of browser info. if true it redirects them to the yourbanned page.
im not sure if it will interfere with the existing ipban there as the ipban looks for both an ip AND browser before banning
so it should be fine to run both side by side. if not just commented out the old code unless you really need it.
$XTREME$ wrote: what type of a code do you need ? Doing with sql or just with php array?
if you knew anything about the scripts that gets posted here. you would know "mobilechat wml" is a flatfile script and created/maintained by me.
he has the correct answer posted above. its upto him now whether he uses it or not.
would be a silly move to have a fully working tool like that cos a browser banner doesnt just ban 1 single person. it bans thousands maybe millions of ppl that use that particular browser.
so if you made a tool like that, where you can ban every browser on the whim of a command, and the list looked like
Opera Mozilla Safari Chrome Nokia6110 N95 etc etc
you wouldnt any visitors at all. you could however just simple add more names to that function yourself that i posted earlier.
like if browser[0] == 'Opera' OR browser[0] == 'Safari' OR browser[0] == 'Mozilla' you could possibly use delimiters too like if browser[0] == 'Opera' || browser[0] == 'Safari' || browser[0] == 'Mozilla' etc etc i think, im sure thats like another way of saying OR
this isnt trying to move away from the original answer. can it be made. yes it can be made by modding a "couple" of files. but i wouldnt recommend a browser ban tool. i dont even recommend using the earlier post or even the original ipban tool that exists. Because i dont believe in them. tools like this are dodgey. as many many ppl share the same ip address or use same browsers
ajit55u wrote: what you think about this code
<?php $br = $_SERVER['HTTP_USER_AGENT']; $blocked = "Nokia6600"; // Browser name if (ereg($blocked,$br)) { echo "You Have Been Banned Reason (Your Reason Here) Contact Owner"; exit(); } ?>
whats really the difference between them? apart from the fact my way is a little shorter in code.
also you can make your code shorter. by putting the echo inside your exit like:: exit("You Have Been Banned Reason (Your Reason Here) Contact Owner");
Edited: i should have also noted. as your code is now. the user would be stuck on the page. with no link to go anywhere. you should either add a link. or a redirect like i did so the user goes somewhere after being told your banned. (just a solution)
Edited Again: sorry to be the bearer of bad new. ereg:: Warning This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged. PHP: ereg - Manual
Added after 11 minutes:
ajit55u wrote: thanks alot for your post Ghost
your welcome. sorry about the ereg function being/getting deprecated. you can always use the code above i posted it does the same thing. you just need to mod the url pointer to point to maybe your index.php and slap in an exit("youve been banned); "underneath" the meta tag.
so it looks like this::
$browser = explode ('/', $_SERVER['HTTP_USER_AGENT']);
if($browser[0] == "Opera")
{
echo '<meta http-equiv="Refresh" content="0; url=index.php">';
exit("You Have Been Banned Reason (Your Reason Here) Contact Owner");
}
//
//
//
and you have yourself a undeprecated version 🙂 hope this is a solution for you.
ajit55u wrote: thank you so much again for the code & explanation ghost
no problem happy to help.
hmm / dat nice ! deal but How to ban user whos those used proxy browser ?
hmm / dat nice ! deal,,,but How to ban user whos those used proxy browser ?