Jump to content

Archived

This topic is now archived and is closed to further replies.

phileplanet

Visited Links

Recommended Posts

You could probably search through your raw server logs with strpos([i]haystack[/i],[i]needle[/i])

Share this post


Link to post
Share on other sites
It may not be on my site though. Let's say the user visited google.com. Is there anyway I can find out if they did using a function or something?

Share this post


Link to post
Share on other sites
$_SERVER['HTTP_REFERER']

That variable stores the last location the user come from.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
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.

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

×

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.