<?php
/*
@php freebsdtop affiliate download
REGNOW的下载工具实在不好用,用户要先下载一个REGNOW的工具再下载软件,想必用户会觉得麻烦而不愿意下载.
本脚本可自动为AFFLIATE定制版本而且简化操作
此函数可代替REGNOW提供的下载,也可以简单的为每一个AFFILIATE提供定制版本,最重要是升级管理非常方便,前提是你的空间流量要够用.
$regnow_id 让代理商通过表单输入
$filepath 软件安装包下载地址
软件安装时检查安装包文件名取REGNOW ID加入到购买链接中,也可用于其它代理平台
*/
function download($regnow_id,$filepath)
{
$old_name = end(explode(‘/’,$filepath));
$new_name = str_replace(‘.exe’,$regnow_id.’_.exe’,$old_name);
$data = file_get_contents($filepath);
ob_end_clean();
header(‘Content-Encoding: none’);
header(‘Content-Type: ‘.(strpos($HTTP_SERVER_VARS['HTTP_USER_AGENT'], ‘MSIE’) ? ‘application/octetstream’ : ‘application/octet-stream’));
header(‘Content-Disposition: ‘.(strpos($HTTP_SERVER_VARS['HTTP_USER_AGENT'], ‘MSIE’) ? ‘inline; ‘ : ‘attachment; ‘).’filename=”‘.$new_name);
header(‘Content-Length: ‘.strlen($data));
header(‘Pragma: no-cache’);
header(‘Expires: 0′);
die($data);
}
//使用方法
download($_GET["regnow_id"],’download/setup.exe’);//下载时的文件名将为setup_12345.exe 12345为REGNOW ID
?>
QQREADERDC1C4C218B3C8FF7
本文来自: 实现为AFFILIATE做定制版

发表评论