帝国CMS后台生成点卡和前台点卡充值无需密码功能优化,此改造优化了帝国CMS点卡功能,让点卡充值运作的站点客户操作更方便一些,点卡充值应该用一个卡号串就行,以前那种卡号+密码的方式有点麻烦了。具体方法如下:(请自行备份文件,以免不测。)
1.打开文件e/admin/member/AddCard.php
找到下面代码删除
找到下面代码删除
找到:
继续修改前台逻辑部分和前端
1.打开文件:e/member/class/membercomfun.php
替换为如下代码:
删除掉如下代码就好了
1.打开文件e/admin/member/AddCard.php
找到下面代码删除
找到
- $r[password]=strtolower(no_make_password(6));
改成
- $$r=$empire->fetch1("select card_no,password,money,cardfen,endtime,carddate,cdgroupid,cdzgroupid from {$dbtbpre}enewscard where cardid='$cardid' limit 1");
2.打开文件e/admin/member/AddMoreCard.php
- $r=$empire->fetch1("select card_no,money,cardfen,endtime,carddate,cdgroupid,cdzgroupid from {$dbtbpre}enewscard where cardid='$cardid' limit 1");
找到下面代码删除
3.打开文件e/admin/member/ListCard.php
- <tr bgcolor="#FFFFFF">
- <td height="25">点卡密码位数:</td>
- <td height="25"><input name="passnum" type="text" id="passnum" value="6" size="6">
- 位 </td>
- </tr>
找到:
改成:
- if(!$add[card_no]||!$add[password]||!$add[money])
找到下面代码删除:
- if(!$add[card_no]||!$add[money])
找到:
- $add['password']=hRepPostStr($add['password'],1);
改成:
- $sql=$empire->query("insert into {$dbtbpre}enewscard(card_no,password,cardfen,money,cardtime,endtime,carddate,cdgroupid,cdzgroupid) values('$add[card_no]','$add[password]',$add[cardfen],$add[money],'$cardtime','$add[endtime]',$add[carddate],$add[cdgroupid],$add[cdzgroupid]);");
找到下面代码删除:
- $sql=$empire->query("insert into {$dbtbpre}enewscard(card_no,cardfen,money,cardtime,endtime,carddate,cdgroupid,cdzgroupid) values('$add[card_no]',$add[cardfen],$add[money],'$cardtime','$add[endtime]',$add[carddate],$add[cdgroupid],$add[cdzgroupid]);");
找到:
- $passnum=(int)$add['passnum'];
改成:
- if(!$donum||!$cardnum||!$passnum||!$add[money])
找到下面代码删除:
- if(!$donum||!$cardnum||!$add[money])
找到:
- $password=strtolower(no_make_password($passnum));
改成
- $sql=$empire->query("insert into {$dbtbpre}enewscard(card_no,password,cardfen,money,cardtime,endtime,carddate,cdgroupid,cdzgroupid) values('$card_no','$password',$add[cardfen],$add[money],'$cardtime','$add[endtime]',$add[carddate],$add[cdgroupid],$add[cdzgroupid]);");
找到:
- $sql=$empire->query("insert into {$dbtbpre}enewscard(card_no,cardfen,money,cardtime,endtime,carddate,cdgroupid,cdzgroupid) values('$card_no',$add[cardfen],$add[money],'$cardtime','$add[endtime]',$add[carddate],$add[cdgroupid],$add[cdzgroupid]);");
改成:
- if(!$add[card_no]||!$add[password]||!$add[money]||!$add[cardid])
找到以下代码删除:
- if(!$add[card_no]||!$add[money]||!$add[cardid])
找到:
- $add['password']=hRepPostStr($add['password'],1);
改成:
- $sql=$empire->query("update {$dbtbpre}enewscard set card_no='$add[card_no]',password='$add[password]',cardfen=$add[cardfen],money=$add[money],endtime='$add[endtime]',carddate=$add[carddate],cdgroupid=$add[cdgroupid],cdzgroupid=$add[cdzgroupid] where cardid='$add[cardid]'");
至此,后台点卡功能部分修改完毕,
- $sql=$empire->query("update {$dbtbpre}enewscard set card_no='$add[card_no]',cardfen=$add[cardfen],money=$add[money],endtime='$add[endtime]',carddate=$add[carddate],cdgroupid=$add[cdgroupid],cdzgroupid=$add[cdzgroupid] where cardid='$add[cardid]'");
继续修改前台逻辑部分和前端
1.打开文件:e/member/class/membercomfun.php
替换为如下代码:
最后,修改前台点卡充值的表单模板e/template/membercard.php
- //点卡冲值
- function CardGetFen($username,$reusername,$card_no){
- global $empire,$dbtbpre;
- $card_no=RepPostVar($card_no);
- $username=RepPostVar($username);
- if(!trim($username)||!trim($card_no))
- {
- printerror("EmptyGetCard","history.go(-1)",1);
- }
- if($username!=$reusername)
- {
- printerror("DifCardUsername","history.go(-1)",1);
- }
- $user=$empire->fetch1("select ".eReturnSelectMemberF('userid,userdate,username,groupid')." from ".eReturnMemberTable()." where ".egetmf('username')."='$username' limit 1");
- if(!$user['userid'])
- {
- printerror("ExiestCardUsername","history.go(-1)",1);
- }
- $num=$empire->gettotal("select count(*) as total from {$dbtbpre}enewscard where card_no='".$card_no."' limit 1");
- if(!$num)
- {
- printerror("CardPassError","history.go(-1)",1);
- }
- //是否过期
- $buytime=date("Y-m-d H:i:s");
- $r=$empire->fetch1("select cardfen,money,endtime,carddate,cdgroupid,cdzgroupid from {$dbtbpre}enewscard where card_no='$card_no' limit 1");
- if($r[endtime]<>"0000-00-00")
- {
- $endtime=to_date($r[endtime]);
- if($endtime<time())
- {
- printerror("CardOutDate","history.go(-1)",1);
- }
- }
- //充值
- eAddFenToUser($r[cardfen],$r[carddate],$r[cdgroupid],$r[cdzgroupid],$user);
- $sql1=$empire->query("delete from {$dbtbpre}enewscard where card_no='$card_no'");//删除卡号
- //备份购买记录
- BakBuy($user['userid'],$username,$card_no,$r[cardfen],$r[money],$r[carddate],0);
- printerror("CardGetFenSuccess","../member/card/",1);
- }
删除掉如下代码就好了
- <tr bordercolor="#FFFFFF" bgcolor="#FFFFFF">
- <td height="25"> <div align="right">冲值卡密码:</div></td>
- <td height="25"> <input name="password" type="password" id="password">
- *</td>
- </tr>