加龙

加龙加香不加价
随笔 - 133, 评论 - 1344 , 引用 - 51

2007年8月31日

asp函数,禁止firefox浏览器用户访问网站

<%
Function GetBrower()
useragent=Request.ServerVariables("HTTP_USER_AGENT")
useragent=Lcase(useragent)
'Browser Check
dim btype,bname,bversion,idx,Os
btype=""
if inStr(useragent,"icab") then
bname="iCab"
elseif inStr(useragent,"lynx") then
bname="Lynx"
elseif inStr(useragent,"links") then
bname="Links"
elseif inStr(useragent,"elinks") then
bname="ELinks"
elseif inStr(useragent,"jbrowser") then
bname="JBrowser"
elseif inStr(useragent,"konqueror") then
bname="Konqueror"
elseif inStr(useragent,"gecko") then
bname="Mozilla"
btype=btype &"[Gecko]"
if inStr(useragent,"aol") then
bname="AOL"
elseif inStr(useragent,"netscape") then
bname="Netscape"
elseif inStr(useragent,"firefox") then
bname="FireFox"
elseif inStr(useragent,"chimera") then
bname="Chimera"
elseif inStr(useragent,"camino") then
bname="Camino"
elseif inStr(useragent,"galeon") then
bname="Galeon"
elseif inStr(useragent,"k-meleon") then
bname="K-Meleon"
end if
elseif inStr(useragent,"bot") or inStr(useragent,"crawl") or inStr(useragent,"spider") or inStr(useragent,"mediapartners") or inStr(useragent,"slurp") then
btype=btype &"[Bot/Crawler/Spider]"
if inStr(useragent,"grub") then
bname="Grub"
elseif inStr(useragent,"googlebot") or inStr(useragent,"google") then
bname="GoogleBot"
elseif inStr(useragent,"baidu") then
bname="BaiduBot"
elseif inStr(useragent,"sogou") then
bname="SogouBot"
elseif inStr(useragent,"msnbot") then
bname="MSN Bot"
elseif inStr(useragent,"slurp") then
bname="Yahoo! Slurp"
end if
elseif inStr(useragent,"wget") then
bname="Wget"
elseif inStr(useragent,"ask jeeves") or inStr(useragent,"teoma") then
bname="Ask Jeeves/Teoma"
elseif inStr(useragent,"msie") then
btype="[IE"
bversion=Mid(useragent,inStr(useragent,"msie")+5,3)
btype=btype & bversion &"]"
bname="IE"
if inStr(useragent,"msn") then
bname="MSN"
elseif inStr(useragent,"aol") then
bname="AOL"
elseif inStr(useragent,"webtv") then
bname="WebTV"
elseif inStr(useragent,"myie2") then
bname="MyIE2"
elseif inStr(useragent,"maxthon") then
bname="Maxthon"
elseif inStr(useragent,"gosurf") then
bname="GoSurf"
elseif inStr(useragent,"netcaptor") then
bname="NetCaptor"
elseif inStr(useragent,"sleipnir") then
bname="Sleipnir"
elseif inStr(useragent,"avant browser") then
bname="AvantBrowser"
elseif inStr(useragent,"greenbrowser") then
bname="GreenBrowser"
elseif inStr(useragent,"slimbrowser") then
bname="SlimBrowser"
end if
elseif inStr(useragent,"opera") then
bname="Opera"
idx=inStr(useragent,"opera")
bversion=mid(useragent,idx+6,idx+9)
bname=bname & bversion
elseif inStr(useragent,"applewebkit") then
btype="[AppleWebKit]"
if inStr(useragent,"omniweb") then
bname="OmniWeb"
elseif inStr(useragent,"safari") then
bname="Safari"
elseif inStr(useragent,"mozilla") then
bname="Mozilla"
end if
end if

if bname="" then bname="unknow"
GetBrower=bname
end Function


dim tbrower
tbrower = GetBrower
if tbrower = "FireFox"  then
Response.Redirect "/Sorry.asp"
Response.Flush
end if
%>

posted @ 23:50 | Feedback (2)

asp获取用户浏览器类型及操作系统版本的函数

Function SystemCheck()
useragent=Request.ServerVariables("HTTP_USER_AGENT")
'转化为小写
useragent=Lcase(useragent)

