qt 操纵access
If you implement any sort of hit monitoring or tracking on your Website, you probably don’t want to include any of your own hits. I check each of my sites on a daily basis to ensure they’re all up and running and that no weird errors have occurred. However, this seriously skews the site tracking I use.
如果您在网站上实施了任何类型的匹配监控或跟踪,则可能不想包含任何自己的匹配。 我每天检查我的每个站点,以确保它们都已启动并正在运行,并且没有发生任何奇怪的错误。 但是,这严重扭曲了我使用的网站跟踪。
Ordinarily, you could set a "self-specific" cookie. Then, when the tracking script was called, you could simply check to see if that cookie existed, and, if it did, exit the tracking script.
通常,您可以设置一个“特定于自己的” cookie。 然后,在调用跟踪脚本时,您可以简单地检查该cookie是否存在,如果存在,则退出跟踪脚本。
However, if, like me, you’re frankly scared of cookies on the grounds that they:
但是,如果像我一样,您坦白地害怕cookie的理由是:
are difficult to test with, 很难测试, are called something silly and 被称为傻事 aren’t 100% reliable 不是100%可靠…and you aren’t fortunate enough to have a static IP address on your Internet connection, you may prefer the alternative method we’re about to discuss.
…而且您没有足够的幸运在Internet连接上拥有一个静态IP地址,您可能更喜欢我们将要讨论的替代方法。
Furthermore, many Webmasters exclude from tracking certain browsers that are known not to work on their Websites. For example, many sites block any non-Internet Explorer or Netscape browsers, such as Mozilla’s excellent new Firebird and a whole heap of others. Being able to manipulate the user agent to fool the Website into thinking we’re using Internet Explorer 6.0 when we’re really running Firebird 0.7 could be quite handy!
此外,许多网站管理员无法跟踪某些已知无法在其网站上运行的浏览器。 例如,许多站点阻止了任何非Internet Explorer或Netscape浏览器,例如Mozilla出色的新Firebird以及其他许多浏览器。 当我们真正运行Firebird 0.7时,能够操纵用户代理欺骗网站,以为我们正在使用Internet Explorer 6.0可能很方便!
Every browser identifies itself via something called the "user agent". Put simply, this is nothing more than a string of characters containing various bits of info. A typical user agent might look like this:
每个浏览器都通过称为“用户代理”的方式标识自己。 简而言之,这不过是包含各种信息位的字符串。 典型的用户代理可能如下所示:
Mozilla 4.0(compatible, MSIE6.0; Win NT 5.1)This tells us that the browser is based on Mozilla 4.0 (the majority of browsers are based on Mozilla), is Internet Explorer 6, and also, that the computer is Windows NT 5.1 (a.k.a. Windows XP). A similar user agent for Mozilla’s Firebird browser could look like this:
这告诉我们该浏览器基于Mozilla 4.0(大多数浏览器基于Mozilla),Internet Explorer 6,并且该计算机是Windows NT 5.1(aka Windows XP)。 Mozilla的Firebird浏览器的类似用户代理可能如下所示:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007 Firebird/0.7This information is always available to the server from the browser. We can access these details using a simple bit of PHP:
服务器始终可以从浏览器获得此信息。 我们可以使用简单PHP来访问这些详细信息:
$agent=$_SERVER["HTTP_USER_AGENT"];Or, in ASP:
或者,在ASP中:
sUserAgent= Request.ServerVariables("HTTP_USER_AGENT")I prefer using a server-side language for this task over, for example, Javascript, as Javascript can be turned off by the user, which can potentially cause the whole script to fail. For more information on language specific implementations, read the relevant manual or ask at the SitePoint Forums.
我喜欢使用服务器端语言来完成此任务,而不是使用Java语言,例如Java,因为用户可以关闭Java语言,这有可能导致整个脚本失败。 有关特定语言实现的更多信息,请阅读相关手册或在SitePoint论坛上提问。
The process by which we can manipulate the user agent is browser- and operating system-specific. I’ll describe the process for the more common browsers on a Windows XP system. The methods will be virtually identical for other Windows-based systems, and reasonably simple on Linux or Mac machines.
我们操作用户代理的过程是特定于浏览器和操作系统的。 我将描述Windows XP系统上更常见的浏览器的过程。 这些方法对于其他基于Windows的系统几乎相同,并且在Linux或Mac机器上相当简单。
First of all, we need to decide on what we’re going to change the User Agent to. All we need to do is append to the existing user agent some sort of unique string with which we can identify ourselves. Pick something really unique, that’s not particularly sensitive (i.e. not a word you use as a password, for example). I’m going to use "weirdbeardmt" — my user ID on SitePoint Forums.
首先,我们需要决定将用户代理更改为什么。 我们需要做的就是将一些独特的字符串添加到现有的用户代理中,我们可以使用它们来标识自己。 选择真正独特的东西,它并不是特别敏感(例如,不是用作密码的单词)。 我将使用“ weirdbeardmt”(我在SitePoint论坛上的用户ID)。
Mozilla and Mozilla Firebird
Mozilla和Mozilla Firebird
Fortunately, some kind person has already written an extension to build this functionality directly into Mozilla and Mozilla Firebird. It can be downloaded here.
幸运的是,某个好心的人已经编写了扩展程序,可以直接在Mozilla和Mozilla Firebird中构建此功能。 可以在这里下载。
The extension installs a menu item that allows you to add a custom user agent and do on the fly switching. This is also ideal for testing (and supremely easy if you need to change your user agent to gain access to a blocked Website). For testing, you’ll want to use a custom user agent. Your updated user agent will end up looking something like this:
该扩展程序安装了一个菜单项,该菜单项允许您添加自定义用户代理并即时切换。 这也是测试的理想选择(如果您需要更改用户代理以访问被阻止的网站,此操作极其简单)。 为了进行测试,您需要使用自定义用户代理。 您更新的用户代理最终将看起来像这样:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007 Firebird/0.7 StumbleUpon/1.901 weirdbeardmtIn case that extension is mysteriously unavailable, all this does is alter the prefs.js file found within the working directory of Mozilla. A quick search for "Agent" should hunt it out for you.
万一该扩展名神秘地不可用,所有这些操作就是更改Mozilla工作目录中的prefs.js文件。 快速搜索“代理”应为您寻找它。
Internet Explorer
IE浏览器
Unfortunately, modifying the user agent in IE needs to be a registry hack! If you’re not used to playing with the registry, then it’s advisable that you don’t proceed further with this example, or, at least, that you make a backup before you start. Navigate to:
不幸的是,在IE中修改用户代理必须是注册表黑客! 如果您不习惯使用注册表,那么建议您不要继续进行此示例操作,或者至少在开始之前进行备份。 导航:
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settings
HKEY_CURRENT_USER软件MicrosoftWindowsCurrentVersionInternet设置
Look for the user agent string, and double click the name to adjust it. If you’re using a custom Internet Explorer "skin", such as Netcaptor, then it is also possible to add to your user agent by going to:
查找用户代理字符串,然后双击名称进行调整。 如果您使用的是自定义Internet Explorer“外观”,例如Netcaptor,则还可以通过以下步骤将其添加到用户代理中:
HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInternet Settingsuser agentPost Platform
HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInternet设置用户代理发布平台
You can then add a new string there. Your new user agent will look something like this:
然后,您可以在此处添加新字符串。 您的新用户代理将如下所示:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Netcaptor 7.2.1; weirdbeardmt)Opera 6/7
歌剧6/7
The functionality to switch user agents is built into Opera (File > Preferences > Network), but Opera doesn’t allow custom agents to be specified. Unfortunately, there is no way around this (as I am assured by the CTO of Opera!).
切换用户代理的功能内置于Opera(文件>首选项>网络)中,但是Opera不允许指定自定义代理。 不幸的是,没有办法解决这个问题(正如Opera的CTO向我保证的那样!)。
Now that we have our new custom user agent, how are we going to use it? Well, all we really need to do is search for the existence of the identifier (weirdbeardmt) in the user agent. So, to my tracker script, which is included on every page of each of my Websites, I simply add the following:
现在我们有了新的自定义用户代理,我们将如何使用它? 好吧,我们真正需要做的就是在用户代理中搜索标识符(weirdbeardmt)的存在。 因此,对于我的跟踪脚本(包含在每个网站的每个页面中),我只需添加以下内容:
<?php if(strpos($_SERVER["HTTP_USER_AGENT"],"weirdbeardmt")!=FALSE) { // continue with the tracking script } ?>In ASP, this would appear as follows:
在ASP中,它将显示如下:
<% If Not InStr(Request.ServerVariables("HTTP_USER_AGENT"),"weirdbeardmt") > 0 Then 'continue with your tracking script End If %>And that, as they say, is that. The only drawback to this technique is that your custom user agent will be delivered to every Web page you visit. This doesn’t make a huge amount of difference, except that a site admin could easily find your "secret word" and use it to identify you. Provided, however, the identifier is nothing sensitive, this amounts to no more than a minor inconvenience.
就像他们说的那样。 此技术的唯一缺点是您的自定义用户代理将传递到您访问的每个网页。 除了站点管理员可以轻松找到您的“秘密单词”并使用它来识别您之外,这没有什么大的不同。 但是,只要标识符不敏感,就带来不小的麻烦。
翻译自: https://www.sitepoint.com/site-stats-user-agent/
qt 操纵access
相关资源:jdk-8u281-windows-x64.exe