LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-03-2002, 08:35 AM   #1
nabil
Member
 
Registered: Feb 2001
Location: MI, USA
Distribution: Debian Linux 100% GNU
Posts: 210

Rep: Reputation: 31
restricting http web pages access


How do you restrict http pages access without using .htaccess.
I like to have my http web server to prompt web users for password when accessing any page using local machine regular accounts

Any ideas ??
Thanks
 
Old 03-03-2002, 10:26 AM   #2
Syncrm
Member
 
Registered: Aug 2001
Location: Lansing, Michigan
Distribution: slackware8+
Posts: 472

Rep: Reputation: 30
you can use php. i have a few administration pages that i only want access to, so there's no need for me to use the .htaccess file. here's a simple example of the code:

<?php
if($PHP_AUTH_USER != "username" || $PHP_AUTH_PW != "password")
{
header("WWW-Authenticate: Basic realm=\"your_realm\"");
header("HTTP/1.0 401 Unauthorized");
print "<HTML>\n";
print "<B>Unauthorized user; Access Denied</B>\n";
print "</HTML>\n";
exit;
}
?>

of course, that's real stipped down, and by far not the most secure way of handling it, but it'll work. i use a mysql database with encrypted passwords to verify multiple users using the same code structure. it allows me to update on the fly, and from web based administration pages.

I <3 PHP. :-)
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
fedora core 2 can't open any web pages in http samuelmp Linux - Software 1 04-17-2005 08:08 AM
ADSL Router Web configuration pages appears instead of Personal Web Server Pages procyon Linux - Networking 4 12-20-2004 05:44 PM
Restricting HTTP methods dominant Linux - Software 2 07-26-2004 11:29 AM
Can't access Linux web server web pages from LAN client jaydave Linux - Networking 4 03-16-2003 02:38 AM
I can not access mu sip web pages. Everything else works. dnw Linux - Networking 2 04-28-2002 01:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration