Current location: Hot Scripts Forums » Programming Languages » PHP » 1 ip address only


1 ip address only

Reply
  #1 (permalink)  
Old 11-16-04, 03:57 PM
aemobile aemobile is offline
Newbie Coder
 
Join Date: Nov 2004
Posts: 93
Thanks: 0
Thanked 0 Times in 0 Posts
1 ip address only

is a a script which will allow ony one ip to enter a page??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-16-04, 04:51 PM
Sabu Sabu is offline
Junior Code Guru
 
Join Date: Sep 2004
Posts: 458
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Code:

if ($_SERVER['REMOTE_ADDR'] != "your_ip_address") {

 die (
"You are not allowed here");

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 11-16-04, 06:24 PM
FiRe FiRe is offline
Code Guru
 
Join Date: Oct 2004
Location: UK
Posts: 801
Thanks: 0
Thanked 0 Times in 0 Posts
not 100% sure that will work as you might need double = and no ' in the ip statement and you might want to exit to prevent the page loading anyways!

PHP Code:

<?php


//get user ip
$ip $_SERVER['REMOTE_ADDR'];

//put your ip here
$me "12.345.67.89";

if (
$ip !== $me) {
echo 
"Access Denied! Invalid IP Address";
exit();
}
?>
__________________
Alexa Share <-- Trade virtual shares in websites with this online game.

codR.us <-- Submit and vote for your favorite code snippets with codR.us.

XEWeb.net <-- The ultimate PHP resource network.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Alternative to WhatIsMyIP for IP checking - FlashMyIP.com akaz The Lounge 0 09-19-04 02:27 PM
Substituting an address vpolite94118 PHP 0 09-16-04 02:51 PM
Confused about the from address with php form processor AshleyQuick PHP 0 06-01-04 12:52 PM
Send.Pl script problem BobbyC Perl 1 05-15-04 02:00 PM
IP Address/computer name(i need immediately) bsujin Website Reviews 0 05-10-04 01:00 AM


All times are GMT -5. The time now is 09:50 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.