[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 11-01-2005, 02:13 PM   #1 (permalink)
Senior Member
 
commes's Avatar
 
Join Date: May 2005
Location: Regina, Sask, Canada
Posts: 1,323
36.55 NP$ (Donate)

commes is just really nicecommes is just really nicecommes is just really nicecommes is just really nice


need some help with coding sumtin

ok, i'm going to be starting a site soon, but i only want it so that a few ip's will be able to see it, as they are going to be beta testers, so is there a code so that when an ip is not on the list it will go to another page?i need this soon so if you know the code, please post it.thanks!
commes is offline  
Old 11-01-2005, 03:41 PM   #2 (permalink)
Senior Member
 
nasaboy007's Avatar
 
Join Date: Jul 2005
Location: NJ
Posts: 1,112
1,454.30 NP$ (Donate)

nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of


u cud use PHP to get the user's IP address, by having this:

PHP Code:
$ip = getenv(REMOTE_ADDR);
and then use
PHP Code:
$website="HTML CODE OF BETATESTING WEBSITE";
$website2="HTML OF EVERYONE ELSE";
if(
$ip==IPADDRESS1){
echo(
$website);
}
else if(
$ip==IPADDRESS2){
echo(
$website);
}
else{
echo(
$website2);
}
it gets repititious for many users and it may look ugly, but it should work.
nasaboy007 is offline  
Old 11-01-2005, 04:11 PM   #3 (permalink)
Senior Member
 
commes's Avatar
 
Join Date: May 2005
Location: Regina, Sask, Canada
Posts: 1,323
36.55 NP$ (Donate)

commes is just really nicecommes is just really nicecommes is just really nicecommes is just really nice


ok, thanks for the code, will add to your rep
commes is offline  
Old 11-01-2005, 04:45 PM   #4 (permalink)
NPQ's PA, Slave, and On Call Coder

Technical Services


 
Eric's Avatar
 
Join Date: Mar 2005
Posts: 4,545
0.71 NP$ (Donate)

Eric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond repute

Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse
PHP Code:
<?php

$ip
= $_SERVER['REMOTE_ADDR'];

$allowed = array("ip1", "ip2","ip3"); //etc

if(in_array($ip, $allowed))
{
  
//Page for beta testers
}
else
{
  
//Regular site
}
?>
__________________
Eric is offline  
Old 11-01-2005, 05:16 PM   #5 (permalink)
NamePros Regular
 
brewmonkey's Avatar
 
Join Date: Oct 2005
Posts: 240
324.55 NP$ (Donate)

brewmonkey is a jewel in the roughbrewmonkey is a jewel in the roughbrewmonkey is a jewel in the rough


Does this need to be in PHP or can you work with ASP?
brewmonkey is offline  
Old 11-01-2005, 06:42 PM   #6 (permalink)
Senior Member
 
commes's Avatar
 
Join Date: May 2005
Location: Regina, Sask, Canada
Posts: 1,323
36.55 NP$ (Donate)

commes is just really nicecommes is just really nicecommes is just really nicecommes is just really nice


Quote:
Originally Posted by SecondVersion
PHP Code:
<?php

$ip
= $_SERVER['REMOTE_ADDR'];

$allowed = array("ip1", "ip2","ip3"); //etc

if(in_array($ip, $allowed))
{
  
//Page for beta testers
}
else
{
  
//Regular site
}
?>
where in this code would i put the ip's that i want to allow?
commes is offline  
Old 11-01-2005, 07:09 PM   #7 (permalink)
NPQ's PA, Slave, and On Call Coder

Technical Services


 
Eric's Avatar
 
Join Date: Mar 2005
Posts: 4,545
0.71 NP$ (Donate)

Eric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond repute

Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse
Quote:
Originally Posted by commes
where in this code would i put the ip's that i want to allow?
In this line:
PHP Code:
$allowed = array("ip1", "ip2","ip3"); //etc
And replace ip1, ip2, ip3 with IP's you want to allow. More can be added, just seperate with a ,

-Eric
__________________
Eric is offline  
Old 11-01-2005, 07:43 PM   #8 (permalink)
Senior Member
 
commes's Avatar
 
Join Date: May 2005
Location: Regina, Sask, Canada
Posts: 1,323
36.55 NP$ (Donate)

commes is just really nicecommes is just really nicecommes is just really nicecommes is just really nice


oh ok, thanks, ill need this code as soon as i buy the domain for it.
commes is offline  
Old 11-02-2005, 02:23 PM   #9 (permalink)
Senior Member
 
nasaboy007's Avatar
 
Join Date: Jul 2005
Location: NJ
Posts: 1,112
1,454.30 NP$ (Donate)

nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of


@brewmonkey

this code is written for PHP, but I am sure with a few syntax/function changes the same thing can be accomplished in ASP. I'm not sure about what it would be tho, since I have no knowledge of ASP
nasaboy007 is offline  
Closed Thread


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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cheap PSD Slicing and Coding Services GHOwner Web Development Wanted 1 10-04-2005 04:30 PM
Concepts and coding. Miss Wiggle Web Design Reviews 4 09-28-2005 12:15 PM
Small Coding Jobs Fewski Web Development Wanted 4 05-04-2005 05:23 PM
Need Coding Done... resolva Web Development Wanted 3 04-03-2005 10:02 AM
Help with coding a Links Page in PHP/MySQL matt001 Programming 3 04-13-2004 12:57 PM

Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 07:32 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85