0
I have a system that every time the customer logs in, counts one more visit, and on the first visit a welcome message appears. But if the user reloads the page again or changes tab and goes back to the main page, the welcome message appears again. It only stops appearing if it scrolls down and logs in again, which increases the visitor counter.
I thought to put on the button to close the message a request for the database to consider the message as seen and it does not appear anymore, but I wonder if it can do somehow that the user the message appears and when it changes tab or reloads the page, the message disappears permanently without using the database. It is possible?
What code do you use to determine whether or not the message should be displayed? Is this done on the front end, back end, or both? For now my guess is that you can change the counter of visits immediately after determining that the message should appear, so any subsequent visit does not fall in the message. But if you know the code, you might have a better idea.
– Gabe
Use a SESSION with a unique user value, such as their ID or email. When they log in, you display the message and create the SESSION. After that, put a code that checks if SESSION is active, if it is, it does nothing (does not display the message).
– Sam