'Browser Check
dim btype,bname,bversion,idx,Os
btype=""
if inStr(useragent,"icab") then
bname="iCab"
elseif inStr(useragent,"lynx") then
bname="Lynx"
elseif inStr(useragent,"links") then
bname="Links"
elseif inStr(useragent,"elinks") then
bname="ELinks"
elseif inStr(useragent,"jbrowser") then
bname="JBrowser"
elseif inStr(useragent,"konqueror") then
bname="Konqueror"
elseif inStr(useragent,"gecko") then
bname="Mozilla"
btype=btype &"[Gecko]"
if inStr(useragent,"aol") then
bname="AOL"
elseif inStr(useragent,"netscape") then
bname="Netscape"
elseif inStr(useragent,"firefox") then
bname="FireFox"
elseif inStr(useragent,"chimera") then
bname="Chimera"
elseif inStr(useragent,"camino") then
bname="Camino"
elseif inStr(useragent,"galeon") then
bname="Galeon"
elseif inStr(useragent,"k-meleon") then
bname="K-Meleon"
end if
elseif inStr(useragent,"bot") or inStr(useragent,"crawl") or inStr(useragent,"spider") or inStr(useragent,"mediapartners") or inStr(useragent,"slurp") then
btype=btype &"[Bot/Crawler/Spider]"
if inStr(useragent,"grub") then
bname="Grub"
elseif inStr(useragent,"googlebot") or inStr(useragent,"google") then
bname="GoogleBot"
elseif inStr(useragent,"baidu") then
bname="BaiduBot"
elseif inStr(useragent,"sogou") then
bname="SogouBot"
elseif inStr(useragent,"msnbot") then
bname="MSN Bot"
elseif inStr(useragent,"slurp") then
bname="Yahoo! Slurp"
end if
elseif inStr(useragent,"wget") then
bname="Wget"
elseif inStr(useragent,"ask jeeves") or inStr(useragent,"teoma") then
bname="Ask Jeeves/Teoma"
elseif inStr(useragent,"msie") then
btype="[IE"
bversion=Mid(useragent,inStr(useragent,"msie")+5,3)
btype=btype & bversion &"]"
bname="IE"
if inStr(useragent,"msn") then
bname="MSN"
elseif inStr(useragent,"aol") then
bname="AOL"
elseif inStr(useragent,"webtv") then
bname="WebTV"
elseif inStr(useragent,"myie2") then
bname="MyIE2"
elseif inStr(useragent,"maxthon") then
bname="Maxthon"
elseif inStr(useragent,"gosurf") then
bname="GoSurf"
elseif inStr(useragent,"netcaptor") then
bname="NetCaptor"
elseif inStr(useragent,"sleipnir") then
bname="Sleipnir"
elseif inStr(useragent,"avant browser") then
bname="AvantBrowser"
elseif inStr(useragent,"greenbrowser") then
bname="GreenBrowser"
elseif inStr(useragent,"slimbrowser") then
bname="SlimBrowser"
end if
elseif inStr(useragent,"opera") then
bname="Opera"
idx=inStr(useragent,"opera")
bversion=mid(useragent,idx+6,idx+9)
bname=bname & bversion
elseif inStr(useragent,"applewebkit") then
btype="[AppleWebKit]"
if inStr(useragent,"omniweb") then
bname="OmniWeb"
elseif inStr(useragent,"safari") then
bname="Safari"
elseif inStr(useragent,"mozilla") then
bname="Mozilla"
end if
end if

'Os Check
if inStr(useragent,"windows ce") then
Os="Windows ce"
elseif inStr(useragent,"windows 95") then
Os="Windows 95"
elseif inStr(useragent,"windows 98") then
Os="Windows 98"
elseif inStr(useragent,"windows 2000") then
Os="Windows 2000"
elseif inStr(useragent,"windows xp") then
Os="Windows XP"
elseif inStr(useragent,"windows nt 5.0") then
Os="Windows 2000"
elseif inStr(useragent,"windows nt 5.1") then
Os="Windows XP"
elseif inStr(useragent,"windows nt 5.2") then
Os="Windows 2003"
elseif inStr(useragent,"windows nt") then
Os="Windows NT"
elseif inStr(useragent,"win32") then
Os="Win32"
elseif inStr(useragent,"x11") or inStr(useragent,"unix") then
Os="unix"
elseif inStr(useragent,"sunos") or inStr(useragent,"sun os") then
Os="SUN OS"
elseif inStr(useragent,"powerpc") or inStr(useragent,"ppc") then
Os="PowerPC"
elseif inStr(useragent,"macintosh") then
Os="Mac"
elseif inStr(useragent,"mac osx") then
Os="MacOSX"
elseif inStr(useragent,"freebsd") then
Os="FreeBSD"
elseif inStr(useragent,"linux") then
Os="Linux"
elseif inStr(useragent,"palmsource") or inStr(useragent,"palmos") then
Os="PalmOS"
elseif inStr(useragent,"wap ") then
Os="WAP"
end if

if bname="" then bname="unknow"
if Os="" then Os="unknow"

