SunQuest
           Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old January 18th, 2001, 09:49 PM
zoro zoro is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Location: Christchurch New Zealand
Posts: 0 zoro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I am running apache for windows and active perl on a win 98 machine.
When I create a restricted directory in the apache httpd.conf file, the browser asks for a user name and password as it should.
I can set up the user names and passwords using htpasswd.exe(an executable that sits in my apache directory) This runs in a Dos shell. This all works nicely.
Now I want to be able to add users to the password file via a html form and a perl script. Ican do this by a number of means but I need to know what function??/module??/?? I use so that Apache recognises the new users and passwords. Is it just htpasswd/ If so how?
I am a relative novice and don't need a super sophisticated solution.I have got more confused the more I read. A simple solution or a point in the right direction would be appreciated.

Reply With Quote
  #2  
Old January 19th, 2001, 02:34 AM
dwarf dwarf is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 300 dwarf User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Well, if you want to tacle some real stuff, I suggest using the perl's builtin crypt() function (perldoc -f crypt from the DOS prompt to see some info about it). As I also recall, there was a thread I started on the sam topic here, so you should try to search for it.

But if you don't want to get this involved then just do the following from your perl script:
Code:
$command = "htpasswd -b path/to/your/password/file";
$username = $FORM{"username}; #Or however do you parse the parameters
$pass = $FORM{"pass"};

if (!system($command,$username,$pass)){
    #everything went OK
}else{
    #something has gone wrong
}


The above will call the htpasswd utility and supply your arguments to it. Since the command has the -b switch it will ask for a password from the command line, so everything will be fine.

Just to warn you, though, this is NOT very secure...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Apache restricted directories


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway