TriRan Posted August 16, 2005 CID Share Posted August 16, 2005 php im not sure if you know anything about apache but that doesn't matter basicly what im trying to do is setup a batch file to run a password directory protection agent in apache and then edit the apache httpd.conf to add the req fields to password protect a directory @echo off CLS SET /P UserName=UserName: SET /P Folder=Path: GOTO FOLDERCREATION :FOLDERCREATION ECHO Creating Folder.... SLEEP 3 MKDIR %Folder% GOTO PASS :PASS htpasswd.exe -c ..passwords%UserName% %UserName% GOTO EDITCONF :EDITCONF: ECHO Editing httpd.conf .... SLEEP 5 ECHO. >> ..confhttpd2.conf ECHO <Directory "D:/Website/Apache/htdocs/%Folder%"> >> ..confhttpd2.conf ECHO AuthType Basic >> ..confhttpd2.conf ECHO AuthName "Restricted Files" >> ..confhttpd2.conf ECHO AuthUserFile passwords%UserName% >> ..confhttpd2.conf ECHO Require user %UserName% >> ..confhttpd2.conf ECHO Options Indexes FollowSymLinks +Includes ExecCGI >> ..confhttpd2.conf ECHO AllowOverride All >> ..confhttpd2.conf ECHO Order allow,deny >> ..confhttpd2.conf ECHO Allow from all >> ..confhttpd2.conf ECHO </Directory> >> ..confhttpd2.conf GOTO STOPSTART :STOPSTART %cd%/Apache.exe -k stop -n "Apache2" %cd%/Apache.exe -k start -n "Apache2" pause basicly what happens is once it gets to editing the httpd.conf the window disapears and nothing is added the the http.conf any help here would be great Quote Link to comment Share on other sites More sharing options...
php Posted August 16, 2005 CID Share Posted August 16, 2005 I'll test it out on my server and get back to you in a few... Quote Link to comment Share on other sites More sharing options...
TriRan Posted August 16, 2005 Author CID Share Posted August 16, 2005 k ty NOTE: dont test it on a main httpd.conf it could wipe it out lol i lost one earlier good thing i had a backup Quote Link to comment Share on other sites More sharing options...
php Posted August 16, 2005 CID Share Posted August 16, 2005 lol good to know Quote Link to comment Share on other sites More sharing options...
php Posted August 16, 2005 CID Share Posted August 16, 2005 I know the problems... now I'm trying to fix them... Quote Link to comment Share on other sites More sharing options...
TriRan Posted August 16, 2005 Author CID Share Posted August 16, 2005 ya i had a couple suspicions myself but thanks for the help Quote Link to comment Share on other sites More sharing options...
php Posted August 23, 2005 CID Share Posted August 23, 2005 Currently I don't think there's any way to make it work < and > can't be used in the echo command. although you can echo a file with them in it, the variables don't get processed. maybe this could be made with a PHP script? I've never tried something like that... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.