Jump to content

File Lock?


stylusrose

Recommended Posts

I was trying to write a script that outputs to a file. the problem is, I don't want more than one user to be able to run that script at time.

 

I know, mysql would probably be a better idea. But I'm just tinkering around with ideas.

 

So, is there anyway to prevent a user to access a script whilst it is in use?

Link to comment
Share on other sites

you can use mysql and then an if statement like

if($inuse=="yes") {
echo"Sorry the file is currently in use, please try again later";
}
else
{
//DISPLAY DATA HERE
}

 

And then have like a cron job script run to where if the last time it was used was 10 mins ago or so, it clears the mysql, just incase the user exits his/her browser, and have a link to exit, so that way it clears the data.

 

I know it sounds kinda confusing but I haven't been to sleep yet, so hope this helps

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.