推導教學教學:帝國cms教學
#因為帝國CMS後台沒有增加會員的功能,所以做了這個教學!請有需要的小夥伴備份檔案然後測試修改!
後台手動增加會員的功能
具體修改了兩個文件,AddMember.php
和ListMember.php
(在e /admin/member/目錄)
一、修改方法:
##1、在ListMember. php新增程式碼
①、尋找" //修改會員" 在其上方新增以下程式碼:
//增加会员函数 function admin_AddMember($add,$logininid,$loginin){ global $empire,$dbtbpre; if(!trim($add[username])) { printerror("用户名不能为空","history.go(-1)",1,0,1); }else{ $num=$empire->gettotal("select count(*) as total from ".eReturnMemberTable()." where ".egetmf('username')."='$add[username]' limit 1"); if($num) { printerror("ReUsername","history.go(-1)"); } } if(!trim($add[password])) { printerror("密码不能为空","history.go(-1)",1,0,1); } else { $salt=eReturnMemberSalt(); $add[password]=eDoMemberPw($add[password],$salt); } if(!trim($add[email])) { printerror("邮箱不能为空","history.go(-1)",1,0,1); } CheckLevel($logininid,$loginin,$classid,"member");//验证权限 $checked=1; //变量 $add[groupid]=(int)$add[groupid]; //$registertime=time(); $registertime=eReturnAddMemberRegtime(); $rnd=make_password(20);//产生随机密码 $userkey=eReturnMemberUserKey(); //写入数据库 $sql=$empire->query("insert into {$dbtbpre}enewsmember(userid,username,password,rnd,email,registertime,groupid,checked,salt,userkey) values(NULL,'".addslashes($add[username])."','".addslashes($add[password])."','$rnd','".addslashes($add[email])."','$registertime','".addslashes($add[groupid])."','$checked','$salt','$userkey');"); if($sql) { insert_dolog("添加会员".$add[username]);//操作日志 printerror("添加会员成功","ListMember.php",1,0,1); }else { printerror("DbError","history.go(-1)"); } }
# ②、尋找" //刪除會員" 在其上方新增以下程式碼:
//增加会员 if($enews=="AddMember") { $add=$_POST['add']; admin_AddMember($add,$logininid,$loginin); }
③、尋找" 位置" ,找到後繼續向下看有"註冊會員"或"前台會員清單"
<input type="button" name="Submit5" value="注册会员" onclick="window.open('../../member/register/');">
<input type="button" name="Submit5" value="前台会员列表" onclick="window.open('../../member/list/');">
<input type="button" name="Submit5" value="增加会员"onclick="self.location.href='AddMember.php?enews=AddMember';">
2、在AddMember.php新增程式碼
# ①、尋找" //取得表單" 在其上方新增下列程式碼
#### #
<?php if($enews=="EditMember") { ?>
<?php } elseif($enews=="AddMember") { ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>增加会员</title> <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet"type="text/css"> </head> <body> <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1"> <tr> <td>位置:<?=$url?></td> </tr> </table> <form name="form1" method="post" action="ListMember.php" enctype="multipart/form-data"> <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1"class="tableborder"> <tr class="header"> <td height="25" colspan="2">增加会员 <input name="enews" type="hidden" id="enews" value="<?=$enews?>"> </td> </tr> <tr bgcolor="#FFFFFF"> <td width="25%" height="25">用户名</td> <td width="75%" height="25"><input name="add[username]" type=text id="add[username]"></td> </tr> <tr bgcolor="#FFFFFF"> <td height="25">密码</td> <td height="25"><input name="add[password]" type="password" id="add[password]"> </td> </tr> <tr bgcolor="#FFFFFF"> <td height="25" valign="top">所属会员组<br> <br> <input type="button" name="Submit3"value="管理会员组" onclick="window.open('ListMemberGroup.php');"> </td> <td height="25"><select name="add[groupid]" size="6" id="add[groupid]"onchange="self.location.href='AddMember.php?enews=AddMember&changegroupid='+this.options[this.selectedIndex].value;"> <?=$group?> </select></td> </tr> <tr bgcolor="#FFFFFF"> <td height="25">邮箱</td> <td height="25"><input name="add[email]" type="text" id="add[email]" size="35"></td> </tr> <tr bgcolor="#FFFFFF"> <td height="25"> </td> <td height="25"><input type="submit" name="Submit" value="提交"> <input type="reset"name="Submit2" value="重置"></td> </tr> </table> </form> </body> </html> <?php } ?>
以上是帝國cms怎麼加vip的詳細內容。更多資訊請關注PHP中文網其他相關文章!