Jump to content
Sign in to follow this  
TriRan

php Help Me

Recommended Posts

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

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...