Home Backend Development PHP Tutorial 新人,如何知道一个用户访问过该网站两次了呢

新人,如何知道一个用户访问过该网站两次了呢

Jun 13, 2016 am 11:57 AM
cookie google nbsp quote session

新人,怎么知道一个用户访问过该网站两次了呢

本帖最后由 qilinno 于 2014-05-12 19:38:53 编辑 我是一个新人,对这方面没有概念,因此想请教下大家,
怎么知道一个用户两次访问了该网站呢?
还有网上的那些告诉用户的浏览记录是怎么实现的?
总不能是用记录IP地址吧?那又不是固定的.
比如一些贴吧,一些商城,它们就能记录用户的访问记录,而且还能根据用户的记录推荐一些商品,这是怎么做到的呢?
谢谢了!
我不要代码,只是知道怎么做就好了.

------解决方案--------------------
首先用戶登入後,把用戶的id寫入session.
當用戶訪問某一頁時,把頁面地址,用戶id,訪問時間,寫入db保存為一條紀錄。

要統計時,根據用戶id和頁面地址,就能知道該頁面被該用戶訪問了多少次。

------解决方案--------------------
引用:
Quote: 引用:

首先用戶登入後,把用戶的id寫入session.
當用戶訪問某一頁時,把頁面地址,用戶id,訪問時間,寫入db保存為一條紀錄。

要統計時,根據用戶id和頁面地址,就能知道該頁面被該用戶訪問了多少次。

请问用户的ID怎么获取呢?
是不是用户必须登录呢?
我主要是想问问类似Google推荐广告的那种方式是怎么实现的?


引用:
Quote: 引用:

首先用戶登入後,把用戶的id寫入session.
當用戶訪問某一頁時,把頁面地址,用戶id,訪問時間,寫入db保存為一條紀錄。

要統計時,根據用戶id和頁面地址,就能知道該頁面被該用戶訪問了多少次。

请问用户的ID怎么获取呢?
是不是用户必须登录呢?
我主要是想问问类似Google推荐广告的那种方式是怎么实现的?


引用:
Quote: 引用:

首先用戶登入後,把用戶的id寫入session.
當用戶訪問某一頁時,把頁面地址,用戶id,訪問時間,寫入db保存為一條紀錄。

要統計時,根據用戶id和頁面地址,就能知道該頁面被該用戶訪問了多少次。

请问用户的ID怎么获取呢?
是不是用户必须登录呢?
我主要是想问问类似Google推荐广告的那种方式是怎么实现的?


用户ID的获取可以在用户登录进行验证成功后可以把id写入session,
应该是必须登录的 现在有的商城做的猜你喜欢这个功能应该就是用类似的方法做的

------解决方案--------------------
google 广告是用用户浏览器数据,ip地址,来确定用户的。
------解决方案--------------------
引用:
关注中 用户没有登陆  如何保存用户的浏览记录 和搜素信息  等到下次用户再来访问的时候 推荐类似的信息给用户查看
有没有做过的 给个思路 就好


用户第一次登录,根据ip和时间求MD5,把这个哈希值写入cookie,作为用户标识,碰撞几率很小。服务器这边建数据表,以哈希值为主键或索引,把用户的浏览记录序列化存入。
------解决方案--------------------
像淘宝和百度的广告推送都是用用户来做的
用户一登陆,他就把喜好信息或者标示用户的方法(比如用户名什么的)扔到你的cookie里。
之后即使退出了也会显示,因为cookie还在。
也就是说你没登陆又把cookie清空,他就会显示普遍推送的东西了,因为他没法确定你是谁喜好什么。
不是用ip做的。
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Google Pixel 9 and Pixel 9 Pro rumoured to gain Creative Assistant AI upon release Google Pixel 9 and Pixel 9 Pro rumoured to gain Creative Assistant AI upon release Jun 22, 2024 am 10:50 AM

Currently, four new Pixel smartphones are anticipated to land this autumn. To recap, the series is rumoured to feature thePixel 9 and Pixel 9 Pro at launch. However, the Pixel 9 Pro will be a rival to the iPhone 16 Pro rather than a Pixel 8 Pro (curr

Google Pixel 9 Pro XL gets tested with desktop mode Google Pixel 9 Pro XL gets tested with desktop mode Aug 29, 2024 pm 01:09 PM

Google has introduced DisplayPort Alternate Mode with the Pixel 8 series, and it's present on the newly launched Pixel 9 lineup. While it's mainly there to let you mirror the smartphone display with a connected screen, you can also use it for desktop

Google Tensor G4 of Pixel 9 Pro XL lags behind Tensor G2 in Genshin Impact Google Tensor G4 of Pixel 9 Pro XL lags behind Tensor G2 in Genshin Impact Aug 24, 2024 am 06:43 AM

Google recently responded to the performance concerns about the Tensor G4 of the Pixel 9 line. The company said that the SoC wasn't designed to beat benchmarks. Instead, the team focused on making it perform well in the areas where Google wants the c

Google AI announces Gemini 1.5 Pro and Gemma 2 for developers Google AI announces Gemini 1.5 Pro and Gemma 2 for developers Jul 01, 2024 am 07:22 AM

Google AI has started to provide developers with access to extended context windows and cost-saving features, starting with the Gemini 1.5 Pro large language model (LLM). Previously available through a waitlist, the full 2 million token context windo

Google app beta APK teardown reveals new extensions coming to Gemini AI assistant Google app beta APK teardown reveals new extensions coming to Gemini AI assistant Jul 30, 2024 pm 01:06 PM

Google's AI assistant, Gemini, is set to become even more capable, if the APK teardown of the latest update (v15.29.34.29 beta) is to be considered. The tech behemoth's new AI assistant could reportedly get several new extensions. These extensions wi

Google Pixel 9 smartphones will not launch with Android 15 despite seven-year update commitment Google Pixel 9 smartphones will not launch with Android 15 despite seven-year update commitment Aug 01, 2024 pm 02:56 PM

The Pixel 9 series is almost here, having been scheduled for an August 13 release. Based on recent rumours, the Pixel 9, Pixel 9 Pro and Pixel 9 Pro XL will mirror the Pixel 8 and Pixel 8 Pro (curr. $749 on Amazon) by starting with 128 GB of storage.

New Google Pixel desktop mode showcased in fresh video as possible Motorola Ready For and Samsung DeX alternative New Google Pixel desktop mode showcased in fresh video as possible Motorola Ready For and Samsung DeX alternative Aug 08, 2024 pm 03:05 PM

A few months have passed since Android Authority demonstrated a new Android desktop mode that Google had hidden away within Android 14 QPR3 Beta 2.1. Arriving hot on the heels of Google adding DisplayPort Alt Mode support for the Pixel 8 and Pixel 8

Google\'s new Chromecast \'TV Streamer\' rumoured to launch with Ethernet and Thread connectivity Google\'s new Chromecast \'TV Streamer\' rumoured to launch with Ethernet and Thread connectivity Aug 01, 2024 am 10:21 AM

Google is roughly a fortnight away from fully revealing new hardware. As usual, countless sources have leaked details about new Pixel devices, whether that be the Pixel Watch 3, Pixel Buds Pro 2 or Pixel 9 smartphones. It also seems that the company

See all articles