使用Cookie来跟踪用户
发表日期:2000-12-22
|
Source Code:
<%
'*** Keeping track of how many times
'*** a user visits a web page, by
'*** reading and writing cookies.
'*** In this example "asphole" will be
'*** the name of our cookie, and
'*** "totalvisit" will be the 'key'
'*** value we keep track of. You can
'*** have multiple 'keys' for each
'*** cookie.
'*** Declare your variables
Dim NumVisit
'*** Check to see how many times they
'*** have been to your web page.
NumVisit = Request.Cookies("asphole")("totalvisit")
'*** If this is their first visit to
'*** the page NumVisit is blank, so
'*** make the value of NumVisit 0.
If NumVisit = "" Then
NumVisit = 0
End If
'*** Display how many times they have
'*** visited your web page.
Response.Write "Visits to this page: " & NumVisit
'*** Count the visit to the web page
NumVisit = NumVisit + 1
'*** Write the new total back to
'*** the cookie in their browser
Response.Cookies("asphole")("totalvisit") = NumVisit
'*** Specify when the cookie expires.
'*** If you don't, the cookie will
'*** expire when the user closes their
'*** browser, and you'll lose all info.
Response.Cookies("asphole").Expires = "January 1, 2020"
%>
-END-
|
|
|
|
上一篇:如何从数据库得到一个列表表单
人气:11945
下一篇:用DHTML来模拟实现下拉菜单
人气:11316 |
|
|
网站文章搜索
|
 |
|
邮件订阅服务
|
 |
|
今日更新文章
|
 |
·教你一种新思路调色教程
·使用Lab颜色通道调出照片完美色彩
·PS打造柔美风格色调教程
·教你给宝宝皮肤美白教程
·利用风景图片制作特色明信片
·PS给照片制作蓝天背景
·Photoshop制作沧桑颓废的城市海报
·如何才能出现”添加至百度首页“标志
·没学历 没文凭 没背景 我选择了SEO
·不可小觑的论坛式外链
·SEO的价值并不仅仅体现在搜索引擎上
·Photoshop打造完美江景
|
本栏目推荐文章
|
 |
·快速定位上次VisualBasic程序修改处
·Jar clone的版本冲突
·C# 3.0新特性初步研究 Part6:使用查询表
·java连接池浅谈
·使用ADO批量更新记录(源代码)
·CPP程序--陀螺又称旋转矩阵
·JavaDoc,在 Java 的注释上做文章(下)
·Java理论与实践:再谈Urban性能传言
·[Portal参考手册]目录
·VisualBasicCOM基础讲座之事件
·Java程序员的存储过程
·如何利用VB编写NT服务程序
|