Hello! I need help about how can i do my content show just first time, when i click secocond time in that page have a blank page ,and latter appeard that after 1 hour, how can i do whith php code ?Can somebody help me please about it?
Thank you in advance.

So let me get this, you've written a HTML page with PHP inserting some content into it, and when you refresh the page it won't display?

Would love to help but I cannot quite see where you are coming from...

Member Avatar

diafol

So

  1. first load: show content
  2. reload: do not show data
  3. next reloads: do not show data until 1 hour passed since first load

Is that right?

You could set a time in a session variable or a cookie and check to see if it is set or if it exists - if so - check the time held - if less than 1 hour ago, don't show, if more than 1 hour, show the content and reset the variable / cookie.

BUT - this can be killed off if the session times out or the user eats the cookie. So this approach is probably not so suitable.

If the user has to be logged in to use this page, then you now have more power to enforce your limitations. Use a DB to store the 'last first load' time in a table along with the user_id. So on every page load, php checks the DB value (if it exists) and acts accordingly.

Yes Right like you say

  first load: show content
reload: do not show data
next reloads: do not show data until 1 hour passed since first load

But this file is not colegated with some db is a statik page with some code intoo.
Thank you for respond.

Member Avatar

diafol

OK, in that case use a cookie, but be aware the user could circumvent this method by deleting the cookie. If your process is cosmetic rather than critical, then it won't matter.