由于帝國CMS后臺沒有增加會(huì)員的功能,所以做了此教程!請有需要的小伙伴備份文件然后測試修改!
后臺手動(dòng)增加會(huì)員的功能
具體修改了兩個(gè)文件,AddMember.php和ListMember.php(在e/admin/member/目錄)
一、修改方法:
1、在ListMember.php添加代碼
①、查找" //修改會(huì)員 " 在其上面添加以下代碼:
//增加會(huì)員函數(shù) 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");//驗(yàn)證權(quán)限 $checked=1; //變量 $add[groupid]=(int)$add[groupid]; //$registertime=time(); $registertime=eReturnAddMemberRegtime(); $rnd=make_password(20);//產(chǎn)生隨機(jī)密碼 $userkey=eReturnMemberUserKey(); //寫入數(shù)據(jù)庫 $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("添加會(huì)員".$add[username]);//操作日志 printerror("添加會(huì)員成功","ListMember.php",1,0,1); } else { printerror("DbError","history.go(-1)"); } } --------------------------------------------------------------------- ②、查找" //刪除會(huì)員 " 在其上面添加以下代碼: //增加會(huì)員 if($enews=="AddMember") { $add=$_POST['add']; admin_AddMember($add,$logininid,$loginin); }
-------------------------------------------------------------------------
③、查找" 位置 " ,找到后繼續(xù)向下看有"注冊會(huì)員"或"前臺會(huì)員列表"
<input type="button" name="Submit5" value="注冊會(huì)員" onclick="window.open('../../member/register/');">
或
<input type="button" name="Submit5" value="前臺會(huì)員列表" onclick="window.open('../../member/list/');">
在"注冊會(huì)員"或"前臺會(huì)員列表",他兩個(gè)的任意一個(gè)上面添加以下代碼:
<input type="button" name="Submit5" value="增加會(huì)員" onclick="self.location.href='AddMember.php?enews=AddMember';">
=======================================================================
2、在AddMember.php添加代碼
①、查找" //取得表單 " 在其上面添加以下代碼
?> <?php if($enews=="EditMember") {
------------------------------------------------------------------------
②、在最下面查找" <?php " 或 " db_close() " 在其上面添加以下代碼:
<?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>增加會(huì)員</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">增加會(huì)員 <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">所屬會(huì)員組<br> <br> <input type="button" name="Submit3" value="管理會(huì)員組" 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 } ?>
二、使用方法:
后臺--用戶--會(huì)員管理--管理會(huì)員--增加會(huì)員
版權(quán)聲明: 本站資源均來自互聯(lián)網(wǎng)或會(huì)員發(fā)布,如果侵犯了您的權(quán)益請與我們聯(lián)系,我們將在24小時(shí)內(nèi)刪除!謝謝!
轉(zhuǎn)載請注明: 在帝國CMS后臺增加手動(dòng)添加會(huì)員功能