function to execute background process only once and refresh the page
Posted on 2010-11-21
I have a link page that is only available when the user login to the system, I want to execute a php function only once if the user have not press that link.
If the link is pressed the background process generates a key and insert some values in a database then refresh the page and let the user view the results.
Scenario: a link have not been click
User login in the system;
- there is a list of links
- a link is available it says Run Me (the user have not pressed the link before)
- after pressing the link the page is refresh and the link is now label View Me
Scenario: a link was clicked in a previous session
User login in the system
-there is a list of links
- the link the user pressed in a previous session display View Me
What I would like is the PHP code to make sure when a specific link is pressed once, the option to Run Me is not longer available the user only can see the View Me label.
The goal is to toogle between the options of Run Me and View Me, making sure Run Me is only available if the user never clicked that link before. The link has id available and other values from the database.
thanks for your help!