Home  >  Article  >  Backend Development  >  ASP and PHP implement methods to generate website shortcuts and download them to the desktop_PHP tutorial

ASP and PHP implement methods to generate website shortcuts and download them to the desktop_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:30:121396browse

Setting buttons such as "Add to Favorites, Set as Homepage" on a website is something that most websites do, but some websites also have functional settings such as "Put on Desktop".
The following is the PHP implementation code that generates a shortcut and downloads it to the desktop. The excerpt is modified from the Internet and is for reference only

php implementation code:

Copy code The code is as follows:

if(isset($_GET[title]) && trim($_GET[title]) !== "") $title = trim($_GET[tilte]);
$content='
[DEFAULT]
BASEURL=http://www. jb51.net/?desktop
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2
[InternetShortcut]
URL=http://www.jb51.net /?desktop
IDList=[{000214A0-0000-0000-C000-000000000046}]
IconFile=http://www.jb51.net/favicon.ico
IconIndex=1
HotKey= 0
Prop3=19,2';
header("Content-type:application/octet-stream");
header("Content-Disposition:attachment; {$title}.url;") ;
echo $content;
?>

asp implementation code:

Copy code The code is as follows:

<%
id = int(request("id"))
if id="" then id="1"
title = request("title")
if title="" then title="Script Home"

Shortcut = "[DEFAULT]" & vbCrLf
Shortcut = Shortcut & "BASEURL=http://www.jb51.net/?desktop" & vbCrLf
Shortcut = Shortcut & "[{000214A0-0000 -0000-C000-000000000046}]" & vbCrLf
Shortcut = Shortcut & "Prop3=19,2" & vbCrLf
Shortcut = Shortcut & "[InternetShortcut]" & vbCrLf
Shortcut = Shortcut & "URL =http://www.jb51.net/?desktop" & vbCrLf
Shortcut = Shortcut & "IDList=[{000214A0-0000-0000-C000-000000000046}]" & vbCrLf
Shortcut = Shortcut & " IconFile=http://www.jb51.net/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
%>


The generation principle is very simple, that is, the content of the url shortcut is forced to be output as an attachment. When accessed, a customized website shortcut is downloaded. However, this function may be very useful. You can set its default icon to be the same as My Computer, Network Places, folders, etc., and because it is a normal shortcut, it will not be detected by anti-virus software. Therefore, it is often used by some hackers to bring huge real access traffic.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/767084.htmlTechArticleSetting buttons such as "Add to favorites, set as homepage" on the website is something that most websites do, but Some websites also have functional settings such as "put on desktop". The shortcut is generated below...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn