本文发布于:2012-12-28,最后更新于:2013-08-07,如果内容失效请留言告知。
在网站上设置“加入收藏、设为首页”等按钮是一般网站都会干的事儿,但是有的网站还有“放到桌面”这样的功能设置。
下面即生成快捷方式到下载桌面的相关php和asp实现代码,摘录修改于网络,仅作参考
php实现代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <?php if (isset( $_GET <h2 id= "索引_1" ></h2>) && trim( $_GET <h2 id= "索引_1" ></h2>) !== "" ) $title = trim( $_GET [tilte]); $content =' [DEFAULT] BASEURL=http: //v.lzw.me/?desktop [{000214A0-0000-0000-C000-000000000046}] Prop3=19,2 [InternetShortcut] URL=http: //v.lzw.me/?desktop IDList=[{000214A0-0000-0000-C000-000000000046}] IconFile=http: //v.lzw.me/favicon.ico IconIndex=1 HotKey=0 Prop3=19,2'; header( "Content-type:application/octet-stream" ); header( "Content-Disposition:attachment; {$title}.url;" ); echo $content ; ?> |
asp实现代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | <% id = int(request("id")) if id="" then id="1" title = request("title") if title="" then title="智问影院" Shortcut = "[DEFAULT]" & vbCrLf Shortcut = Shortcut & "BASEURL=http://v.lzw.me/?desktop" & vbCrLf Shortcut = Shortcut & "[{000214A0-0000-0000-C000-000000000046}]" & vbCrLf Shortcut = Shortcut & "Prop3=19,2" & vbCrLf Shortcut = Shortcut & "[InternetShortcut]" & vbCrLf Shortcut = Shortcut & "URL=http://v.lzw.me/?desktop" & vbCrLf Shortcut = Shortcut & "IDList=[{000214A0-0000-0000-C000-000000000046}]" & vbCrLf Shortcut = Shortcut & "IconFile=http://v.lzw.me/favicon.ico" & vbCrLf Shortcut = Shortcut & "IconIndex=" & id & vbCrLf Shortcut = Shortcut & "HotKey=0" & vbCrLf Shortcut = Shortcut & "Prop3=19,2" & vbCrLf Response.AddHeader "Content-Dispositon", "attachment;filename=" & title & ".url"; Response.ContetType = "application/octet-steam" Response.Write Shortcut %> |
其生成原理很简单,即将url快捷方式的内容强制输出为附件,当访问时即下载到了一个定制的网站快捷方式。但是这个功能的作用却可能是很大的,你可以设置其默认图标与如我的电脑、网上邻居、文件夹等相同,而且因为它是正常的快捷方式,不会被杀毒软件等查杀,因此也常被一些黑客行为所使用,以带来巨大的真实访问流量。