在推荐注册文件里面只可以填用户名和密码,我想增加个填QQ的,但QQ不存储到表里面,请问怎么回事?
后台有添加用户功能,里面有个可以填QQ的,后台填QQ可以存储到数据库。
推广链接文件代码:
<form action="/index.php/user/registered" method="post" onajax="registerBeforSubmit" enter="true" call="registerSubmit" target="ajax"> <input type="hidden" name="parentId" value="<?=$args[0]?>" /> <div class="tr"><span style="width:65px; overflow:hidden; white-space:nowrap;">用户名</span><input class="inp-1 img-login" name="username" /></div> <div class="tr"><span style="width:65px; overflow:hidden; white-space:nowrap;">密 码</span><input class="inp-1 img-login" name="password" type="password" /></div> <div class="tr"><span style="width:65px; overflow:hidden; white-space:nowrap;">确认密码</span><input id="cpasswd" type="password" class="inp-1 img-login" /></div> <div class="tr"><span style="width:65px; overflow:hidden; white-space:nowrap;">联系QQ</span><input name="qq" class="inp-1 img-login" value="" /></div> <div class="tr"><span style="width:65px; overflow:hidden; white-space:nowrap;">验证码</span><span class="yzmNum"><img style="max-width:90%" style="max-width:90%" border="0" style="margin:0;" align="absmiddle" src="/index.php/user/vcode/<?=$this- alt="增加了填QQ,提交数据不存储,请问怎么回事" >time?>" title="看不清楚嘛,点击切换一张图片吧" onclick="this.src='/index.php/user/vcode/'+(new Date()).getTime()"/></span><input class="inp-2 img-login" name="vcode" /></div> <div style="display:none;"><input type="submit" value=""/></div> <div class="login-btn-reg img-login" onclick="$(this).closest('form').submit()"></div> </form>
//{{{推广注册function registerBeforSubmit(){ var type=$('[name=type]:checked',this).val(); //console.log($('[name=type]:checked',this)); if(!this.username.value) throw('没有输入用户名'); if(!/^\w{4,16}$/.test(this.username.value)) throw('用户名由4到16位的字母、数字及下划线组成'); if(!this.password.value) throw('请输入密码'); if(this.password.value.length<6) throw('密码至少6位'); if(document.getElementById('cpasswd').value!=this.password.value) throw('两次输入密码不一样'); if(!this.qq.value) throw('没有输入联系QQ');}function registerSubmit(err,data){ if(err){ alert(err); }else{ location='/'; }}//}}}
<form action="/admin.php/member/added" method="post" target="ajax" onajax="beforeAddMember" call="addMember"> <table class="tablesorter table2" cellspacing="0" width="100%"> <tr> <td><span class="aq-txt">账号类型:</span></td> <td> <label><input name="type" type="radio" value="1" title="代理" checked="checked" />代理</label> <label><input name="type" type="radio" value="0" title="会员" style="margin-left:30px;" />会员</label> </td> </tr> <tr> <td><span class="aq-txt">用户名:</span></td> <td><input type="text" name="username" class="t-c" value="" /></td> </tr> <tr> <td><span class="aq-txt">密码:</span></td> <td><input name="password" type="password" class="t-c" value="" /></td> </tr> <tr> <td><span class="aq-txt">确认密码:</span></td> <td><input id="cpasswd" type="password" class="t-c" value="" /></td> </tr> <tr> <td><span class="aq-txt">联系 Q Q:</span></td> <td><input name="qq" class="inp-1 img-login" value="" /></td> </tr> <tr> <td></td> <td><input type="submit" class="alt_btn" value="增加成员"/></td> </tr> </table> </form>
php代码没贴出来,不知道你有没有把QQ这个字段的值写到数据库
/** * 推广注册 */ public final function register($userxxx){ if(!$userxxx){ //throw new Exception('链接错误!'); $this->display('team/register.php'); }else{ include_once $_SERVER['DOCUMENT_ROOT'].'/lib/classes/Xxtea.class'; $userxxx=str_replace(array('-','*',''), array('+','/','='), $userxxx); $userxxx=base64_decode($userxxx); $uid=Xxtea::decrypt($userxxx, $this->urlPasswordKey); if(!$this->getRow("select uid from {$this->prename}members where uid=?",$uid)){ //throw new Exception('链接失效!'); $this->display('team/register.php'); }else{ $this->display('team/register.php',0,$uid); } } } public final function registered(){ if(strtolower($_POST['vcode'])!=$_SESSION[$this->vcodeSessionName]){ throw new Exception('验证码不正确。'); } if(!$_POST['parentId']) throw new Exception('链接错误'); $para=array( 'username'=>$_POST['username'], 'password'=>md5($_POST['password']), 'parentId'=>$_POST['parentId'], 'parentId'=>$_POST['qq'], 'parents'=>$this->getValue("select parents from {$this->prename}members where uid=?",$_POST['parentId']), 'fanDian'=>0, 'fanDianBdw'=>0, 'regIP'=>$this->ip(true), 'regTime'=>$this->time ); if(!$para['nickname']) $para['nickname']=$para['username']; if(!$para['name']) $para['name']=$para['username']; $this->beginTransaction(); try{ $sql="select username from {$this->prename}members where username=?"; if($this->getValue($sql, $para['username'])) throw new Exception('用户“'.$para['username'].'”已经存在'); if($this->insertRow($this->prename .'members', $para)){ $id=$this->lastInsertId(); $sql="update {$this->prename}members set parents=concat(parents, ',', $id) where `uid`=$id"; $this->update($sql); $this->commit(); return '注册成功'; }else{ throw new Exception('注册失败'); } }catch(Exception $e){ $this->rollBack(); throw $e; } }}
推广注册的js代码,是没有粘贴完整,还是功能没有全部实现?
'parentId'=>$_POST['parentId'], 'QQ'=>$_POST['qq'],
推广注册的js代码,是没有粘贴完整,还是功能没有全部实现?
是不往表里写数据
'parentId'=>$_POST['parentId'], 'QQ'=>$_POST['qq'],
'parentId'=>$_POST['parentId'],'parentId'=>$_POST['qq'],
'parentId'=>$_POST['parentId'], 'QQ'=>$_POST['qq'],
'parentId'=>$_POST['parentId'], 'QQ'=>$_POST['qq'],