天恒杏彩ssc手机注册增加姓名

************register.php********************
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title><?=$this->iff($args[0], $args[0] . '-'). $this->settings['webName']?></title>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=360, initial-scale=0.5, user-scalable=0, minimum-scale=0.5, maximum-scale=1.0">
<!--<meta name="viewport" content="user-scalable=no, initial-scale=0.5, minimal-ui, width=360" id="viewport" />-->
<meta http-equiv="cleartype" content="on">
<meta name="apple-mobile-web-app-status-bar-style" content="yes" />
<script type="text/javascript" src="/skin/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="/skin/main/onload.js?version=20160420"></script>
<script type="text/javascript" src="/skin/main/reglogin.js"></script>
<style type="text/css">
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
*:before, *:after {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
html {
    font-family: sans-serif;
    -ms-text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
}
body {
    font-family: Tahoma, Helvetica, Arial, "Microsoft Yahei","微软雅黑", STXihei, "华文细黑", sans-serif;
    font-size: 24px;
    font-weight: 200;
    line-height: 32px;
    /*color: #828a94;*/
margin:0;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: inherit;
    font-weight: 500;
    line-height: 1.1;
    color: inherit;
}
h1, .h1, h2, .h2, h3, .h3 {
    margin-top: 20px;
    margin-bottom: 10px;
}
p {
    margin: 0 0 10px;
}
button, input, optgroup, select, textarea {
    color: inherit;
    font: inherit;
    margin: 0;
}
input {
    line-height: normal;
}
button, html input[type="button"], input[type="reset"], input[type="submit"] {
    -webkit-appearance: button;
    cursor: pointer;
}
 
.white {
    color: #fff;
}
 
.header {
    position: fixed;
    top: 0;
    width: 100%;
    height: auto;
    z-index: 999;
}
.graynavi {
    height: 100px;
    width: 100%;
    background-color: #f2f2f2;
    position: relative;
    border-top: 2px solid #fff;
}
.aligncenter {
    text-align: center;
}
.cnbig1 {
    font-size: 22px;
    line-height: 20px;
    font-weight: 400;
}
.graybartitle {
    padding-top: 27px;
}
.graynavibtn {
    position: absolute;
    left: 20px;
    top: 32px;
}
.graynavi a {
    color: #000;
}
.marginleft20 {
    margin-left: 20px;
}
.container {
    margin-right: auto;
    margin-left: auto;
    padding-left: 10px;
    padding-right: 10px;
}
.cmargin20 {
    padding: 20px;
}
.cmargintop2 {
    margin-top: 150px;
}
.container h1 {
    font-size: 30px;
}
.container p {
    font-size: 26px;
}
.gap10 {
    height: 10px;
}
.rowfield {
    padding: 10px 0;
}
.rowfield .col1 {
    width: 25%;
    height: auto;
}
.margintop15 {
    margin-top: 15px;
}
.rowfield .col2 {
    width: 75%;
    height: auto;
}
.field_input {
    width: 100%;
    height: 65px;
    border: 2px solid #b6b6b6;
    padding: 20px;
}
input, button, select, textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}
.red {
    color: #fe6767;
}
.cnsmall1 {
    font-size: 22px;
}
.field_input2 {
    width: 50%;
    height: 65px;
    border: 2px solid #b6b6b6;
    padding: 20px;
}
.fl {
    float: left;
}
.cnbig1 {
    font-size: 22px;
    line-height: 20px;
    font-weight: 400;
}
.btnresetpass {
    width: 50%;
    text-align: center;
    padding: 20px 0;
    cursor: pointer;
    margin: 0 auto;
    background-color: #2061b3;
}
.clearfix:before, .clearfix:after, .dl-horizontal dd:before, .dl-horizontal dd:after, .container:before, .container:after, .container-fluid:before, .container-fluid:after, .row:before, .row:after, .form-horizontal .form-group:before, .form-horizontal .form-group:after {
    content: " ";
    display: table;
}
.clearfix:after, .dl-horizontal dd:after, .container:after, .container-fluid:after, .row:after, .form-horizontal .form-group:after {
    clear: both;
}
</style>
  <script type="text/javascript">
  $(document).ready(function() { 
    $('.infopanelrow .accounts:first').show();
    if (screen.width > 360 && !navigator.userAgent.match("UCBrowser") && navigator.userAgent.match("Android")) {
      $('body').css("zoom","0.5")
    }
  });
  </script>
 
