NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Restricting Access With .htaccess

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

Advanced Search
2 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 08-28-2005, 11:32 AM THREAD STARTER               #1 (permalink)
TWM
Web Marketing Specialist
Join Date: Oct 2003
Location: Texas, USA
Posts: 1,335
TWM is a jewel in the roughTWM is a jewel in the roughTWM is a jewel in the rough
 



Restricting Access With .htaccess


How would i go about only letting people have access to a certain area when they arive there from a certain place?

EX:

I have a members only area. You login by filling out a simple script, and its processed in login.php. When you login it directs you to another url... mywebsite.com/membersarea. Nothing is secure, so you could just go to that URL without logging in...noone knows that, but they could figure it out.

I want to use .htaccess so that the only way you can view that directory is if you come FROM mywebsite.com/login.php. Can this be done?
TWM is offline  
Old 08-28-2005, 11:37 AM   #2 (permalink)
Account Suspended
 
vip-ip's Avatar
Join Date: Jan 2005
Location: root@localhost
Posts: 4,011
vip-ip is an unknown quantity at this point
 



Here's a very thorough tut for ya

http://www.technotrade.com/htaccess.html
vip-ip is offline  
Old 08-28-2005, 05:03 PM THREAD STARTER               #3 (permalink)
TWM
Web Marketing Specialist
Join Date: Oct 2003
Location: Texas, USA
Posts: 1,335
TWM is a jewel in the roughTWM is a jewel in the roughTWM is a jewel in the rough
 



Not really what i need... i basically need it to do this:

If a user comes from a certain file, give access. If it comes from ANY other place, restrict access.
TWM is offline  
Old 08-31-2005, 08:15 PM   #4 (permalink)
NamePros Regular
Join Date: Aug 2005
Posts: 214
slantednet is on a distinguished road
 



Using the REFERER of the browser is insecure, people can set the REFERER field, and it's not reliable.

You can do other options, such as within the login script, after a successful login, insert their IP address and username in a "current_connections" table. Pass the username to the members area page when you redirect and very first thing in the members area page verify that the connection for the username is coming from the same IP (hence, they went through the login page successfully). Of course, you'd have to remove them from the "current_connections" table either when they manually log out of the system, and have a method of removing "stale" logins from the system as well...
????: NamePros.com http://www.namepros.com/programming/119357-restricting-access-with-htaccess.html

Then, if they bypass the login script and go right to the members page and they haven't gone through the login script, the members page will see their username/IP pair isn't in the current_connections table and you can redir them back to the login page.

And this keeps it all server-side, which avoids the pitfalls of using cookies...

hmm... that took more time to explain that it would have to just write.. lol..
slantednet is offline  
Closed Thread


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
help restricting access on server bdd Programming 1 05-27-2005 02:07 AM
Chapter 15 Access Logs & Stats WebForging Webmaster Tutorials 1 05-25-2005 06:06 PM
paypal - limited access - me dotcommakers The Break Room 8 04-06-2005 05:53 PM
Hosting and Resellers !BIG SALE! websoft Web Hosting Offers 0 03-21-2005 02:27 AM
Adding FrontPage users and determining their access! priyanka[imported] Web Hosting Discussion 0 12-16-2004 08:14 PM

 
All times are GMT -7. The time now is 12:13 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger