Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial 新人,怎么知道一个用户访问过该网站两次了呢

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

Jun 23, 2016 pm 01:57 PM
twice Newcomer user website

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


回复讨论(解决方案)

首先用?登入後,把用?的id?入session.
?用???某一??,把?面地址,用?id,????,?入db保存?一???。

要???,根?用?id和?面地址,就能知道??面被?用???了多少次。

首先用?登入後,把用?的id?入session.
?用???某一??,把?面地址,用?id,????,?入db保存?一???。

要???,根?用?id和?面地址,就能知道??面被?用???了多少次。


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


首先用?登入後,把用?的id?入session.
?用???某一??,把?面地址,用?id,????,?入db保存?一???。

要???,根?用?id和?面地址,就能知道??面被?用???了多少次。


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


首先用?登入後,把用?的id?入session.
?用???某一??,把?面地址,用?id,????,?入db保存?一???。

要???,根?用?id和?面地址,就能知道??面被?用???了多少次。


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


首先用?登入後,把用?的id?入session.
?用???某一??,把?面地址,用?id,????,?入db保存?一???。

要???,根?用?id和?面地址,就能知道??面被?用???了多少次。


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

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

关注中 用户没有登陆  如何保存用户的浏览记录 和搜素信息  等到下次用户再来访问的时候 推荐类似的信息给用户查看
有没有做过的 给个思路 就好

google 广告是用用户浏览器数据,ip地址,来确定用户的。

关注中 用户没有登陆  如何保存用户的浏览记录 和搜素信息  等到下次用户再来访问的时候 推荐类似的信息给用户查看
有没有做过的 给个思路 就好



用户第一次登录,根据ip和时间求MD5,把这个哈希值写入cookie,作为用户标识,碰撞几率很小。服务器这边建数据表,以哈希值为主键或索引,把用户的浏览记录序列化存入。


关注中 用户没有登陆  如何保存用户的浏览记录 和搜素信息  等到下次用户再来访问的时候 推荐类似的信息给用户查看
有没有做过的 给个思路 就好



用户第一次登录,根据ip和时间求MD5,把这个哈希值写入cookie,作为用户标识,碰撞几率很小。服务器这边建数据表,以哈希值为主键或索引,把用户的浏览记录序列化存入。

国内的电脑IP都不是固定的  同一台电脑  两次开机IP有可能都不一样  这个用IP分辨 可行不

楼主的要求是针对注册用户的,并以电商为例
那么就应该是维护一张客户信息表,用以记录客户每次进来都看了或买了什么

u013129789 的要求是针对游客的
于是可以只用 cookie 存放一些信息
当然也可以同样维护一张客户信息表,只不过客户都是“游客”而已



关注中 用户没有登陆  如何保存用户的浏览记录 和搜素信息  等到下次用户再来访问的时候 推荐类似的信息给用户查看
有没有做过的 给个思路 就好



用户第一次登录,根据ip和时间求MD5,把这个哈希值写入cookie,作为用户标识,碰撞几率很小。服务器这边建数据表,以哈希值为主键或索引,把用户的浏览记录序列化存入。

国内的电脑IP都不是固定的  同一台电脑  两次开机IP有可能都不一样  这个用IP分辨 可行不

用户得到的这个标识,只跟第一次登陆网站的ip有关,后面都是从cookie读取他的标识了(只要他别清cookie),他带着电脑去火星上网你也能揪出来。事实上你根据什么生成哈希值都可以,关键在于cookie和数据库保存的唯一用户标识要对的上。我说的这些其实只是session功能的小扩展。

像淘宝和百度的广告推送都是用用户来做的
用户一登陆,他就把喜好信息或者标示用户的方法(比如用户名什么的)扔到你的cookie里。
之后即使退出了也会显示,因为cookie还在。
也就是说你没登陆又把cookie清空,他就会显示普遍推送的东西了,因为他没法确定你是谁喜好什么。
不是用ip做的。

楼主的要求是针对注册用户的,并以电商为例
那么就应该是维护一张客户信息表,用以记录客户每次进来都看了或买了什么

u013129789 的要求是针对游客的
于是可以只用 cookie 存放一些信息
当然也可以同样维护一张客户信息表,只不过客户都是“游客”而已



好吧,第一次接触网络,没说明白,实际上我针对的是游客

第一次感到分不够,结贴了

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

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)

How to use Xiaohongshu account to find users? Can I find my mobile phone number? How to use Xiaohongshu account to find users? Can I find my mobile phone number? Mar 22, 2024 am 08:40 AM

With the rapid development of social media, Xiaohongshu has become one of the most popular social platforms. Users can create a Xiaohongshu account to show their personal identity and communicate and interact with other users. If you need to find a user’s Xiaohongshu number, you can follow these simple steps. 1. How to use Xiaohongshu account to find users? 1. Open the Xiaohongshu APP, click the "Discover" button in the lower right corner, and then select the "Notes" option. 2. In the note list, find the note posted by the user you want to find. Click to enter the note details page. 3. On the note details page, click the "Follow" button below the user's avatar to enter the user's personal homepage. 4. In the upper right corner of the user's personal homepage, click the three-dot button and select "Personal Information"

Log in to Ubuntu as superuser Log in to Ubuntu as superuser Mar 20, 2024 am 10:55 AM

In Ubuntu systems, the root user is usually disabled. To activate the root user, you can use the passwd command to set a password and then use the su- command to log in as root. The root user is a user with unrestricted system administrative rights. He has permissions to access and modify files, user management, software installation and removal, and system configuration changes. There are obvious differences between the root user and ordinary users. The root user has the highest authority and broader control rights in the system. The root user can execute important system commands and edit system files, which ordinary users cannot do. In this guide, I'll explore the Ubuntu root user, how to log in as root, and how it differs from a normal user. Notice

Is there any website for learning C language? Is there any website for learning C language? Jan 30, 2024 pm 02:38 PM

Websites for learning C language: 1. C Language Chinese Website; 2. Rookie Tutorial; 3. C Language Forum; 4. C Language Empire; 5. Script House; 6. Tianji.com; 7. Red and Black Alliance; 8, 51 Self-study network; 9. Likou; 10. C Programming. Detailed introduction: 1. C language Chinese website, which is a website dedicated to providing C language learning materials for beginners. It is rich in content, including basic grammar, pointers, arrays, functions, structures and other modules; 2. Rookie tutorials, This is a comprehensive programming learning website and more.

Tutorial: How to delete a normal user account in Ubuntu system? Tutorial: How to delete a normal user account in Ubuntu system? Jan 02, 2024 pm 12:34 PM

Many users have been added to the Ubuntu system. I want to delete the users that are no longer in use. How to delete them? Let’s take a look at the detailed tutorial below. 1. Open the terminal command line and use the userdel command to delete the specified user. Be sure to add the sudo permission command, as shown in the figure below. 2. When deleting, be sure to be in the administrator directory. Ordinary users do not have this permission. , as shown in the figure below 3. After the delete command is executed, how to judge whether it has been truly deleted? Next we use the cat command to open the passwd file, as shown in the figure below 4. We see that the deleted user information is no longer in the passwd file, which proves that the user has been deleted, as shown in the figure below 5. Then we enter the home file

What is sudo and why is it important? What is sudo and why is it important? Feb 21, 2024 pm 07:01 PM

sudo (superuser execution) is a key command in Linux and Unix systems that allows ordinary users to run specific commands with root privileges. The function of sudo is mainly reflected in the following aspects: Providing permission control: sudo achieves strict control over system resources and sensitive operations by authorizing users to temporarily obtain superuser permissions. Ordinary users can only obtain temporary privileges through sudo when needed, and do not need to log in as superuser all the time. Improved security: By using sudo, you can avoid using the root account during routine operations. Using the root account for all operations may lead to unexpected system damage, as any mistaken or careless operation will have full permissions. and

Analysis of user password storage mechanism in Linux system Analysis of user password storage mechanism in Linux system Mar 20, 2024 pm 04:27 PM

Analysis of user password storage mechanism in Linux system In Linux system, the storage of user password is one of the very important security mechanisms. This article will analyze the storage mechanism of user passwords in Linux systems, including the encrypted storage of passwords, the password verification process, and how to securely manage user passwords. At the same time, specific code examples will be used to demonstrate the actual operation process of password storage. 1. Encrypted storage of passwords In Linux systems, user passwords are not stored in the system in plain text, but are encrypted and stored. L

Oracle Database: Can one user have multiple tablespaces? Oracle Database: Can one user have multiple tablespaces? Mar 03, 2024 am 09:24 AM

Oracle database is a commonly used relational database management system, and many users will encounter problems with the use of table spaces. In Oracle database, a user can have multiple table spaces, which can better manage data storage and organization. This article will explore how a user can have multiple table spaces in an Oracle database and provide specific code examples. In Oracle database, table space is a logical structure used to store objects such as tables, indexes, and views. Every database has at least one tablespace,

Why does event bubbling trigger twice? Why does event bubbling trigger twice? Feb 22, 2024 am 09:06 AM

Why does event bubbling trigger twice? Event bubbling (Event Bubbling) means that in the DOM, when an element triggers an event (such as a click event), the event will bubble up from the element to the parent element until it bubbles to the top-level document object. . Event bubbling is part of the DOM event model, which allows developers to bind event listeners to parent elements, so that when child elements trigger events, the events can be captured and processed through the bubbling mechanism. However, sometimes developers encounter events that bubble up and trigger twice.

See all articles