Jump to content

Cookie Last Viewed Link


CosminStan
 Share

Recommended Posts

Cookies would only affect the user browsing, simply create a database. When a user views the page record it in the database. Check how many links the user has visited. If it is 5, delete the first record and record the next. Simple

 

Btw, if this is in the third party section, where is the code you're using?

Edited by ExtremeGaming
Link to comment
Share on other sites

Christian, are you serious? You actually can't think of a way in PHP to track what links are clicked on your own website? *eyeroll* I do this on my sites, my Wordpress blog does it for me on my blog, etc etc.

 

OP: Please come back and clarify. 

Link to comment
Share on other sites

Ah, seems I misread you. :-\

Somehow I managed to read "OTHER sites", not "OTHER people". >< Sorry about that.

 

That said the context of your first post is a bit confusing, as the two previous posts give a (rough) outline of how to track the links the users click on while on his site. Think you could be so kind as to explain it a bit further?

Link to comment
Share on other sites

the two previous posts give a (rough) outline of how to track the links the users click on while on his site. Think you could be so kind as to explain it a bit further?

 

Really? No, only one of them does.

 

Cookies would only affect the user browsing, simply create a database. When a user views the page record it in the database. Check how many links the user has visited. If it is 5, delete the first record and record the next. Simple

 

This, except don't delete anything, just store it. We also don't know if the OP wants to record outgoing links as well which would require more work.

 

Just use an array saved in the session, no need to make it more complicated than that.

 

How do you think that would do what I'm describing? It doesn't...

Link to comment
Share on other sites

Could probably have explained it in more detail, but this is what I was thinking of:

<?php 

// Quick example, without any error checking.
$_SESSION['links'] = array (
5 => $_SESSION['links'][4],
4 => $_SESSION['links'][3],
3 => $_SESSION['links'][2],
2 => $_SESSION['links'][1],
1 => $_SERVER['PHP_SELF'],
);

Upon re-reading the OP, I think I might have misunderstood him as well. Guess I was more tired than I thought last night. Again, sorry about that.

Link to comment
Share on other sites

Thanks guys, as i said i do not know anything about cookies or sessions, so i can't explain in more details :)) soryy :(

But thanks @Christian F for this quick intro, ho to solve this problem.

 

I don't need any out goid links, just the ones that the user click on my website to be shown in a recent activity without the user to be logged in.

Edited by CosminStan
Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

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.

 Share

×
×
  • 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.