How can I display web browsing records? _ PHP Tutorial

Source: Internet
Author: User
How can I display web browsing records ?. How can I display web browsing records? The answer is, for example, "Xunlei", "viewing history" and "clicking history" on some news websites. Is there any such case? Could you tell me how to display web browsing records?
Answer
For example, Xunlei looks at the historical views on the edge and some historical clicks on news websites. Is there any such case? Thank you.


Other solutions
Save the url and page title to cookies or sessions.
Other solutions
Write down with pen and book ....
Other solutions
Find a function implemented using JS and COOKIE on the Internet, but do not quite understand function glog (evt) // defines the function for recording the mouse click action

{

Evt = evt? Evt: window. event; var srcelemem(evt.tar get )? Evt.tar get: evt. srcElement;

Try

{

While (srcElem. parentNode & srcElem! = SrcElem. parentNode)

// Use the preceding statement to determine whether the mouse action is in the valid area and prevent invalid clicks from being recorded.

{

If (srcElem. tagName & srcElem. tagName. toUpperCase () = "A") // you can determine whether the object you click belongs to A link.

{

Linkname = srcElem. innerHTML; // Retrieve the name of the event source, that is, the text between the two, that is, the link name.

Address = srcElem. href + "_ www.achome.cn _"; // Retrieve the href value of the event source, that is, the link address.

Wlink = linkname + "+" + address; // integrate the link name and link address into a variable.

Old_info = getCookie ("history_info"); // retrieves the browsing history recorded previously from Cookies. This function is declared later.

// The following program starts to judge whether the new browsing action is duplicate with the previous six historical ones. if not, the cookies are written.

Var insert = true;

If (old_info = null) // checks whether the cookie is null.

{

Insert = true;

}

Else

{

Var old_link = old_info.split ("_ www.achome.cn _");

For (var j = 0; j <= 5; j ++)

{

If (old_link [j]. indexOf (linkname )! =-1)

Insert = false;

If (old_link [j] = "null ")

Break;

}

}



If (insert)

{

Wlink + = getCookie ("history_info ");

SetCookie ("history_info", wlink); // write cookie, which is declared later

History_show (). reload ();

Break;

}



}

SrcElem = srcElem. parentNode;

}

}

Catch (e ){}

Return true;

}

Function getCookieVal (offset ){

Var endstr = document. cookie. indexOf (";", offset );

If (endstr =-1) endstr = document. cookie. length;

Return unescape (document. cookie. substring (offset, endstr ));

}



Function getCookie (name ){

Var arg = name + "= ";

Var alen = arg. length;

Var clen = document. cookie. length;

Var I = 0;

While (I <clen ){

Var j = I + alen;

If (document. cookie. substring (I, j) = arg) return getCookieVal (j );

I = document. cookie. indexOf ("", I) + 1;

If (I = 0) break;

}

Return null;

}



// Write browsing actions into cookies

Function setCookie (name, value ){

Var exp = new Date ();

Exp. setTime (exp. getTime () + 3600000000 );

Document. cookie = name + "=" + value + "; expires =" + exp. toGMTString ();

}

Function history_show ()

{

Var history_info = getCookie ("history_info"); // Retrieve the historical records in the cookie.

Var content = ""; // defines a display variable

If (history_info! = Null)

{

History_arg = history_info.split ("_ www.achome.cn _");

Var I;

For (I = 0; I <= 5; I ++)

{

If (history_arg [I]! = "Null ")

{

Var wlink = history_arg [I]. split ("+ ");

Content + = ("plaintext" + "" + wlink [0] +"
");

}

Document. getElementById ("history"). innerHTML = content;

}

}

Else

{Document. getElementById ("history"). innerHTML = "Sorry, you have no browsing history ";}

} [/I] [/I]



Other solutions
Marking this is useful to me.
Other solutions
Write down with pen and book ....
Yu An published on [url = http://bbs.phpchina.com/redirect.php? Goto = findpost & pid = 459164 & ptid = 64656] link Mark [img] http://bbs.phpchina.com/images/common/back.gif?/img=#/url]
A good solution that has been tried and tested!
Other solutions
Damn it, now I know it's an ancient corpse...

Why? The answer is, for example, "Xunlei", "viewing history" and "clicking history" on some news websites. Is there any such case? Please advise ,...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.