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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file permissions

Status
Not open for further replies.

marc7

Programmer
Oct 4, 2001
35
0
0
US
i have created a script that works in conjunction with the MS IIS search engine and had a question about file permissions pertaining to the search. i am using the LWP module to open pages, examine the content and decide if they should be displayed. i would like to make it so that when one person submits a search that no one else would be able to try and access the file at the same time, or create different threads that the file runs on to prevent a lock up. how would i go about doing this? is there some code i can add at the beginning of the script to ensure that only one person can access the script at a time or to create multiple search threads? any help is appreciated.
 
Off the top of my head, it's fairly simple to do something like the following to make it usable by only one person at a time:

A) Write the file in a directory normally inaccesible by the web browser, and use the script itself to read/print/access the file

B) Have the program create a lock file, that contains the TIME of last access and the IP number accessed from. If too much time elapses, have the program rewrite both files. If the time is current have the CGI script give access only to the same IP.

ALTERNATELY to make it usable by any number of people

A) Write the files in a directory normally inaccesible by the web browser, and use the script itself to read/print/access the file

B) Have the program create a file name based upon the viewer's IP address, and have the program read and report only the file appropriate to the IP address being used to access the script. However, if you go this route, you will want the program to stupidity-check the directory, and delete files that are too old if you start using lots of disk space ("lots" depending on what is acceptible to you).

I hope that this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top