废话不多说直接上教程
1.\admin\tpl\config\quickmenu.js
找到
"mf":{"text":"用户","default":"user","children":{"manager":{"text":"管理员","url":"?m=user-manager"},"usergroup":{"text":"会员组","url":"?m=user-group"},"user":{"text":"会员","url":"?m=user-list"},"usercard":{"text":"充值卡","url":"?m=user-card"}}},
修改为
"mf":{"text":"用户","default":"user","children":{"manager":{"text":"管理员","url":"?m=user-manager"},"usergroup":{"text":"会员组","url":"?m=user-group"},"user":{"text":"会员","url":"?m=user-list"},"usercard":{"text":"充值卡","url":"?m=user-card"},"regcard":{"text":"邀请码生成","url":"?m=user-regcard"}}},
2.\admin\tpl\html\system_config.html
找到统计代码:在他下面的</tr>后添加以下代码
<tr> <td>邀请码注册:</td> <td> <input type="radio" name="site_yaoqing" value="{v}" {c} />{n} </td> </td> </tr>
3.\admin\admin_data.php
找到第一个case “user_card”:在这段代码后面的break;下面添加
case "reg_card": $num=be('all','num'); $c_money=be('all','c_money'); $c_point=be('all','c_point'); $num = intval($num); $colarr = array('c_number','c_pass','c_money','c_point','c_addtime','c_usetime'); for($i=0;$i<$num;$i++){ $c_number = getRndStr(16); $c_pass = getRndStr(8); $c_addtime= time(); $valarr = Array($c_number,$c_pass,$c_money,$c_point,$c_addtime,0); $db->Add ('{pre}reg_card',$colarr,$valarr); } $flag='ok'; break;
找到第二个case “user_card”:在这段代码后面的break;下面添加
case "reg_card": $col="c_id"; $ids = be("get","c_id"); if(isN($ids)){ $ids= be("arr","c_id"); } break;
4.\inc\common\template.php
找到
$colarr = array("{maccms:url}","{maccms:path}","{maccms:path_tpl}",'{maccms:path_ads}',"{maccms:name}","{maccms:keywords}","{maccms:description}","{maccms:icp}","{maccms:qq}","{maccms:email}","{maccms:siteaid}","{maccms:curvodtypeid}","{maccms:curvodtypepid}","{maccms:curvodtopicid}","{maccms:curarttypeid}","{maccms:curarttypepid}","{maccms:curarttopicid}","{maccms:userid}","{maccms:username}","{maccms:usergroupid}","{maccms:desktop}","{maccms:visits}",'{maccms:date}','{maccms:suffix}'); $valarr = array($GLOBALS['MAC']['site']['url'],MAC_PATH,MAC_PATH_TEMPLATE,MAC_PATH_ADS,$GLOBALS['MAC']['site']['name'],$GLOBALS['MAC']['site']['keywords'],$GLOBALS['MAC']['site']['description'],$GLOBALS['MAC']['site']['icp'],$GLOBALS['MAC']['site']['qq'],$GLOBALS['MAC']['site']['email'],$this->C["siteaid"],$this->P["vodtypeid"],$this->P["vodtypepid"],$this->P["vodtopicid"],$this->P["arttypeid"],$this->P["arttypepid"],$this->P["arttopicid"],$_SESSION["userid"],$_SESSION["username"],$_SESSION["usergroup"],"<a href=\"javascript:void(0)\" onclick=\"desktop('');return false;\"/>保存到桌面</a>","<script src=\"".MAC_PATH."js/tj.js\"></script>",date('Y-m-d',time()),$GLOBALS['MAC']['app']['suffix']);
修改为
$colarr = array("{maccms:url}","{maccms:path}","{maccms:path_tpl}",'{maccms:path_ads}',"{maccms:name}","{maccms:keywords}","{maccms:description}","{maccms:icp}","{maccms:qq}","{maccms:email}","{maccms:siteaid}","{maccms:curvodtypeid}","{maccms:curvodtypepid}","{maccms:curvodtopicid}","{maccms:curarttypeid}","{maccms:curarttypepid}","{maccms:curarttopicid}","{maccms:userid}","{maccms:username}","{maccms:usergroupid}","{maccms:desktop}","{maccms:visits}",'{maccms:date}','{maccms:suffix}','{maccms:yaoqing}'); $valarr = array($GLOBALS['MAC']['site']['url'],MAC_PATH,MAC_PATH_TEMPLATE,MAC_PATH_ADS,$GLOBALS['MAC']['site']['name'],$GLOBALS['MAC']['site']['keywords'],$GLOBALS['MAC']['site']['description'],$GLOBALS['MAC']['site']['icp'],$GLOBALS['MAC']['site']['qq'],$GLOBALS['MAC']['site']['email'],$this->C["siteaid"],$this->P["vodtypeid"],$this->P["vodtypepid"],$this->P["vodtopicid"],$this->P["arttypeid"],$this->P["arttypepid"],$this->P["arttopicid"],$_SESSION["userid"],$_SESSION["username"],$_SESSION["usergroup"],"<a href=\"javascript:void(0)\" onclick=\"desktop('');return false;\"/>保存到桌面</a>","<script src=\"".MAC_PATH."js/tj.js\"></script>",date('Y-m-d',time()),$GLOBALS['MAC']['app']['suffix'],$GLOBALS['MAC']['site']['yaoqing']);
5.\inc\module\user.php
找到
$u_name = be("post","u_name"); $u_name_olg = $u_name; $u_name = chkSql($u_name);
在下面添加
$u_yaoqing = be("post","u_yaoqing");
在找到
if ($u_name_olg != $u_name){ alert ("用户名包含非法关键字,请重试!");exit; }
在上面添加
if($GLOBALS['MAC']['site']['yaoqing']=='1'){ $rscount = $db->getOne("SELECT count(*) FROM {pre}reg_card where c_number='" . $u_yaoqing . "' AND c_used= '0'"); if($rscount<=0){ alert ("邀请码错误,请重新输入!"); exit; }else{ $db->query ("UPDATE `mac_reg_card` SET `c_used` = '1',`c_user` = '".$u_name."',`c_sale` = '1' WHERE `c_number` ='".$u_yaoqing."';"); } }
大功告成,去试试吧!
哈哈