MyBB Community Forums

Full Version: Restrict to IP
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey everybody,
this is a very special and important Problem that i have!
I wanted a Plugin that restricts a certain Forum to some specific IPs,
so i changed tikitiki's Plugin "restrict to IP"! what i can't understand is that now it's sometimes working and sometimes not!
can someone tell me what i did wrong?
Thank you
Rii
can someone help me with that!

Thanks
I have a question before I offer any help... why do you need to restrict this to specific IPs? Why not just make it restricted to a specific user group, and then give the users you want able to access it this special group as an additional group. This is one of the main purposes of the multi-group system in my opinion. And its a heck of a lot simpler than doing it by IP, not to mention it means those users can have dynamic IP address and/or can access it from any computer.

Now, if you can give me a good reason why you wish to use the restrict by IP I'll gladly offer what help I can.
I've already thought about making specific groups! But it won't help me. I need a Solution with IP adress-restricting (i sent you the reason in a PM)

RII
And amazingly enough, it seems to be a good reason. I didn't really think anyone could come up with one. I'll take a look at the code when I get a chance.
I'm looking at this and wondering why you have this:
if($count == count($restrictedips) and $forum['fid'] == '1')

Is forum 1 the only forum you want it restricted from?

Also you shouldn't be declaring $forum globally here, since you're assigning it and only using that assignment for your function here. If its already a variable you'll screw things up. And you could just use the $fid you already have to check. if($fid in_array(explode(",", $mybb->settings['restricted_forums']))) would be how I checked for it if it was stored in the db and changeable in the Admin CP settings.

Also the logic of the code itself seems a little... shifty. It could be rewritten in about half the lines and work.

Also this code could be simplified a LOT. And allow you to set which forums are restricted in the Admin CP instead of just which IPs. Much better than hard coding which forum(s).

Other than that I don't see anything in a brief look over the code.

If you're interested in it, I'd charge you $5 for a complete from scratch write of this with tested code.
Hey Mybb Team
Hey Dylan,

it has been a while since i asked for this feature, now as things changed, i want to thank you for the great job you did and you´re still doing, special thank also to Dylan who helped me out with the IP-Restriction.
I started using mybb three years ago, it was just a small board for few friends in Germany who love Tunisia! but after a while it becomes the most visited site in Germany when looking for any news or informations from this country! One day we started to report about the politics of Tunisia and i had to make a choice: Support all the lies of this criminal regime or tell the truth and go through the consequences, i chose to tell the truth! I knew that the regime had many informers reading my posts, i also knew they will lock my site in Tunisia, hack it or even send someone to eliminate me! to be honest i was afraid...what will happen to my children if something happens? But that was not the only problem, if they don´t get you they´ll get someone of your family living in Tunisia...
If they eliminate me, well... it´s my own life... but what if they do something to my 60 years old mother...that was common under that regime! They tried to lock my board so it can not be accessed from tunisia, the people there found always a way to access it! they tried to hack it but they couldn´t (thanks mybb)...they tried something else...and then i started to think about restricting IPs to certain forums, that´s why i asked for help, here is the PM i sent to Dylan:
Quote:Why restricting IPs:
I have a good known Board about Tunisia from Germany
, where sometimes users want to talk about politics in that country and about all the repressions there! As i have to put my Name in the Imprint (german law) i'm afraid that the goverment can do something to me or to my Family (they are living in Tunisia)
here is one Example: http://en.wikipedia.org/wiki/Zouhair_Yahyaoui
That's why is restricting by IP the best solution is!

Thanks
RII
That´s why i thought about restricting IPs to politic Forums from Tunisia, any how we had our revolution and we won! And you´ ve been a part of it
Thanks all
Rii