i'm trying to write a php script that will password protect some
random directory by creating a .htaccess file, and a password file to
accompany the .htaccess file, and it isn't working... specifically, i
can't enter the newly created directory with a username of test, and a
password of test, which is what i am trying to do.
also, i'm testing this script out on a remote server, and... after
this script runs, i can't delete any of the files it produces...
specifically, i get this error:
rm: cannot unlink `.htaccess': Permission denied
i was told that the problem was that the owner of the file was
incorrect, but... i've made other scripts that create files, and
haven't had any problems deleting those files... so why would i have
a problem deleting these files?
any help would be appreciated! here's the script:
<?
$user = "test";
$pass = "test";
system("mkdir tester");
$filename = "./tester/.htaccess";
$fp = fopen($filename , "w");
fputs($fp,"Auth UserFile ./tester/.tester\n");
fputs($fp,"Auth GroupFile /dev/null\n");
fputs($fp,"Auth Name EnterPassword\n ");
fputs($fp,"Auth Type Basic\n\n");
fputs($fp,"requ ire user wsabstract");
fclose($fp);
$filename = "./tester/.tester";
$fp = fopen($filename , "w");
fputs($fp,$user . ":" . crypt($pass,sub str($pass,0,2)) );
fclose($fp);
?>
random directory by creating a .htaccess file, and a password file to
accompany the .htaccess file, and it isn't working... specifically, i
can't enter the newly created directory with a username of test, and a
password of test, which is what i am trying to do.
also, i'm testing this script out on a remote server, and... after
this script runs, i can't delete any of the files it produces...
specifically, i get this error:
rm: cannot unlink `.htaccess': Permission denied
i was told that the problem was that the owner of the file was
incorrect, but... i've made other scripts that create files, and
haven't had any problems deleting those files... so why would i have
a problem deleting these files?
any help would be appreciated! here's the script:
<?
$user = "test";
$pass = "test";
system("mkdir tester");
$filename = "./tester/.htaccess";
$fp = fopen($filename , "w");
fputs($fp,"Auth UserFile ./tester/.tester\n");
fputs($fp,"Auth GroupFile /dev/null\n");
fputs($fp,"Auth Name EnterPassword\n ");
fputs($fp,"Auth Type Basic\n\n");
fputs($fp,"requ ire user wsabstract");
fclose($fp);
$filename = "./tester/.tester";
$fp = fopen($filename , "w");
fputs($fp,$user . ":" . crypt($pass,sub str($pass,0,2)) );
fclose($fp);
?>
Comment