SystemCheck=bname & "/" &Os
end Function

posted @ 23:49 | Feedback (44)

Google的排名知识初探

大处入眼小处着手,这是做很多事情的基本方法,自然也适用与搜索引擎优化。Google的搜索排名可以做得很复杂,但是也可以很简单,问题在于你是否真的用心并且一直坚持。

如果你想在互联网上成功,大量的免费访问量是你成功的最重要因素。Copy不厚道请看清楚,我说的是免费的访问量,不单是访问量。如果你不能获取更多的免费访问量,那么你只好忍痛掏出自己的钱包吧。

也许你在论坛灌水的本事高超,如长江般绵绵不绝。

也许你家里还有几十亿个邮件地址,你的电脑24小时不停地向世界传播你伟大的"产品信息"。

也许你会想你有很多的朋友,一个介绍十个,十个介绍一百个依次无穷无尽。

然而,我必须把每个这样想的人的泡沫残忍地击碎,依靠这些手段你永远都不可能真正地赢得成功。

那么你要问:"到底我要怎样做才能获得巨大的最好是免费的访问量呢?"
 
我要问你:"如果你需要非常非常多的水,你会到那里去找呢?"

去大海,去浩瀚无边的大海,而世界上最大的网上流量之海就是Google,Google每天有2亿多次的搜索问量。

搜索引擎和SEO有着共同的目标,就是帮助客户最快的找到他要找的东西。

对于大多数搜索引擎来说,网站中影响搜索结果页面(SERP)排名的两条根本因素就是:

1、网站是不是客户最想要找的东西

2、这个网站能不能最快地让浏览者找到

那么所有的SEO(而不是搜索引擎作弊)手段,根本上也就是让满网站不段满足上述两个要求的过程。

想学会搜索引擎优化,必须要了解如下一些东西:

1、了解搜索引擎如何抓取网页和如何索引网页。 你需要知道一些搜索引擎的基本工作原理,各个搜索引擎之间的区别,搜索机器人(SE robot或叫web crawler)如何进行工作,搜索引擎如何对搜索结果进行排序等等。

2、Meta标签优化。 主要包括主题(Title),网站描述(Description),和关键词(Keywords)。还有一些其它的隐藏文字比如Author(作者),Category(目录),Language(编码语种)等。

3、如何选取关键词并在网页中放置关键词。搜索就得用关键词。关键词分析和选择是SEO最重要的工作之一。首先要给网站确定主关键词(一般在5个上下),然后针对这些关键词进行优化,包括关键词密度(Density),相关度(Relavancy),突出性(Prominency)等等。

4、了解主要的搜索引擎。虽然搜索引擎有成千上万,但是对网站流量起决定作用的就那么几个。比如英文的主要有Google,Inktomi,Altavista等;中文的有百度,搜狐等。不同的搜索引擎对页面的抓取和索引、排序的规则都不一样。还要了解各搜索门户和搜索引擎之间的关系,比如Yahoo和AOL网页搜索用的是 Google的搜索技术,MSN用的是Looksmart和Open Directory的技术。

5、主要的互联网目录。 Yahoo自身不是搜索引擎,而是一个大型的网站目录,Open Directory也不是,他们和搜索引擎的主要区别是网站内容的收集方式不同。

6、按点击付费的搜索引擎。搜索引擎也需要赢利,随着互联网商务的越来越成熟,收费的搜索引擎也开始大行其道。最典型的有Overture和百度,当然也包括Google的广告项目 Google Adwords。越来越多的人通过搜索引擎的点击广告来定位商业网站,这里面也大有优化和排名的学问,你得学会用最少的广告投入获得最多的点击。

7、搜索引擎登录。网站做完了以后,别躺在那里等着客人从天而降。要让别人找到你,最简单的办法就是将网站提交(submit)到搜索引擎。虽然免费已经不再是互联网(至少是搜索引擎)的主流-如果你的是商业网站,主要的搜索引擎和目录都会要求你付费来获得收录(比如Yahoo要299美元),但是好消息是(至少到目前为止)最大的搜索引擎Google目前还是免费,而且它主宰着60%以上的搜索市场。

8、链接交换和链接广泛度(Link Popularity)。网页内容都是以超文本(Hypertext)的方式来互相链接的,网站之间也是如此。除了搜索引擎以外,人们也每天通过不同网站之间的链接来 Surfing("冲浪")。其它网站到你的网站的链接越多,你也就会获得更多的访问量。更重要的是,你的网站的外部链接数越多,会被搜索引擎认为它的重要性越大,从而给你更高的排名。所以,你得花很多精力去做和别人做交换链接。

posted @ 22:51 | Feedback (0)

京ICP备 05050892号