木子屋 Dnawo's BLOG

手机发送代码投放参考之PHPWind论坛

👤 dnawo 📅 2008-01-08 👁 6538 👍 0 💬 0 🔄 本站原创
本次示例版本为v6.0,其他版本可参考修改。

1.准备工作

·站长的联盟ID;
·站点LOGO地址;
·模板:template\当前风格\read.htm
·文件:job.php

2.修改步骤

①打开模板"read.htm",找到下边代码并修改(红色新增):
附件: <img src="$imgpath/$stylepath/file/$attach[5].gif" align="absbottom" /> <a $att_id href="job.php?action=download&pid=$read[pid]&tid=$tid&aid=$attach[0]" target="_blank"> <font color="red">$attach[1]</font></a> [color=Red]<a href="job.php?action=downloadtomobile&pid=$read[pid]&tid=$tid&aid=$attach[0]" target="_blank">发送到手机</a>[/color] ($attach[2] K) 下载次数:$attach[3]

②修改"job.php",在"} elseif($action=='download'){"前新增下边代码:
} elseif($action=='downloadtomobile'){
	set_time_limit(300);
	InitGP(array('aid','pid'));
	(!$tid || !is_numeric($aid)) && Showmsg('job_attach_error');
	if(is_numeric($pid)){
		$table = GetPtable('N',$tid);
		$where = "pid='$pid'";
		$post  = $db->get_one("Select fid,aid FROM $table Where pid='$pid'");
	} else{
		$table = GetTtable($tid);
		$where = "tid='$tid'";
		$post  = $db->get_one("Select t.fid,tm.aid FROM pw_threads t LEFT JOIN $table tm USING(tid) Where t.tid='$tid'");
	}
	$attach = unserialize(stripslashes($post['aid']));
	$fid = $post['fid'];
	$attachurl='';
	!$attach[$aid] && Showmsg('job_attach_error');
	@extract($attach[$aid]);
	if(!$attachurl || strpos($attachurl,'..')!==false){
		Showmsg('job_attach_error');
	}
	if(!$windid && GetCookie('winduser') && $ol_offset){
		$userdb=explode("\t",getuserdb(D_P."data/bbscache/online.php",$ol_offset));
		if($userdb && $userdb[2]==$onlineip){
			$winddb = $db->get_one("Select m.uid,m.username,m.groupid,m.memberid,m.groups,md.money,md.rvrc FROM pw_members m LEFT JOIN pw_memberdata md USING(uid) Where m.uid='$userdb[8]'");
			$winduid  = $winddb['uid'];
			$groupid  = $winddb['groupid'];
			$groupid=='-1' && $groupid=$winddb['memberid'];
			$userrvrc = (int)($winddb['rvrc']/10);
			$windid	  = $winddb['username'];
			if(file_exists(D_P."data/groupdb/group_$groupid.php")){
				require_once Pcv(D_P."data/groupdb/group_$groupid.php");
			} else{
				require_once(D_P."data/groupdb/group_1.php");
			}
		}
		define('FX',1);
	}
	require_once(R_P.'require/forum.php');
	$foruminfo=$db->get_one("Select f.f_type,f.style,f.password,f.allowvisit,f.forumadmin,f.fupadmin,f.allowdownload,fe.forumset FROM pw_forums f LEFT JOIN pw_forumsextra fe USING(fid) Where f.fid='$fid'");
	!$foruminfo && Showmsg('data_error');
	wind_forumcheck($foruminfo);
	/*
	* 获取管理权限
	*/
	if($groupid=='3' || admincheck($foruminfo['forumadmin'],$foruminfo['fupadmin'],$windid)){
		$admincheck=1;
	} else{
		$admincheck=0;
	}
	/**
	* 版块权限判断
	*/
	if($foruminfo['allowdownload'] && !allowcheck($foruminfo['allowdownload'],$groupid,$winddb['groups']) && !$admincheck){
		Showmsg('job_attach_forum');
	}
	/**
	* 用户组权限判断
	*/
	if(!$foruminfo['allowdownload'] && $gp_allowdownload==0 && !$admincheck){
		Showmsg('job_attach_group');
	}
	if($needrvrc && $userrvrc < $needrvrc && !$admincheck){
		list(,,$db_rvrcname,)=explode("\t",$db_credits);
		Showmsg('job_attach_rvrc');
	}
	if(!$attach_url && !$db_ftpweb && !is_readable("$attachdir/$attachurl")){
		Showmsg('job_attach_error');
	}
	$db->update("Update pw_attachs SET hits=hits+1 Where aid='$aid'");

	$attach[$aid]['hits']++;
	$attach=addslashes(serialize($attach));
	$db->update("Update $table SET aid='$attach' Where $where");

	$filename = basename("$attachdir/$attachurl");
	$fileext  = substr(strrchr($attachurl,'.'),1);
	$filesize = 0;
	
	$fileurl_5k3g="$db_bbsurl/attachment/$attachurl";
	
	$url_5k3g="http://code.5k3g.com/tl/picDIY/Sendgame.aspx?uid=联盟ID&title=".urlencode($name)."&fileurl=".urlencode($fileurl_5k3g)."&imgurl=站点LOGO地址";
	header("Location:$url_5k3g");
	exit;

3.检查结果

在页面上点击"发送到手机",查看打开页面的地址,应和下边地址类似:

http://code.5k3g.com/tl/picDIY/Sendgame.aspx?uid=10009&title=aa&fileurl=http%3A//www.mzwu.com/ebook/aa.rar&imgurl=http://www.mzwu.com/images/logo.gif

主要看下uid是否正确,fileurl必须为绝对地址并且可以直接下载到资源(不能有防盗链、要求安装迅雷、快车等)!

评论(0)

暂无评论。

计算题
评论需审核通过后显示
← 上一篇 手机发送代码投放参考之织梦内容管理系统 下一篇 → 批量编码转换包括gb2312,utf-8,unicode,支持拖…