</head>
<body>
<div class="header">
    <div class="graynavi">
        <div class="graybartitle blue aligncenter cnbig1">
            注册
          </div>
        <div class="graynavibtn" rel="login.html">
            <a href="/"><div class="fl"><img src="/images/backarrow.jpg" width="23" height="35" alt="">
              </div>
              <div class="fl marginleft20">主页</div>
            </a>
          </div>
    </div>
</div>
<form action="/index.php/user/registered" method="post" onajax="registerBeforSubmit" enter="true" call="registerSubmit" target="ajax">
    <div class="container cmargin20 cmargintop2 subcontent2">
      <h1>注册</h1>
        <p>请在以下填写您的注册信息。</p>
    <div class="gap10"></div>
   
    <div class="rowfield clearfix">
        <div class="col1 fl margintop15">登录账号:</div>
          <div class="col2 fl"><input type="text" id="username" name="username" class="text field_input">
            <div class="red cnsmall1" id='nameTips'>*帐户名由4-16个字符组成</div>
          </div>
    </div>
    <div class="rowfield clearfix">
        <div class="col1 fl margintop15">登录密码:</div>
          <div class="col2 fl"><input type="password" id="password" name="password" class="text field_input">
            <div class="red cnsmall1">*6-20个字母、数字或组合组成,区分大小写</div>
          </div>
    </div>
    <div class="rowfield clearfix">
        <div class="col1 fl margintop15">确认密码:</div>
          <div class="col2 fl"><input type="password" name="cpasswd" id="cpasswd" class="text field_input">
            <div class="red cnsmall1">*请再次输入密码以确保输入无误</div>
          </div>
    </div>
    <div class="rowfield clearfix">
        <div class="col1 fl margintop15">真实姓名:</div>
          <div class="col2 fl"><input type="text" id="name" name="name" class="text field_input" placeholder="真实姓名" oncontextmenu="return false" onpaste="return false" />
            <div class="red cnsmall1">*必须与您的银行帐户名称相同,否则不能出款!</div>
          </div>
    </div>
    <div class="rowfield clearfix">
        <div class="col1 fl margintop15">手机号码:</div>
          <div class="col2 fl"><input type="text" name="qq" id="qq" maxlength="12" class="text field_input">
            <div class="red cnsmall1">请输入联系手机号码</div>
          </div>
    </div>
    <div class="rowfield clearfix">
      <div class="col1 fl margintop15">验证码:</div>
        <div class="col2 fl"><input type="text" name="vcode" id="vcode" class="field_input2 fl">
          <div class="captcha capcha fl"><img width="178" height="64" alt="验证码" align="absmiddle" src="/user/vcode/<?=$this->time?>" title="看不清楚,点我换图" onclick="this.src='/user/vcode/'+(new Date()).getTime()"/></div>
        </div>
    </div>
    </div>
    <div class="rowfield clearfix">
      <div class="col1 fl margintop15"></div>
        <div class="col2 fl"><input type="submit" class="btnresetpass white cnbig1" id="btnRegister" value="创建帐号"></div>
      </div>
</form>
</body>
</html>
 

************User.class.php********************

