Go Back   Gaming Gutter > Non-Gaming > Programming > Source Code


Source Code - Have a source code/project files you want to post? Do so here.

» Site Navigation
» Home
» FAQ
» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Advertisement
» GG Stuff

Follow us on Twitter!

Get the GG toolbar today (for firefox only)
» Recent Threads
Free XBox 360 Avatar...
Today 01:32 PM
by Coby
Last post by Coby
Today 01:32 PM
0 Replies, 1 Views
Go to first new post Got iced after logging...
02-16-2010 12:15 AM
by Fury
Last post by Avatar
Today 01:31 PM
24 Replies, 556 Views
Go to first new post The Official Neopets...
03-10-2010 05:05 PM
by Boink
Last post by Avatar
Today 01:26 PM
14 Replies, 202 Views
Go to first new post Hash Listing @ Its Best!
02-08-2010 09:54 PM
Last post by Avatar
Today 01:26 PM
46 Replies, 1,016 Views
Go to first new post ~ The Official Hash...
11-06-2009 11:56 AM
by mehike
Last post by Kiotrama
Today 01:25 PM
875 Replies, 19,687 Views
Reply
 
LinkBack Thread Tools Display Modes

 [PHP]IP Allowing
Old 12-30-2008, 08:49 AM   #1 (permalink)
Full Member

Male Snarf is offline
 
Snarf's Avatar
 
Join Date: Dec 2008
Location: In a fun, dark, and warm place.
Posts: 480
GPoints: 7,568
iTrader: 0 / 0%
Snarf Is Recognizable
Rep Power: 4
[PHP]IP Allowing

This is a simple code I made, it just checks if your IP is in the list of allowed IPs.

PHP Code:
<?
$allow
[0]="0.0.0.0"
if (
in_array($_SERVER['REMOTE_ADDR'],$allow)) 

echo 
"Welcome" ;
}
else echo 
"You are not authorized to view this page."
?>
Replace 0.0.0.0 with the allowed IP.
  Reply With Quote

 
Old 12-30-2008, 09:19 AM   #2 (permalink)
Full Member

Male iceydefeat is offline
 
iceydefeat's Avatar
 
Join Date: Dec 2008
Location: Maryland
Age: 20
Posts: 911
GPoints: 12,210
iTrader: 6 / 100%
iceydefeat Is a Party Captainiceydefeat Is a Party Captainiceydefeat Is a Party Captain
Rep Power: 8
Awesome! Except, this is a source code not a tutorial sorry
  Reply With Quote

 
Old 12-30-2008, 09:20 AM   #3 (permalink)
G3
I don't never troll

G3 is online now
 
G3's Avatar
 
Join Date: Jun 2009
Location: live? wut.
Posts: 6,912
GPoints: 16,708
iTrader: 0 / 0%
G3 Is MANLYYYYYYYG3 Is MANLYYYYYYYG3 Is MANLYYYYYYYG3 Is MANLYYYYYYYG3 Is MANLYYYYYYYG3 Is MANLYYYYYYYG3 Is MANLYYYYYYYG3 Is MANLYYYYYYYG3 Is MANLYYYYYYYG3 Is MANLYYYYYYY
Rep Power: 30
I was thinking the same thing >>
  Reply With Quote

 
Old 12-30-2008, 09:39 AM   #4 (permalink)
Full Member

Male Snarf is offline
 
Snarf's Avatar
 
Join Date: Dec 2008
Location: In a fun, dark, and warm place.
Posts: 480
GPoints: 7,568
iTrader: 0 / 0%
Snarf Is Recognizable
Rep Power: 4
Oh. Well can you move it?

EDIT: Just realized you already moved /facepalm.

EDIT #2: If you want more allowed IPs, use this code:
PHP Code:
<? 
$allow
[0]="0.0.0.0";  
$allow[1]="0.0.0.0";
$allow[2]="0.0.0.0";
$allow[3]="0.0.0.0";
if (
in_array($_SERVER['REMOTE_ADDR'],$allow))  
{  
echo 
"Welcome" 

else echo 
"You are not authorized to view this page." 
?>

Last edited by Snarf; 12-30-2008 at 09:46 AM..
  Reply With Quote

 
Old 12-30-2008, 10:28 AM   #5 (permalink)
Banned

Male Checker is offline
 
Join Date: Feb 2008
Posts: 2,646
GPoints: 1,623
iTrader: 8 / 100%
Checker - Total CelebrityChecker - Total CelebrityChecker - Total CelebrityChecker - Total CelebrityChecker - Total CelebrityChecker - Total Celebrity
Rep Power: 0
Just edit that into your first post.
  Reply With Quote

 
Old 01-01-2009, 09:00 AM   #6 (permalink)
Donor

Male ricky92 is offline
 
ricky92's Avatar
 
Join Date: Mar 2008
Location: Naples, Italy
Age: 17
Posts: 470
GPoints: 13,176
iTrader: 42 / 100%
ricky92 Is a Lord of Awesomenessricky92 Is a Lord of Awesomenessricky92 Is a Lord of Awesomeness
Rep Power: 9
A much easier way is to have a file which will have all the allowed IPs in (one per line). Say, for example, that the file is called "ipsallowed.txt", the code would be rather easy:
PHP Code:
<?php
if (preg_match('/^'.preg_quote($_SERVER['REMOTE_ADDR']).'$/m', @file_get_contents('ipsallowed.txt')))
{
    echo 
'Allowed';
}
else
{
    echo 
'Not allowed';
}
?>
  Reply With Quote

 
Old 01-06-2009, 12:25 AM   #7 (permalink)
G3
I don't never troll

G3 is online now
 
G3's Avatar
 
Join Date: Jun 2009
Location: live? wut.
Posts: 6,912
GPoints: 16,708
iTrader: 0 / 0%
G3 Is MANLYYYYYYYG3 Is MANLYYYYYYYG3 Is MANLYYYYYYYG3 Is MANLYYYYYYYG3 Is MANLYYYYYYYG3 Is MANLYYYYYYYG3 Is MANLYYYYYYYG3 Is MANLYYYYYYYG3 Is MANLYYYYYYYG3 Is MANLYYYYYYY
Rep Power: 30
PHP Code:
if(in_array($ip,explode(",",$bannedIps))){ die("MOAR LIKE BANNED. AMIRIGHT?!");} 
$bannedIps is the string with IPs separated by a comma.
  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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Powered by vBadvanced CMPS v3.1.0

All times are GMT -7. The time now is 01:41 PM.


vBulletin skin developed by: eXtremepixels
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The contents of this webpage are copyright © 2006-2008 GamingGutter.com. All Rights Reserved.

Page generated in 0.28218508 seconds (100.00% PHP - 0% MySQL) with 21 queries