how to ban browser with the scrip mobilechat wml ? pls help
Browser
Collapse
X
-
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.
PHP Code:$browser = explode ('/', $_SERVER['HTTP_USER_AGENT']);
if($browser[0] == "Opera")
{
echo '<meta http-equiv="Refresh" content="0; url=../tools/yourbanned.php">';
}
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 '
sigpic
alt='coding-talk.com!!' />';
echo 'Sharing Is Caring!';
} else {
echo '
alt='the username GHOST has been comprimised!' />';
echo 'OMG SOMEBODY HELP ME!!';
}
?>
-
Originally posted by $XTREME$ View Postwhat type of a code do you need ? Doing with sql or just with php array?
he has the correct answer posted above. its upto him now whether he uses it or not.<?php
include ('Ghost');
if ($Post == true) {
echo '
sigpic
alt='coding-talk.com!!' />';
echo 'Sharing Is Caring!';
} else {
echo '
alt='the username GHOST has been comprimised!' />';
echo 'OMG SOMEBODY HELP ME!!';
}
?>
Comment
-
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 '
sigpic
alt='coding-talk.com!!' />';
echo 'Sharing Is Caring!';
} else {
echo '
alt='the username GHOST has been comprimised!' />';
echo 'OMG SOMEBODY HELP ME!!';
}
?>
Comment
-
what you think about this code
PHP 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();
}
?>Last edited by ajit55u; 28.07.12, 05:29.They Make Rules & I Break Them
Comment
-
Originally posted by ajit55u View Postwhat you think about this code
PHP 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();
}
?>
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:
Originally posted by ajit55uthanks alot for your post Ghost
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::
PHP Code:$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");
}
//
//
//
hope this is a solution for you.Last edited by Ghost; 28.07.12, 06:12.<?php
include ('Ghost');
if ($Post == true) {
echo '
sigpic
alt='coding-talk.com!!' />';
echo 'Sharing Is Caring!';
} else {
echo '
alt='the username GHOST has been comprimised!' />';
echo 'OMG SOMEBODY HELP ME!!';
}
?>
Comment
-
Originally posted by ajit55u View Postthank you so much again for the code & explanation ghost<?php
include ('Ghost');
if ($Post == true) {
echo '
sigpic
alt='coding-talk.com!!' />';
echo 'Sharing Is Caring!';
} else {
echo '
alt='the username GHOST has been comprimised!' />';
echo 'OMG SOMEBODY HELP ME!!';
}
?>
Comment
Comment