Jump to content

Recommended Posts

Sorry maybe I'm not saying it properly.

Basically, I have a list of links to external sites. If the user clicks on a link and then refreshes the page, I want to display an image next to that link that says they have visited it.

I know you can do this in CSS with :visited but I need to apply it to something besides an anchor.

Hope this explains it better.
Link to comment
https://forums.phpfreaks.com/topic/12483-visited-links/#findComment-48157
Share on other sites

You would need a way to track users, that is either through a cookie or through a database. Once that is decided then you can simply create an array in the cookie with the links visited and when the page is loaded it checks that array and adds anchors accordingly. Otherwise if you want to use a database you would have it query for a user and links visited then act accordingly after that. I think both have their advantages; the cookie method is much much easier but also can be undone by deleting cookies. The user method is more complicated but also more permanent.
Link to comment
https://forums.phpfreaks.com/topic/12483-visited-links/#findComment-48162
Share on other sites

[!--quoteo(post=386525:date=Jun 21 2006, 02:31 PM:name=Buyocat)--][div class=\'quotetop\']QUOTE(Buyocat @ Jun 21 2006, 02:31 PM) [snapback]386525[/snapback][/div][div class=\'quotemain\'][!--quotec--]
You would need a way to track users, that is either through a cookie or through a database. Once that is decided then you can simply create an array in the cookie with the links visited and when the page is loaded it checks that array and adds anchors accordingly. Otherwise if you want to use a database you would have it query for a user and links visited then act accordingly after that. I think both have their advantages; the cookie method is much much easier but also can be undone by deleting cookies. The user method is more complicated but also more permanent.
[/quote]
I was hoping there would be an easier way to do that, like a function but I guess that's the only way.

Thanks for the solution!
Link to comment
https://forums.phpfreaks.com/topic/12483-visited-links/#findComment-48211
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.