Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[php] n00b user banning

Custom Title Activated
Loyal Member
Joined
Nov 28, 2004
Messages
2,236
Reaction score
0
It's me again.
Well, I am interested in php since this is could bring good perspectives in the future, but I need help from you again since my knowledge is equal to 0.00001 :).

I just want to make a simpe re-direction script witch works by scanning user IPs. If the IP matches in the bann_array the user is linked to yourenotwelcome.php file and if the IP isn't in the list he/she is linked to index2.php.

I know this is quite lame and can stop only noobs, but I just need not to allow some particular noobs enter the site. The experiensed user could just see the system I use and bypass easilly, but as I said this should be 4 noobs only.

So if someone has a spare time and wants to do something - drop me a line here.

{Don't remember that vBulletin messes the code**.

Thanks again.
 

iod

Custom Title Activated
Loyal Member
Joined
Feb 19, 2004
Messages
1,465
Reaction score
2
havent tested but should work, is there reason it has to go to index2?
 

Attachments

You must be registered for see attachments list
Custom Title Activated
Loyal Member
Joined
Feb 27, 2004
Messages
1,378
Reaction score
50
you can also use ... arrays

$ipban_array = array('123.123.123", "321.321.321.321");

then just check with with the php function in_array()
 
Custom Title Activated
Loyal Member
Joined
Nov 28, 2004
Messages
2,236
Reaction score
0
havent tested but should work, is there reason it has to go to index2?
actually it will go to site_base/index.php but it was just an example.
I have changed it to suit my directory and I needed to edit the second line, where was "); i changed to ";.
I have tested it but doesn't matter what is written in banned list I am forwarded to "good" site, not "yourenotwelcome".

okey, I have found something in the internet. attached. this script just stops the generation of the page, does not redirect to other page. But the problem is that this one too does not work for me.
I am behind a router so I have external IP (you can see it, IOD) and internal which is 192.168.101.24. Neither my external IP nor 192.168.101.24 is not blocked.
 

Attachments

You must be registered for see attachments list
Newbie Spellweaver
Joined
Aug 14, 2004
Messages
31
Reaction score
0
Could u tell us what exactly the way is that u want the script to work in detail and also how it is that the examples that uve given dont work as that banned.txt one works as it should.

Small mod to your banned.txt see if this works and is what ure after.
 

Attachments

You must be registered for see attachments list
Custom Title Activated
Loyal Member
Joined
Nov 28, 2004
Messages
2,236
Reaction score
0
Well, these are my IPs, but I am not banned by this script. I am redirected as an unbanned user.
 
Newbie Spellweaver
Joined
Aug 14, 2004
Messages
31
Reaction score
0
Well i might b just guessin but its all in how ure accessing it if u were to access the page on ure webserver from sort of thing it would then be using ure global ip in the $_SERVER['REMOTE_ADDR'] variable but if u were to access ure webserver as localhost or 192.*.*.* basically ure networks ip then that variable would b usin it.

Also make sure that the 2 ip's that ure usin both local and global are correct as ive tested the one that ive uploaded and it works as it should.
 
Custom Title Activated
Loyal Member
Joined
Nov 28, 2004
Messages
2,236
Reaction score
0
vell, vBulleting shows my IP and I don't hesistate so re-write it since I am not the only one under that IP: 212.59.15.222
and I know my LAN IP for sure. It's 192.168.101.24.
 
Newbie Spellweaver
Joined
Aug 14, 2004
Messages
31
Reaction score
0
try this see if u get a different ip, although dont know why u want to ban ureself lol from ure own site lol.
 
Custom Title Activated
Loyal Member
Joined
Nov 28, 2004
Messages
2,236
Reaction score
0
try this see if u get a different ip, although dont know why u want to ban ureself lol from ure own site lol.
hey, I do know how to find my IP out since I am working in networking and I want to ban myself just to see how it works.
 
Newbie Spellweaver
Joined
Aug 14, 2004
Messages
31
Reaction score
0
Well no idea then, if the ip is correct and ive seen the script and it does work then it should block u so no idea now.
 
Banned
Banned
Joined
Jul 5, 2004
Messages
129
Reaction score
0
I cannot see this prefetic tread anymore here you go :
Code:
<?php 

// Other script by hanno
function getip()
    { if(isset($_SERVER['HTTP_CLIENT_IP'])) 
        { 
            $ip = $_SERVER['HTTP_CLIENT_IP']; 
        ** else { 
            if(getenv('HTTP_X_FORWARDED_FOR')) 
            { 
                $ip = getenv('REMOTE_ADDR'); 
                if(preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", getenv('HTTP_X_FORWARDED_FOR'), $ip3)) 
                { 
                    $ip2 = array('/^0\./', '/^127\.0\.0\.1/', '/^192\.168\..*/', '/^172\.16\..*/', '/^10..*/', '/^224..*/', '/^240..*/'); 
                    $ip = preg_replace($ip2, $ip, $ip3[1]); 
                ** 
            ** else { 
                $ip = getenv('REMOTE_ADDR'); 
            ** 
            if($ip == "")    $ip = "x.x.x.x"; 
        ** return $ip;** 
$IPbezoeker = getip(); 
$GebandIPs = array ( 
            "ip" => "because I", 
            "ip2" => "HATE LEXX", 
            ); 
for ($n=0; $n < count($GebandIPs); $n++) { 
     $LosseBans = each ($GebandIPs); 
     $BannedIP = $LosseBans[key]; 
     $RedenIP = $LosseBans[value]; 
if (trim($BannedIP) == trim($IPbezoeker)) { 
                   echo "<center>You are banned because :<br>\n"; 
                   echo "$RedenIP</center>"; 
                   $Klaar = "TRUE"; ****
if ($Klaar != "TRUE") { 
include "some_file_what_you_cannot_guess.php"; 
echo "<center>Website</center>"; 
** 
?>

The ** are **, somehow vbulleting changes it to **

GODDAMN ok ** = (SHIFT + ])
Now dont thank me, cause i dont like you at all lexx.

next point, people cant be banned by network ip, UNLESS the server runs in safe and network mode
 
Last edited:
Back
Top