Miscellaneous > Programming & Networking

quick php question

<< < (2/2)

voidmain:
You can use:

chmod("/some/dir",0777);

Read my previous post about my error in the mkdir() command.

Also go to www.php.net, they have the ultimate function list.

Stryker:
thanks, fixed that. (sorry i'm a bit new to php), but can I go through a file, specifically a .htpasswd file, and delete a line containing a specific text (the username) using php?

voidmain:
Yes. If the userid is on a line by itself you could read the .htpasswd file and write it to a new file, skipping the line containing the id. If there are other userids on the same line you can use the ereg_replace() function on the line in question something like:

...
$line = ereg_replace("joeblow","",$line);
...

Look on www.php.net for the functions fopen(), ereg_replace(), fread(), fgets(), fclose(). You might want to search google for examples of reading and writing files in PHP.

[ January 18, 2003: Message edited by: void main ]

Navigation

[0] Message Index

[*] Previous page

Go to full version