Jump to content

Recommended Posts

 

I have limited experience with php and its been a year or two since I've last used it.  I have a small web application where I want to make sure the data presented on a page (currently an HTML file) is no older than 60 seconds.  The page automatically refreshes every 15 seconds.  I was think about renaming the file by placing the php rename() function at the end of the file.  Will this work or will the script be executed before the page is viewed?  Any other suggestions?

 

Thanks,

 

Ken

Link to comment
https://forums.phpfreaks.com/topic/177588-delete-html-file-after-loading/
Share on other sites

I think you are talking about getting javascript to force the browser to reload/refresh every 15 seconds. Is this correct?

 

What data will you be displaying on the page?

 

A HTML page will hold static data so you will just be reloading the same page.

 

If you had a page (probably php) that searched a database to display current data then this would work. Every time the browser reloaded the page, php would search the database and display current, up-to-date data.

 

Please explain a little more and I can help.

if your "data system" puts new info on the html page every x seconds via php or something, than there is no need to rename the file, or delete it or anything. I'm very confused on how your system works though...

 

However, if your data system makes a new html page with new info, than, if the new page is the same name as the old page, you don't have to do anything either.

 

 

but i have no clue what or how your system does what it does

 

I have a script in my data system that retreives the data in XML format, transforms it, and writes/overwrites an html file.  I need to load php on the web server anyway so I thought I'd see what possibilities it presented.  I'm also thinking about using a script or rule to delete any files in the folder that are older than a minute or so. 

 

The reason behind this is if something in the data system fails the clients won't find the file and it will be obvious something is wrong (404 error).  In this case that's better than displaying inacurate data.

 

Ken

Overwriting works fine.  My concern is if something goes wrong in my data server and it stops overwriting the html file (the filename is always the same for a given client).  The clients will keep refreshing but the data will no longer be up to date.  If the client, or a server side script, always deleted or renamed the html file after it was loaded by the client, the client would not find the file during the next refresh.  This would generate a 404 error and the client would be aware there was a problem with the server.

 

This is not your average web server application.  I'm basically using a web browser to display the current conditions in a process room.  The current conditions reside in my data server and are dumped to the html file.  I'm looking at all points of failure and trying to provide solutions.  The worst thing I could do is display old data.

 

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.