Browser

Started on the old forum in July 2012 · view the original in the archive · old links redirect here

10 replies · 1,010 views · started 14 years ago · 1 min read

5 participants
weet2012 Junior · 12 posts #1

how to ban browser with the scrip mobilechat wml ? pls help

Ghost Senior · 366 posts #2

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.

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
$XTREME$ Developer · 82 posts #3

what type of a code do you need ? Doing with sql or just with php array?

Ghost Senior · 366 posts #4

$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.

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
weet2012 Junior · 12 posts #5

thanks my master. its nice code 4me bro, the code can ban browser if i use ftp on9 , do u can display, how to ban browser in chat, example , banbrowser/browser user , lyk ban/ghost or kick/ghost

Ghost Senior · 366 posts #6

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

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
ajit55u Developer · 157 posts #7

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();
}
?>

They Make Rules & I Break Them

Ghost Senior · 366 posts #8

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.

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
ajit55u Developer · 157 posts #9

thank you so much again for the code & explanation ghost

They Make Rules & I Break Them

Ghost Senior · 366 posts #10

ajit55u wrote: thank you so much again for the code & explanation ghost

no problem happy to help.

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
Adversary_viswa Newbie · 2 posts #11

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 ?

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close