Tramposch 1 Report post Posted January 13, 2008 Ok, you know IP address banning on websites, right?Well i want kind of a reverse effect of that.Can i make a required IP adress to access a website?like say i want three people to access a website.Person1:IP address= 72.106.xxxxxxxxxxxxxxxxPerson 2:IP adress= another ip addressPerson 3:Ip address= ect...So i want only those three people to access my website, and ban all other IP's (not we an IP list, but just like.... if an IP isnt applicable in the list, or something like that)Do you understand me?Is there a script that can do this? is there a name for this? like IP restricting, or something. Share this post Link to post Share on other sites
kobra500 1 Report post Posted January 13, 2008 (edited) spend days typing out every possible ip except some lol... i'm sure there is a script... couldn't you have a set username and only give it to people who you wan't?edited after below post:- I'm suprised you didn't google it anyway I thought the script would be alot longer thats suprisingly simple Edited January 13, 2008 by kobra500 (see edit history) Share this post Link to post Share on other sites
Tramposch 1 Report post Posted January 13, 2008 but then if they choose to remember password, i dont wannt that, i want this very, very secure.. Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted January 13, 2008 <Limit GET POST>order deny,allowdeny from allallow from 199.166.210.allow from XXX.XXX.XXX.XXXallow from Xisto.com </Limit> The line "order deny,allow" says the restrictions are in the order to deny first followed by allow criteria.The line "deny from all" says to Deny all IP's and Domains.The line "allow from 199.166.210." says to allow IP's starting with these numbers.List each allowed IP on its own line.The line "allow from XXX.XXX.XXX.XXX" where XXX is an integer between 0 and 255 representing the allowed IP #.Your can truncate the list, but only in order from first triplet to the last.List each allowed Domain on its own line.The line "allow from Xisto.com" where this is an allowed Domain Name.Found this on the net using Google "htaccess IP allow".Excerpted from http://home.golden.net/htaccess.html Share this post Link to post Share on other sites
Imtay22 0 Report post Posted January 13, 2008 The only thing Jim forgot to mention is that you put that in your .htaccess file. If you don't have one, just create a file called .htaccess in the directory you want to be blocked. Share this post Link to post Share on other sites
Tramposch 1 Report post Posted January 13, 2008 Ah thanks, i was thinking of the htaccess.. also the only reason i couldnt find anything was.. i didnt know what termonology to use in google. but i guess this isnt really PHP lol Share this post Link to post Share on other sites
gogoily 0 Report post Posted January 14, 2008 You can make it without .htaccessTry this code: $ip = $_SERVER['REMOTE_ADDR'];if($ip != YourIP1 && $ip != YourIP2 && $ip != YourIP3) die("You're not welcome here."); Share this post Link to post Share on other sites
coolcat50 0 Report post Posted January 15, 2008 Well, you can use MySQL and the PHP global variable $_SERVER['REMOTE_ADDR'] which will give you IP addresses. You can create a database containing allowed IP address and run a MySQL check to make sure the IP address is correct. You can also use this to log the database with that visitor visiting your site. Share this post Link to post Share on other sites
hitmanblood 0 Report post Posted January 15, 2008 Well this topic already has two solutions and both are valid and probably for beginners the second one is better then the first one because many people are trying to avoid tempering with htaccess files. Also another thing I would like to note is that you do not require any mysql ddatabases this might in fact prove to be nsecure the best way if you need only three codes that is ip addresses is to write and use small script above it is very simple and usuful however I would like to add something to it. I hope gogoily will not be angry. <?$ip = $_SERVER['REMOTE_ADDR'];if($ip != YourIP1 && $ip != YourIP2 && $ip != YourIP3){ die("You're not welcome here.");}else{?>you may now write your code of the page you would like to provide to these guys in here<?}?> Share this post Link to post Share on other sites
galexcd 0 Report post Posted January 16, 2008 Well this topic already has two solutions and both are valid and probably for beginners the second one is better then the first one because many people are trying to avoid tempering with htaccess files. Also another thing I would like to note is that you do not require any mysql ddatabases this might in fact prove to be nsecure the best way if you need only three codes that is ip addresses is to write and use small script above it is very simple and usuful however I would like to add something to it. I hope gogoily will not be angry. <?$ip = $_SERVER['REMOTE_ADDR'];if($ip != YourIP1 && $ip != YourIP2 && $ip != YourIP3){ die("You're not welcome here.");}else{?>you may now write your code of the page you would like to provide to these guys in here<?}?> Once again I shall rain on sombody's over-codyness... You do not need that else statement. The die function will terminate the rest of the code outputed on the page. If you really want to do this in php and not through htaccess all you would need is the if and the die. Share this post Link to post Share on other sites