Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"log in" to write files

Status
Not open for further replies.

spelltwister

Programmer
May 12, 2005
36
0
0
US
I'm not sure if this goes here, but...

Is there a way to add something to my php script that will make it act as though it is the server.

Here's what I mean:

I have a script that generates XML files. I want to have users upload xml to post XML to that script, which I then parse and generate xml with. However, due to permissions, I cannot write the file (I don't wanna open it to all users (777)). Is there a way that my script could be considered the owner?

Also, I'm not really sure about the groups permission. What are groups and how can I use them?

Thanks,

Mike

Online multiplayer strategy games huh? Try, 1483online.com where the games are FREE and the community drives enhancements to the game. ;-D
 
if you have write access but want to restrict the user access then have a look at umask()or chmod().

php will write files using the user credentials of the process under which it is running (typically the apache user: nobody). to change the file owner, use chown()

if you need more a granular approach i'd suggest using the ftp functions from within your script to open up an ftp link under the relevant user credentials and then upload the file to the relevant directory.

 
of course to use chown you need superuser authority.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top