Login to protect prototype

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
arpowers
Forum Commoner
Posts: 76
Joined: Sun Oct 14, 2007 10:05 pm
Location: san diego, ca

Login to protect prototype

Post by arpowers »

this might be a newbie question but...

I'm uploading the prototype version of a project I'm working on to our server.. what is the best way to make sure the public can't get access to the page?

Thanks!
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Login to protect prototype

Post by Christopher »

Most webservers will allow you to password protect a directory. What type of webserver is it?
(#10850)
User avatar
arpowers
Forum Commoner
Posts: 76
Joined: Sun Oct 14, 2007 10:05 pm
Location: san diego, ca

Re: Login to protect prototype

Post by arpowers »

I am using apache on a linux machine...
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: Login to protect prototype

Post by Zoxive »

#1 Go to the Directory of the Site

#2 Make the .htpasswd file
Run the following

Code: Select all

htpasswd -bc .htpasswd username password
If you can't ssh to your server, you would be able to make this on any server, and then copy the file over.
OR simply do the following in the .htpasswd file.

Code: Select all

username:XO5UAT7ceqPvc
The Password (After the colon) is the same as the output of the Crypt() command in php.

#3 Create .htaccess File (Same directory)

Code: Select all

AuthType Basic 
AuthUserFile /path/to/the/.htpasswd 
AuthName "Protected Area" 
require valid-user
User avatar
arpowers
Forum Commoner
Posts: 76
Joined: Sun Oct 14, 2007 10:05 pm
Location: san diego, ca

Re: Login to protect prototype

Post by arpowers »

Thanks for the help...!

Guess its time to learn apache!
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Login to protect prototype

Post by VladSun »

Also, if you access it with permanent IP you can add the following lines:

Code: Select all

 
Order Allow,Deny
Allow from Your_IP_Here
Satisfy Any
 
and it won't ask you for password when accessing it from Your_IP_Here :)
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply