English 中文(简体)
PHP 日志/日志设计问题
原标题:PHP logon / logoff design question
  • 时间:2009-11-24 11:55:49
  •  标签:
  • php
  • mysql

我正在考虑实施一个小型跟踪系统,跟踪用户日志/日志时间,并跟踪目前挂在册的人。 除了跟踪用户记录何时关闭外,这对我来说都是有意义的。 当用户点击“log”纽吨时,它就很容易做到了,该纽扣机称可以随着时间的推移更新数据库的功能,但是如果用户只是从浏览器中撤出的话。 我怎么能够发挥职能,处理这一事件,我猜测我所想象的用户何时以非正式方式离开加拿大。 此外,将非常赞赏与网上教员有关的任何联系。

问题回答

最简单的解决办法或许是,在用户网站(即每当服务器上产生一个网页)上采取行动时,就把用户标记为“主动”。

如果用户被贴上“活跃”的一段很长的(例如,超过5分钟;可能更取决于您在网站上拥有的那种内容)之前,你可以认为他不再活跃——实际上甚至可能不会在你网站上。

当然,在发现用户之前,你有几分钟的延误时间。


A possible complementary solution would be to use some kind of Ajax request done once every one or two minutes : this way, you have a shorter delay before detecting a user is not here anymore...

但是,根据这一解决办法:如果用户在你的网站上打开浏览器窗/标本,即使他没有真正使用(<>>)。 我总是在我的火ox中开着许多tab子,有些在网站上,我实际上没有花数小时!)

您可在窗口卸载活动上使用Javascript,或自动在30分钟的不活动之后,只使用 log。

当用户关闭浏览器或贵页时,你就能够跟踪。

我试图询问跟踪用户关闭网页的情况:。 AJAX - 当用户离开网页时——良好做法或不良做法/执行?

很显然,发送<代码>>上的数据并不好。

您可以做的是,考虑在某些时间的不活动之后将用户拖拉。

每当用户上页时,都会储存时间。 据说,如果时间长度超过5分钟,用户就会离线。 你们可以把时间储存到数据库或会议。

或者,如果你希望更准确的话,你可以每隔一段时间(约30秒)将日本宇宙航空研究开发机构召回服务器,延长你的活动时间。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...