使用PHP跟踪用户在我的网站上的登录/注销时间? [英] Tracking users login/logout times on my site in PHP?

查看:72
本文介绍了使用PHP跟踪用户在我的网站上的登录/注销时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Tracking users login/logout times on my site in php? and maintain day by day login,logout activity time in database using php mysql? I want php coding are any ody suggest me for any tutorials. 





我的尝试:



我已为用户注册特定注册。



What I have tried:

I have registered for particular registration for users.

推荐答案

您可以从 PHP:MySQL数据库 [ ^ ]和 PHP:MySQL函数 - 手册 [ ^ ]



现在,如果你是处理登录和注销,然后您已经知道如何执行上述操作。如果你只是创建网页,你需要(1)学习SQL,这样你就可以(2)有一种检查登录凭证的方法;如果成功,你可以轻松记录登录值。



至于注销,你认为他们会使用注销按钮吗?如果他们这样做,您可以使用它来向MySQL表发送插入或更新查询。但是,当然,他们可能只是更改页面或关闭浏览器。您可以捕获第一个,例如卸载 [ ^ ]事件 - 但如果他们转到您网站上的其他页面,您会怎么做?您需要使用页面(通过会话或URL)进行登录状态。如果他们将您的网页留给另一个网站然后重新连接怎么办?



您可能还想学习 AJAX [ ^ ]



对于本地应用程序,这并不是那么糟糕。有了互联网,你需要考虑很多,因为你(服务器端)失去了对客户端/州的大量(或全部)控制权。
You can start with PHP: MySQL Database[^] and PHP: MySQL Functions - Manual[^]

Now, if you're handling the logins and logouts, then you already know how to do the above. If you're just creating webpages, you need to (1) learn SQL so you can (2) have a method of checking login credential; and you can easily record the login value then, if successful.

As for log-out, do you assume they'll use a logout button or something? If they did, you could use that to send an insert or update query to MySQL table. But, of course,they may just change the page or shut their browser. You can trap the first as, for example, an unload [^] event - but if they go to another page on your site, what do you do? You need to carry their logged-in state around with the pages (by session or in the URL). What if they leave your pages for another site and then reconnect?

You'll likely also want to learn AJAX[^]

With local applications, this wasn't so bad. With the internet, you've a lot to think about as you (server side) lose much (or all) control over the client side/state.


这篇关于使用PHP跟踪用户在我的网站上的登录/注销时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