<?php
@session_start();
class User extends WebBase{
public $title='BOECP';
private $vcodeSessionName='ssc_vcode_session_name';
 
/**
* 用户登录页面
*/
public final function login(){
$this->display('user/login.php');
}
 
/**
* 用户注册页面
*/
public final function register(){
$this->display('user/register.php');
}
 
public final function setFullNamedo(){
$para=$_POST;
$fullName=$para['fullName'];
if($this->user['uid'] && $fullName){
if(!$this->getValue("select `name` from {$this->prename}members where uid=?", $this->user['uid'])){
if($this->update("update {$this->prename}members set name='{$fullName}' where uid=?", $this->user['uid'])){
echo 'ok';
exit;
}else{
echo '操作失败';
exit;
}
}else{
echo '您已添加过真实姓名,如需修改请联系客服';
exit;
}
}
}
 
public final function bindBankdo(){
$para=$_POST;
//$username=$para['fullName'];
$bankId=$para['bankId'];
$cardNo=$para['cardNo'];
$subAddress=$para['subAddress'];
if($this->user['uid']){
 
if($this->getValue("select uid from {$this->prename}member_bank where uid=?", $this->user['uid'])){
echo '您已绑定银行卡,如需修改请联系客服';
exit;
}
 
if(!$username){
$username=$this->getValue("select `name` from {$this->prename}members where uid=?", $this->user['uid']);
}
$userbank=array(
'uid'=>$this->user['uid'],
'username'=>$username,
'bankId'=>$bankId,
'account'=>$cardNo,
'countname'=>$subAddress
);
 
if(!$username || !$bankId || !$cardNo || !$subAddress){
echo '填写错误';
exit;
}
try{
if($this->insertRow($this->prename.'member_bank', $userbank)){
$this->update("update {$this->prename}members set `name`='{$username}' where uid=?", $this->user['uid']);
echo 'ok';
exit;
}else{
echo '绑定失败';
exit;
}
 
}catch(Exception $e){
$this->rollBack();
throw $e;
}
 
}
}
 
public final function setFundPwddo(){
if($this->user['uid']){
$loginpwd=$_POST['loginpwd'];
$coinpwd=$_POST['coinpwd'];
if($loginpwd != $this->user['password']){
echo '登陆密码输入错误';
exit;
}
if(strlen($coinpwd) != 32){
echo '提款密码输入错误';
exit;
}
if($loginpwd == $coinpwd){
echo '登陆密码和提款密码不能相同';
exit;
}
if($this->update("update {$this->prename}members set coinPassword='{$coinpwd}' where uid=?", $this->user['uid'])){
echo 'ok';
exit;
}
}
}
/**
* 用户登出操作
*/
public final function logout(){
$_SESSION=array();
if($this->user['uid']){
$this->update("update {$this->prename}member_session set isOnLine=0 where uid={$this->user['uid']} and session_key=?", session_id());
}
header('location: /user/login');
exit;
}
 
public final function bulletin(){
$this->display('user/bulletin.php');
}
 
private function getBrowser(){
$flag=$_SERVER['HTTP_USER_AGENT'];
$para=array();
 
// 检查操作系统
if(preg_match('/Windows[\d\. \w]*/',$flag, $match)) $para['os']=$match[0];
 
if(preg_match('/Chrome\/[\d\.\w]*/',$flag, $match)){
// 检查Chrome
$para['browser']=$match[0];
}elseif(preg_match('/Safari\/[\d\.\w]*/',$flag, $match)){
// 检查Safari
$para['browser']=$match[0];
}elseif(preg_match('/MSIE [\d\.\w]*/',$flag, $match)){
// IE
$para['browser']=$match[0];
}elseif(preg_match('/Opera\/[\d\.\w]*/',$flag, $match)){
// opera
$para['browser']=$match[0];
}elseif(preg_match('/Firefox\/[\d\.\w]*/',$flag, $match)){
// Firefox
$para['browser']=$match[0];
}elseif(preg_match('/OmniWeb\/(v*)([^\s|;]+)/i',$flag, $match)){
//OmniWeb
$para['browser']=$match[2];
}elseif(preg_match('/Netscape([\d]*)\/([^\s]+)/i',$flag, $match)){
//Netscape
$para['browser']=$match[2];
}elseif(preg_match('/Lynx\/([^\s]+)/i',$flag, $match)){
//Lynx
$para['browser']=$match[1];
}elseif(preg_match('/360SE/i',$flag, $match)){
//360SE
$para['browser']='360安全浏览器';
}elseif(preg_match('/SE 2.x/i',$flag, $match)) {
//搜狗
$para['browser']='搜狗浏览器';
}else{
$para['browser']='unkown';
}
//print_r($para);exit;
return $para;
}
 
/**
* 用户登录检查 DAVID 
*/
public final function loginedto(){
    $username=wjStrFilter($_POST['username']);
        $password=wjStrFilter($_POST['password']);
        $vcode=wjStrFilter($_POST['vcode']);
        if(!isset($vcode)){
throw new Exception('请输入验证码');
}
if($vcode!=$_SESSION[$this->vcodeSessionName]){
throw new Exception('验证码不正确。');
}
if(!ctype_alnum($username)) throw new Exception('用户名包含非法字符,请重新登陆');
 
if(!$username){
throw new Exception('请输入用户名');
}
if(!$password){
throw new Exception('不允许空密码登录');
}
$sql="select * from {$this->prename}members where isDelete=0 and admin=0 and username=? limit 0,1";
if(!$user=$this->getRow($sql, $username)){
throw new Exception('用户名或密码不正确');
}
if(md5($password)!=$user['password']){
throw new Exception('密码不正确');
}
if(!$user['enable']){
throw new Exception('您的帐号系统检测涉嫌违规操作已被暂时冻结,如有疑问请联系在线客服!');
}
$session=array(
'uid'=>$user['uid'],
'username'=>$user['username'],
'session_key'=>session_id(),
'loginTime'=>$this->time,
'accessTime'=>$this->time,
'loginIP'=>self::ip(true)
);
 
$session=array_merge($session, $this->getBrowser());
 
if($this->insertRow($this->prename.'member_session', $session)){
$user['sessionId']=$this->lastInsertId();
}
$_SESSION[$this->memberSessionName]=serialize($user);
$updatetime=date('Y-m-d H:i:s', $this->time);
$this->update("update {$this->prename}members set updateTime='{$updatetime}' where uid=?", $user['uid']);
// 把别人踢下线
$this->update("update ssc_member_session set isOnLine=0 where uid=? and id < {$user['sessionId']}", $user['uid']);
return $user;
}
 
/**
* 验证码产生器
*/
public final function vcode($rmt=null){
$lib_path=$_SERVER['DOCUMENT_ROOT'].'/lib/';
include_once $lib_path .'classes/CImage.class';
$width=130;
$height=40;
$img=new CImage($width, $height);
$img->sessionName=$this->vcodeSessionName;
$img->printimg('png');
}
 
/**
* 推广注册
*/
public final function r($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);
$LArry=Xxtea::decrypt($userxxx, $this->urlPasswordKey);
$LArry=explode(",",$LArry);
$lid=$LArry[0];
$uid=$LArry[1];
 
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,$lid);
}
}
}
public final function registered(){
if(!$_POST)  throw new Exception('提交数据出错,请重新操作');
 
//表单过滤
$lid=intval($_POST['lid']);
$parentId=intval($_POST['parentId']);
$user=wjStrFilter($_POST['username']);
$qq=wjStrFilter($_POST['qq']);
$vcode=wjStrFilter($_POST['vcode']);
$password=md5($_POST['password']);
        $realname = $_POST['name'];
if($vcode!=$_SESSION[$this->vcodeSessionName]) throw new Exception('验证码不正确。');
        if (!$realname) throw new Exception('真实姓名包含非法字符');
//清空验证码session
    $_SESSION[$this->vcodeSessionName]="";
 
if(!ctype_alnum($user)) throw new Exception('用户名包含非法字符');
if(strlen($_POST['password'])<6) throw new Exception('密码不能小于6位');
if(strlen($_POST['password'])>20) throw new Exception('密码不能大于20位');
 
if($lid && $parentId){
$sql="select * from {$this->prename}links where lid=?";
$linkData=$this->getRow($sql, $lid);
if(!$_POST['lid']) $para['lid']=$lid;
if(!$linkData) throw new Exception('不存在此注册链接。');
if(!$parentId) throw new Exception('链接错误');
$parentinfo=$this->getRow("select * from {$this->prename}members where uid=?", $parentId);
if($linkData['type'] >= $parentinfo['type']) throw new Exception('链接错误');
}else{
$linkData['type']=0;
$linkData['fanDian']=0;
}
$para=array(
'username'=>$user,
'type'=>$linkData['type'],
'password'=>$password,
'fanDian'=>$linkData['fanDian'],
'coin'=>0,
'qq'=>$qq,
'regIP'=>$this->ip(true),
'regTime'=>$this->time,
'src'=>$_SERVER['SERVER_NAME'],
'name' => $realname
);
 
if($linkData['type']==0 && $parentinfo['type']==1){
//添加会员
$para['parentId']=$parentId;
$para['zparentId']=$parentinfo['zparentId'];
$para['gudongId']=$parentinfo['gudongId'];
}elseif($parentinfo['type']==2){
$para['zparentId']=$parentId;
$para['gudongId']=$parentinfo['gudongId'];
}elseif($parentinfo['type']==3){
$para['gudongId']=$parentId;
}
$lasttime=$this->time-24*3600;
        $regcount=$this->getValue("select count(*) from {$this->prename}members where regIP=? and regTime>{$lasttime}",ip2long($this->ip(true)));
if($regcount>=100) throw new Exception('同一IP 24小时内只能注册三次');
 
if(!$para['nickname']) $para['nickname']='未设昵称';
if(!$para['name']) $para['name']='';
$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();
$this->commit();
return '注册成功';
}else{
throw new Exception('注册失败');
}
}catch(Exception $e){
$this->rollBack();
throw $e;
}
}
}