星联网络专注帝国CMS二次功能插件开发-精品网站模板站长代码素材

  • 最近更新
  • 模板:33
  • 记录:12640|
  • 插件:52|
  • 工具:4|
  • 代码:8|
  • 评论:0

织梦后台直接添加会员功能开发方法

前言

本文主要讲解《织梦后台直接添加会员功能开发方法》的详细内容

我们在运营含有会员系统的网站前期,由于注册会员比较少,或者限制了会员自主注册功能,就需要管理员在后台直接添加会员。织梦默认后台是不能添加会员的。织梦58做了以下二次开发。可以支持在后台直接添加会员。

开发方法

1、需要新增两个文件:huiyuan_add.php和huiyuan.htm。huiyuan_add.php放在/dede/文件夹下,huiyuan_add.htm放在/dede/templets/文件夹下。

huiyuan_add.php代码如下:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 <?php require(dirname(__FILE__)."/config.php"); $ENV_GOBACK_URL="member_main.php"; if($dopost=="add"){ $jointime=$logintime=time(); $loginip=$joinip=GetIP(); $dsql->ExecuteNoneQuery("INSERTINTOdede_memberSET`mtype`='$mtype',`userid`='$userid',`pwd`='$password',`uname`='$uname',`sex`='$sex',`rank`='$rank',`money`='$money',`email`='$email',`scores`='$scores',`matt`='0',`face`='',`safequestion`='0',`safeanswer`='$safeanswer',`jointime`='$jointime',`joinip`='$joinip',`logintime`='$logintime',`loginip`='$loginip';"); ShowMsg('恭喜,成功添加一个用户!',$ENV_GOBACK_URL); exit(); } else{ includeDedeInclude('templets/huiyuan_add.htm'); } ?>

huiyuan_add.htm 的代码如下:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 <html> <head> <metahttp-equiv='Content-Type'content='text/html;charset=gb2312'> <title>添加会员</title> <linkhref="css/base.css"rel="stylesheet"type="text/css"> <scriptlanguage='javascript'src='../data/enums/area.js'></script> <script> functioncheckSubmit() { if(document.form2.email.value=="") { document.form2.email.focus(); alert("Email不能为空!"); returnfalse; } if(document.form2.uname.value=="") { document.form2.uname.focus(); alert("用户昵称不能为空!"); returnfalse; } } </script> </head> <bodybackground='img/allbg.gif'leftmargin='8'topmargin='8'> <tablewidth="98%"border="0"align="center"cellpadding="3"cellspacing="1"bgcolor="#D1DDAA"> <tr> <tdheight="19"background="img/tbg.gif"><ahref='<?phpecho$ENV_GOBACK_URL;?>'><b>会员管理</b></a>&gt;&gt;添加会员</td> </tr> <tr> <tdheight="200"bgcolor="#FFFFFF"align='center'> <tablewidth="98%"border="0"cellspacing="0"cellpadding="6"> <tr> <tdcolspan="2"height="10"></td> </tr> <formname="form2"action="huiyuan_add.php"method="post"onSubmit="returncheckSubmit();"> <inputtype="hidden"name="dopost"value="add"/> <tr> <tdwidth="17%"align="right"class='bline'>用户名:</td> <tdwidth="83%"class='bline'> <inputname="userid"type="text"value=""id="userid"size="20"style="width:150px;height:20px"/> </td> </tr> <tr> <tdalign="right"class='bline'>密 码:</td> <tdclass='bline'> <inputtype="text"name="pwd"id="pwd"/> </td> </tr> <tr> <tdalign="right"class='bline'>用户类型:</td> <tdclass='bline'> <?phpecho$row['mtype'];?> <inputtype="radio"name="mtype"class="np"value="个人"checked='1'/> 个人&nbsp; <inputtype="radio"name="mtype"class="np"value="企业"/>企业 </td> </tr> <tr> <tdalign="right"class='bline'>电子邮箱:</td> <tdclass='bline'> <inputname="email"type="text"id="email"value="<?phpecho$row['email']?>"style="width:150px;height:20px"/> </td> </tr> <tr> <tdalign="right"class='bline'>昵 称:</td> <tdclass='bline'> <inputname="uname"type="text"value="<?phpecho$row['uname']?>"id="uname"size="20"style="width:150px;height:20px"/> </td> </tr> <tr> <tdalign="right"class='bline'>性 别:</td> <tdclass='bline'> <inputtype="radio"name="sex"class="np"value="男"checked='1'/> 男&nbsp; <inputtype="radio"name="sex"class="np"value="女"/> 女 <inputtype="radio"name="sex"class="np"value=""/> 保密 </td> </tr> <tr> <tdalign="right"class='bline'>等级:</td> <tdclass='bline'><?php $MemberTypes=''; $dsql->SetQuery("Selectrank,membernameFrom`dede_arcrank`whererank>0"); $dsql->Execute('n'); $MemberTypes[0]="限制会员"; while($nrow=$dsql->GetObject('n')){ $MemberTypes[$nrow->rank]=$nrow->membername; } $options="<selectname='rank'style='width:180px'>\r\n"; foreach($MemberTypesas$k=>$v) { if($k!=$row['rank'])$options.="<optionvalue='$k'>$v</option>\r\n"; else$options.="<optionvalue='$k'selected>$v</option>\r\n"; } $options.="</select>\r\n"; echo$options; ?></td> </tr> <tr> <tdheight="67"align="right">&nbsp;</td> <tdheight="67"> <inputtype="submit"name="Submit"value="确定添加"class='coolbg'/> &nbsp;&nbsp; <inputtype="reset"name="Submit22"value="重置表单"class='coolbg'/> </td> </tr> </form> </table> </td> </tr> </table> </body> </html>

打开dede\inc\inc_menu.php,找到

<m:item name='注册会员列表' link='member_main.php' rank='member_List' target='main' />

在其下面增加如下代码

<m:item name='添加会员' link='huiyuan_add.php' rank='huiyuan_Add' target='main' />

完成。


本网刊登的文章均仅代表作者个人观点,并不代表本网立场。文中的论述和观点,敬请读者注意判断。

本文地址:http://www.xlkjgs.com/notes/web/10696.html

以上内容由本站整理呈现,请务必在转载分享时注明本文地址!如对内容有疑问,请联系我们,谢谢!

星联网络

星联网络是中国最具实战的互联网创业者的知识服务商,这里有互联网行业动态,网络推广,SEO优化,SEM优化,ESC配置,行业经验分型,互联网项目,微信营销、淘宝客赚钱、新媒体营销、京东运营、跨境电商等众多互联网营销知识分享

站长运营站长必备网站运营之道才能长久发展