织梦DedeCMS会员实现加V实名认证高级教程
现在很多网站都有实名验证的环节,上传一些必要的身份证、个人信息等,便于对会员手动审核开通权限。会员使用权限开通状态(-10 邮件验证 -1 手工审核, 0 没限制),下面介绍DedeCMS会员开发增加实名验证的方法。增加会员身份证、真实姓名、身份证与本人拍照认证信息,实现DedeCMS后台调用查看这些信息。
				
这里不利用个人资料模板,用头像设置的模板修改,单独做实名认证的模板。
				
dede后台查看会员调用真实姓名、认证信息、身份证信息。
使用SQL命令增加数据库相应字段
alter table dede_member add shiming char(50) comment '认证信息';
alter table dede_member add shenfenzheng char(100) comment '身份证号';
alter table dede_member add xingming char(100) comment '真实姓名';
新增edit_shiming.php,edit_shiming.htm
edit_shiming.php是由edit_face.php修改而来,修改后的文件链接:
edit_shiming.htm是由edit_face.htm修改而来,参考下面的修改方法。
会员中心调用实名制信息
在/member/templets/images/文件夹下,新建图片名为shiming.jpg、v.png。实现未上传显示shiming.jpg图片,反之显示已上传的内容的效果,并显示加V图片,需要增加一个php判断:
打开edit_shiming.htm,在<div class="postForm">下面把原来属于edit_face.htm的代码删除。增加代码:
| 
								1 
								2 
								3 
								4 
								5 
								6 
								7 
								8 
								9 
								10 
								11 
								12 
								13 
								14 
								15 
								16 
								17 
								18 
								19 
								20 | 
									<p class="cellBg"><img src=" 
									<?php 
									if($cfg_ml->fields['shiming']==''){ 
									 echo "images/shiming.jpg";} 
									else{ 
									 echo $cfg_ml->fields['shiming'];} 
									?>" width="300" height="150"/> 
									</p> 
									<p> 
									 <input name='oldshiming' type='hidden' id='oldshiming' value='<?php echo $shiming; ?>'/> 
									 认证彩照:<input name='faceurl' type='text' id='faceurl' size='35' class='intxt' style='width:250px' value='<?php echo $shiming; ?>'/> 
									 <input name="shiming" type="file" id="shiming" size="45" /> 
									 <a href="edit_shiming.php?dopost=delold&oldshiming=<?php echo urlencode($shiming); ?>">[删除]</a> 
									</p> 
									<p class="cellBg"> 
									  身份证号:<input name='shenfenzheng' type='text' id='shenfenzheng' class='intxt' value='<?php echo $shenfenzheng?>'/> 
									</p> 
									<p> 
									  真实姓名:<input name='xingming' type='text' id='xingming' class='intxt' value='<?php echo $xingming?>'/> 
									</p> | 
会员中心任意位置显示会员已认证加V
修改后可以实现会员中心首页和公共头部显示是否已认证加V信息,如果已认证会员等级值为180,在这两个区域增加代码:
| 
								1 
								2 
								3 
								4 
								5 
								6 
								7 
								8 | 
									<?php 
									  if($cfg_ml->M_Rank=='180'){ 
									   echo "<img src='templets/images/v.png' width='15' height='15'/><span>已实名认证</span>"; 
									   } 
									  else if($cfg_ml->M_Rank=='10'){ 
									   echo "未实名认证<a href='edit_shiming.php'>立即认证</a>"; 
									   } 
									?> | 
系统后台调用实名制信息
打开/dede/templets/member_view.htm,如果你改过dede后台地址,请自行修改。找到
| 
								1 
								2 
								3 
								4 
								5 
								6 | 
									<tr>  
									 <td align="right" class='bline'>电子邮箱:</td> 
									 <td class='bline' style="text-align:left;"> 
									  <input name="email" type="text" id="email" value="<?php echo $row['email']?>" style="width:150px;"/> 
									 </td> 
									</tr> | 
下面增加
| 
								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 | 
									<tr>  
									 <td align="right" class='bline'>认证信息:</td> 
									 <td class='bline' style="text-align:left;"> 
									  <img src=" 
									   <?php 
									    if($row['shiming']==''){ 
									     echo '../images/shiming.jpg';} 
									    else{ 
									     echo $row['shiming'];} 
									   ?>" width="300" height="150"/> 
									 </td> 
									</tr> 
									<tr>  
									 <td align="right" class='bline'>真实姓名:</td> 
									 <td class='bline' style="text-align:left;"> 
									  <input name="xingming" type="text" id="xingming" value=" 
									  <?php 
									   if($row['xingming']==''){ 
									    echo '未设置';} 
									   else{ 
									    echo $row['xingming'];}?>" style="width:150px;" /> 
									 </td> 
									</tr> 
									<tr>  
									 <td align="right" class='bline'>身份证:</td> 
									 <td class='bline' style="text-align:left;"> 
									  <input name="shenfenzheng" type="text" id="shenfenzheng" value=" 
									  <?php if($row['shenfenzheng']==''){ 
									    echo '未设置';} 
									   else{ 
									    echo $row['xingming'];}?>" style="width:150px;" /> 
									 </td> 
									</tr> | 
上一篇:织梦内容页调用会员的其他文章 下一篇:织梦用PHP判断flag自定义属性是否存在,然后调用自
