首页 > 代码库 > php杂乱

php杂乱

//    
//    if ( $_GET[‘action‘] == ‘search‘ ) {
//        $_clean = array();
//        $_clean[‘stype‘] = _check($_POST[‘stype‘]);
//        $_clean[‘key‘] = _check($_POST[‘key‘]);
//
//        if ( $_clean[‘stype‘] == ‘companyId‘ ) {
//            _page("SELECT goodsId FROM tb_goods WHERE companyId = ‘{$_clean[‘key‘]}‘",10);
//
//            $_sql = "SELECT * FROM tb_goods WHERE companyId = ‘{$_clean[‘key‘]}‘ LIMIT $_pagenum,$_pagesize";
//        } elseif ( $_clean[‘stype‘] == ‘goodsName‘ ) {
//            _page("SELECT goodsId FROM tb_goods WHERE goodsName = ‘{$_clean[‘key‘]}‘",10);
//
//            $_sql = "SELECT * FROM tb_goods WHERE goodsName = ‘{$_clean[‘key‘]}‘ LIMIT $_pagenum,$_pagesize";
//        } elseif ( $_clean[‘stype‘] == ‘goodsDeliveryArea‘ ) {
//            _page("SELECT goodsId FROM tb_goods WHERE goodsDeliveryArea = ‘{$_clean[‘key‘]}‘",10);
//
//            $_sql = "SELECT * FROM tb_goods WHERE goodsDeliveryArea = ‘{$_clean[‘key‘]}‘ LIMIT $_pagenum,$_pagesize";
//        }
//    }
//    
//    $_result = _query($_sql);
    
    if ( isset($_GET[‘goodsId‘]) && $_GET[‘action‘] = ‘delete‘ ) {
        $_sql1 = "DELETE FROM tb_goods WHERE goodsId = ‘{$_GET[‘goodsId‘]}‘";
        _query($_sql1);

        if ( _affected_rows() == 1 ) {
            _close();
            _alert_back(‘删除成功!‘);
        } else {
            _close();
            _alert_back(‘删除失败!‘);
        }
    }
    
    if ( $_GET[‘action‘] == ‘deleteAll‘ && isset($_POST[‘ids‘]) ) {
        $_clean[‘ids‘] = _mysql_string(implode(‘,‘,$_POST[‘ids‘]));

        $_sql2 = "DELETE FROM tb_goods WHERE goodsId IN ({$_clean[‘ids‘]})";
        _query($_sql2);

        if( _affected_rows() ){
            _close();
            _alert_back(‘删除成功!‘);
        }else{
            _close();
            _alert_back(‘删除失败!‘);
        }
    }










    //if($_POST["countyId"]>0){
//        $_clean[‘areaId‘] = _check($_POST[‘countyId‘]);
//        $rs=_query("select * from tb_area where id=‘{$_POST[‘countyId‘]}‘");
//        $row = _fetch_array($rs);
//        $areaName=$row["areaName"];
//        _free_result($rs);
//        $_clean[‘goodsDeliveryArea‘] = "仅".$areaName;
//    }else{
//        $_clean[‘areaId‘] = _check($_POST[‘cityId‘]);
//        $rs=_query("select * from tb_area where id=‘{$_POST[‘cityId‘]}‘");
//        $row = _fetch_array($rs);
//        $areaName=$row["areaName"];
//        _free_result($rs);
//        $_clean[‘goodsDeliveryArea‘] = "全".$areaName;
//    }



$_clean[‘code‘] = _check($_POST[‘code‘]);
        if ($_clean[‘code‘] !=$_SESSION["code"])
        {
        echo "<script>alert(‘验证码不正确,请重新登陆‘);location.href=http://www.mamicode.com/‘login.php‘;</script>";
        exit;
        }






require ‘includes/common.inc.php‘;
      session_start();
    if ( $_GET[‘action‘] == ‘login‘ ) {
        $_clean = array();
        $_clean[‘username‘] = _check($_POST[‘username‘]);
        $_clean[‘password‘] =md5(_check($_POST[‘password‘]));
        $_sql = "SELECT * FROM tb_easyadmin WHERE username = ‘{$_clean[‘username‘]}‘ AND password = ‘{$_clean[‘password‘]}‘ LIMIT 1";
        $_result = _query($_sql);
        $_rows = _fetch_array($_result);
        if ( !!$_rows ) {
            _close();
            $_SESSION[‘id‘] = $$_rows[‘id‘];
            $_SESSION[‘password‘] = $_clean[‘password‘];
            _location(null,‘index.php‘);
        } else {
            _close();
            _location(‘用户名密码不正确‘,‘login.php‘);
        }
    }









  <?php
                        if( $_html3[‘county‘] > 0 ){
                            $_sql3 = "SELECT id,areaName FROM tb_earea WHERE areaType = 4 AND areaId = ‘{$_html3[‘county‘]}‘ AND state = 0";
                            $_result3 = _query($_sql3);
                            while( $_rowsRegion = _fetch_array($_result3) ){
                    ?>
                        <option value="http://www.mamicode.com/<?php echo $_rowsRegion[‘id‘] ?>" <?php if($_html3["region"]==$_rowsRegion[‘id‘]){?> selected="selected"<?php }?>><?php echo $_rowsRegion[‘areaName‘] ?></option>
                        <?php
                            }
                            _free_result($_result3);
                        }
                    ?>





 

 

$(function() {

    $advertisingType = $(‘#advertisingType‘);
    
    $advertisingType.click(function() {
    
        value = http://www.mamicode.com/$advertisingType.val();
    
        if ( value =http://www.mamicode.com/= 4 ) {
            $(‘.tr‘).hide();
        }
        
        if ( value != 4 ) {
            $(‘.tr‘).show();
        }
    
    });
    
});





<select name="smallClassId" id="smallClassId" >
                        <option value="http://www.mamicode.com/0">请选择小类</option>
                        <?php
                            if( $_html3[‘bigClassId‘] > 0 ){
                                $_sql5 = "SELECT id,categoryName FROM tb_ecategory WHERE grade = 1 AND categoryId = ‘{$_html3[‘bigClassId‘]}‘ AND state = 0";
                                $_result5 = _query($_sql5);
                                while( $_rows5 = _fetch_array($_result5) ){
                        ?>
                        <option value="http://www.mamicode.com/<?php echo $_rows5[‘id‘]?>" <?php if($_html3[‘smallClassId‘] == $_rows5[‘id‘]){?> selected="selected"<?php }?>><?php echo $_rows5[‘categoryName‘]?></option>
                        <?php    
                                }
                                _free_result($_result5);
                            }
                        ?>
                      </select>













user





<?php
    require ‘includes/common.inc.php‘;
    session_start();
    if ( !isset($_SESSION[‘username‘]) ) {
        _location(‘请先登录!‘,‘login.php‘);
    }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台管理--会员管理</title>
<style type="text/css">
<!--
*{
margin:0;
padding:0;
}
body {
    background-color: #F8F9FA;
}
-->
</style>
<link href="http://www.mamicode.com/images/skin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="http://www.mamicode.com/images/left-top-right.gif" width="17" height="29" /></td>
    <td height="29" valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
        <tr>
          <td height="31"><div class="titlebt">会员管理</div></td>
        </tr>
      </table></td>
    <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="http://www.mamicode.com/images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><div>
        <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td height="20"><div style="font-size:12px;line-height:25px;">查看: <a href=http://www.mamicode.com/‘user.php‘>全部               <div align="center" style="margin-top:-10px;">
                <form action="?action=search" method="post" name="user" id=‘user‘ onsubmit="return test();">
                  <label for="stype"></label>
                  <select name="stype" id="stype">
                    <option value="http://www.mamicode.com/regName">账号名称</option>
                  </select>
                  <input name="key" type="text" id="key" />
                  <input id=‘btn‘ type="submit" value="http://www.mamicode.com/搜素" />
                </form>
              </div>
              <table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" >
              </table></td>
          </tr>
          <tr><td height="10"></td></tr>
          <tr>
            <td>
                <table width="100%" height="74" border="0" cellpadding="0" cellspacing="0" class="nowtable">
                  <tr align="center" bgcolor="#F2F2F2">
                    <td class="left_txt2">账号名称</td>
                    <td class="left_txt2">会员类型</td>
                    <td class="left_txt2">会员等级</td>
                    <td class="left_txt2">易币数</td>
                    <td class="left_txt2">现金数</td>
                    <td class="left_txt2">真实姓名</td>
                    <td class="left_txt2">状态</td>
                    <td class="left_txt2"></td>
                  </tr>
                  <?php
                    define(‘SCRIPT‘,‘user‘);
                    global $_pagesize,$_pagenum;
                    if ($_GET[‘userType‘]=="") {
                        _page(‘SELECT id FROM tb_user‘,10);
                        $_sql = "SELECT * FROM tb_user LIMIT $_pagenum,$_pagesize";
                    }else{
                        _page("SELECT id FROM tb_user WHERE identity = ‘{$_GET[‘identity‘]}‘ && state = ‘{$_GET[‘state‘]}‘",10);
                        $_sql = "SELECT * FROM tb_user WHERE identity = ‘{$_GET[‘identity‘]}‘ && state = ‘{$_GET[‘state‘]}‘ LIMIT $_pagenum,$_pagesize";
                    }    
                    if ( $_GET[‘action‘] == ‘search‘ ) {
                        $_clean = array();
                        $_clean[‘stype‘] = _check($_POST[‘stype‘]);
                        $_clean[‘key‘] = _check($_POST[‘key‘]);
                    
                    if ( $_clean[‘stype‘] == ‘regName‘ ) {
                        $_sql = "SELECT * FROM tb_user WHERE regName = ‘{$_clean[‘key‘]}‘";
                        }
                        }
                    $_result = _query($_sql);
                      $_row = _num_rows($_result);
                    if ( $_row > 0 ) {
                        while ( $_rows = _fetch_array($_result) ) {
                            $_html = array();
                            $_html[‘id‘] = $_rows[‘id‘];
                            $_html[‘regName‘] = $_rows[‘regName‘];
                            $_html[‘totalSyJf‘] = $_rows[‘totalSyJf‘];
                            $_html[‘cash‘] = $_rows[‘cash‘];
                            $_html[‘realName‘] = $_rows[‘realName‘];
                            switch ( $_rows[‘state‘] ) {
                                case 0:
                                    $_html[‘state‘] = ‘正常‘;
                                    break;
                                case 1:
                                    $_html[‘state‘] = ‘冻结‘;
                                    break;
                                case 10:
                                    $_html[‘state‘] = ‘未激活‘;
                                    break;
                            }
                            $_sql1 = "SELECT levelName FROM tb_level WHERE id = ‘{$_rows[‘level‘]}‘";
                            $_result1 = _query($_sql1);
                            $_rows1 = _fetch_array($_result1);
                            $_html[‘level‘] = $_rows1[‘levelName‘];
                            
                            switch ( $_rows[‘identity‘] ) {
                                case 1:
                                    $_html[‘identity‘] = ‘个人会员‘;
                                    break;
                                case 2:
                                    $_html[‘identity‘] = ‘企业会员‘;
                                    break;
                            }
                            $_html = _html($_html);
                          ?>
                  <tr align="center" bgcolor="#F2F2F2">
                    <td  class="left_txt2"><?php echo $_html[‘regName‘]?></td>
                    <td  class="left_txt2"><?php echo $_html[‘identity‘]?></td>
                    <td  class="left_txt2"><?php echo $_html[‘level‘]?></td>
                    <td  class="left_txt2"><?php echo $_html[‘totalSyJf‘]?></td>
                    <td  class="left_txt2"><?php echo $_html[‘cash‘]?></td>
                    <td  class="left_txt2"><?php echo $_html[‘realName‘]?></td>
                    <td  class="left_txt2"><?php echo $_html[‘state‘]?></td>
                    <td width="13%"  class="left_txt2">
                        <a href=http://www.mamicode.com/‘user_edit.php?id=<?php echo $_html[‘id‘]?>‘>修改

                    </td>
                  </tr>
                   <?php
                    }
                    ?>
                <?php
                    } else {
                    ?>
                <tr bgcolor="#F2F2F2" class="left_txt2" align="center" >
                  <td colspan="9">暂无信息</td>
                </tr>
                <?php    
                    }
                    _free_result($_result);
                    _close();
                    ?>
                <tr bgcolor="#F2F2F2" class="left_txt2" align="center" >
                  <td colspan="9">
                 <?php
                    _paging(2);
                    ?>
              </table></td>
          </tr>
        </table>
      </div></td>
    <td background="images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="images/mail_leftbg.gif"><img src="http://www.mamicode.com/images/buttom_left2.gif" width="17" height="17" /></td>
    <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="http://www.mamicode.com/images/buttom_bgs.gif" width="17" height="17" /></td>
    <td background="images/mail_rightbg.gif"><img src="http://www.mamicode.com/images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>
</body>
</html>


修改会员
<?php

    require ‘includes/common.inc.php‘;
    
    session_start();
    
    if ( !isset($_SESSION[‘username‘]) ) {
        _location(‘请先登录‘,‘login.php‘);
    }
    
    if ( isset($_GET[‘id‘]) ) {
        $_sql = "SELECT * FROM tb_user WHERE id = ‘{$_GET[‘id‘]}‘";
        $_result = _query($_sql);
        $_rows = _fetch_array($_result);
        $_html = array();
        $_html[‘regName‘] = $_rows[‘regName‘];
        $_html[‘Email‘] = $_rows[‘Email‘];
        $_html[‘regPwd‘] = $_rows[‘regPwd‘];
        $_html[‘tradingPwd‘] = $_rows[‘tradingPwd‘];
        $_html[‘encryptedQuestion‘] = $_rows[‘encryptedQuestion‘];
        $_html[‘encryptedAnswer‘] = $_rows[‘encryptedAnswer‘];
        $_html[‘userimage‘] = $_rows[‘userimage‘];
        $_html[‘realName‘] = $_rows[‘realName‘];
        $_html[‘province‘] = $_rows[‘province‘];
        $_html[‘theCity‘] = $_rows[‘theCity‘];
        $_html[‘county‘] = $_rows[‘county‘];
        $_html[‘address‘] = $_rows[‘address‘];
        $_html[‘qq‘] = $_rows[‘qq‘];
        $_html[‘phone‘] = $_rows[‘phone‘];
        $_html[‘totalSyJf‘] = $_rows[‘totalSyJf‘];
        $_html[‘cash‘] = $_rows[‘cash‘];
        $_html[‘level‘] = $_rows[‘level‘];
        $_html[‘levelDate‘] = $_rows[‘levelDate‘];
        $_html[‘userType‘] = $_rows[‘userType‘];
        $_html[‘state‘] = $_rows[‘state‘];
        
        $_sql2 = "SELECT regName FROM tb_user WHERE id = ‘{$_rows[‘isfrom1‘]}‘";
        $_result2 = _query($_sql2);
        $_rows2 = _fetch_array($_result2);
        $_html[‘isfrom1‘] = $_rows2[‘regName‘];
        
        $_sql3 = "SELECT regName FROM tb_user WHERE id = ‘{$_rows[‘isfrom2‘]}‘";
        $_result3 = _query($_sql3);
        $_rows3 = _fetch_array($_result3);
        $_html[‘isfrom2‘] = $_rows3[‘regName‘];
        
        $_sqlProvince = "SELECT areaName FROM tb_area WHERE id = ‘{$_html[‘province‘]}‘";
        $_resultProvince = _query($_sqlProvince);
        $_rowsProvince = _fetch_array($_resultProvince);
        
        $_sqlCity = "SELECT areaName FROM tb_area WHERE id = ‘{$_html[‘theCity‘]}‘";
        $_resultCity = _query($_sqlCity);
        $_rowsCity = _fetch_array($_resultCity);
        
        $_sqlCounty = "SELECT areaName FROM tb_area WHERE id = ‘{$_html[‘county‘]}‘";
        $_resultCounty = _query($_sqlCounty);
        $_rowsCounty = _fetch_array($_resultCounty);
        
        $_html = _html($_html);
    }
    if ( isset($_GET[‘id‘]) && $_GET[‘action‘] == ‘update‘ ){
        $_clean = array();
        $_clean[‘regPwd‘] = _check($_POST[‘regPwd‘]);
        $_clean[‘tradingPwd‘] = _check($_POST[‘tradingPwd‘]);
        $_clean[‘level‘] = _check($_POST[‘level‘]);
        $_clean[‘state‘] = _check($_POST[‘state‘]);
        $_sql1 = "UPDATE
                        tb_user
                     SET
                         regPwd = ‘{$_clean[‘regPwd‘]}‘,
                        tradingPwd = ‘{$_clean[‘tradingPwd‘]}‘,
                        level = ‘{$_clean[‘level‘]}‘,
                        state = ‘{$_clean[‘state‘]}‘
                   WHERE
                           id = ‘{$_GET[‘id‘]}‘";
        _query($_sql1);
        
        if ( _affected_rows() == 1 ) {
            _close();
            _alert_back(‘修改成功!‘);
        } else {
            _close();
            _alert_back(‘修改失败!‘);
        }
    }
    
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台管理--修改会员信息</title>
<script src="http://www.mamicode.com/js/setday.js" type="text/javascript"></script>
<script type="text/javascript">
window.onload = function(){

    var ret = document.getElementById(‘return‘);
    
    ret.onclick = function(){
        
        history.back(-1);
    
    };
    
}
</script>
<style type="text/css">
<!--
*{ margin:0;
padding:0;}
body {
    
}
-->
</style>
<link href="http://www.mamicode.com/images/skin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="http://www.mamicode.com/images/left-top-right.gif" width="17" height="29" /></td>
    <td  valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
        <tr>
          <td height="31"><div class="titlebt">会员管理</div></td>
        </tr>
      </table>
    <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="http://www.mamicode.com/images/nav-right-bg.gif" width="16" height="29" /></td>
  <tr>
    <td height="71" valign="middle" background="images/mail_leftbg.gif"></td>
    <td valign="top" bgcolor="#F7F8F9"><div>
        <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">                             <tr><td height="10"></td></tr>
          <tr>
            <td><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="nowtable">
                <form name="admin" id="admin" method="POST" action="?action=update&id=<?php echo $_GET[‘id‘]?>">
                  <tr bgcolor="#f2f2f2">
                    <td width="34%" align="right" class="left_txt2"> 账号名称:</td>
                    <td width="16%" class="left_txt2"><?php echo $_html[‘regName‘]?></td>
                    <td width="14%" align="right" class="left_txt2" >现金余额:</td>
                    <td width="36%" class="left_txt2"><?php echo $_html[‘cash‘]?></td>
                  </tr>
                  <tr bgcolor="#f2f2f2">
                    <td align="right" class="left_txt2">账号邮箱:</td>
                    <td class="left_txt2"><?php echo $_html[‘Email‘]?></td>
                    <td align="right" class="left_txt2">真实名称:</td>
                    <td class="left_txt2"><?php echo $_html[‘realName‘]?></td>
                  </tr>
                  <tr bgcolor="#f2f2f2">
                    <td align="right" class="left_txt2">密码:</td>
                    <td class="left_txt2"><input type="password" name="regPwd" size="20" id="regPwd"value="http://www.mamicode.com/<?php echo $_html[‘regPwd‘] ?>" /></td>
                    <td align="right" class="left_txt2">省:</td>
                    <td class="left_txt2"><?php echo $_rowsProvince[‘areaName‘]?></td>
                  </tr>
                  <tr bgcolor="#f2f2f2">
                    <td align="right" class="left_txt2">交易密码:</td>
                    <td class="left_txt2"><input type="password" name="tradingPwd" size="20" id="tradingPwd" value="http://www.mamicode.com/<?php echo $_html[‘tradingPwd‘] ?>"/></td>
                    <td class="left_txt2" align="right" >市:</td>
                    <td class="left_txt2"><?php echo $_rowsCity[‘areaName‘]?></td>
                  </tr>
                  <tr bgcolor="#f2f2f2">
                    <td class="left_txt2" align="right" >密码问题:</td>
                    <td class="left_txt2"><?php echo $_html[‘encryptedQuestion‘]?></td>
                    <td class="left_txt2" align="right" >县:</td>
                    <td class="left_txt2"><?php echo $_rowsCounty[‘areaName‘]?></td>
                  </tr>
                  <tr bgcolor="#f2f2f2">
                    <td align="right" class="left_txt2">密保答案:</td>
                    <td class="left_txt2"><?php echo $_html[‘encryptedAnswer‘]?></td>
                    <td class="left_txt2" align="right">详细地址:</td>
                    <td class="left_txt2"><?php echo $_html[‘address‘]?></td>
                  </tr>
                  <tr bgcolor="#f2f2f2">
                    <td class="left_txt2" align="right" >QQ:</td>
                    <td class="left_txt2"><?php echo $_html[‘qq‘]?></td>
                    <td align="right" class="left_txt2">用户等级:</td>
                    <td class="left_txt2"><select name="level" id="level">
                        <option value="">--请选择用户等级--</option>
                        <?php
                                $_sql4 = "SELECT id,levelName FROM tb_level WHERE state = 0";
                                $_result4 = _query($_sql4);
                                while( $_rows4 = _fetch_array($_result4) ){    
                            ?>
                        <option value="http://www.mamicode.com/<?php echo $_rows4[‘id‘] ?>" <?php if($_html[‘level‘] == $_rows4[‘id‘]) echo "selected=‘selected‘"; ?>><?php echo $_rows4[‘levelName‘] ?></option>
                        <?php
                                }
                                _free_result($_result4);
                            ?>
                      </select>
                    </td>
                  </tr>
                  <tr bgcolor="#f2f2f2">
                    <td align="right" class="left_txt2">电话:</td>
                    <td class="left_txt2"><?php echo $_html[‘phone‘]?></td>
                    <td class="left_txt2" align="right" >会员有效期:</td>
                    <td class="left_txt2"><?php echo $_html[‘levelDate‘]?></td>
                  </tr>
                  <tr bgcolor="#f2f2f2">
                    <td align="right" class="left_txt2">易币余额:</td>
                    <td class="left_txt2"><?php echo $_html[‘totalSyJf‘]?></td>
                    <td align="right" class="left_txt2">状态:</td>
                    <td class="left_txt2"><select name="state" id="state">
                        <option value="http://www.mamicode.com/0" <?php if($_html[‘state‘] == 0) echo "selected=‘selected‘"; ?>>正常</option>
                        <option value="http://www.mamicode.com/1" <?php if($_html[‘state‘] == 1) echo "selected=‘selected‘"; ?>>冻结</option>
                        <option value="http://www.mamicode.com/10" <?php if($_html[‘state‘] == 10) echo "selected=‘selected‘"; ?>>未激活</option>
                      </select>
                    </td>
                  </tr>
                  <tr bgcolor="#f2f2f2">
                    <td align="right" class="left_txt2">直接推广员:</td>
                    <td class="left_txt2"><?php echo $_html[‘isfrom1‘]?></td>
                    <td align="right" class="left_txt2">间接推广员:</td>
                    <td class="left_txt2"><?php echo $_html[‘isfrom2‘]?></td>
                  </tr>
                  <tr bgcolor="#f2f2f2">
                    <td align="right" class="left_txt2">会员图像:</td>
                    <td class="left_txt2" colspan="3"><img src="http://www.mamicode.com/<?php echo $_html[‘userimage‘]?>" /></td>
                  </tr>
                  <tr>
                    <td colspan="4" align="center" bgcolor="#F2F2F2" class="left_txt2"><input type="submit" name="button" id="button" value="http://www.mamicode.com/修改" />
                      <input type="button" value="http://www.mamicode.com/返回" id="return" />
                    </td>
                  </tr>
                </form>
              </table></td>
          </tr>
        </table>
        <!---->
      </div></td>
    <td background="images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="images/mail_leftbg.gif"><img src="http://www.mamicode.com/images/buttom_left2.gif" width="17" height="17" /></td>
    <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="http://www.mamicode.com/images/buttom_bgs.gif" width="17" height="17" /></td>
    <td background="images/mail_rightbg.gif"><img src="http://www.mamicode.com/images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>
</body>
</html>



添加会员

<?php

    require ‘includes/common.inc.php‘;
    session_start();
    if ( !isset($_SESSION[‘username‘]) ) {
        _location(‘请先登录!‘,‘login.php‘);
    }
    
    
    
    $_now = date(‘Y-m-d H:i:s‘,time());
    
    if ( $_GET[‘action‘] == ‘add‘ ) {
        $_clean = array();
        $_clean[‘regIP‘] = $_SERVER["REMOTE_ADDR"];
        $_clean[‘regName‘] = _check($_POST[‘regName‘]);
        $_clean[‘Email‘] = _check($_POST[‘Email‘]);
        $_clean[‘regPwd‘] = md5(($_POST[‘regPwd‘]));
        $_clean[‘tradingPwd‘] = md5(($_POST[‘tradingPwd‘]));
        $_clean[‘encryptedQuestion‘] = _check($_POST[‘encryptedQuestion‘]);
        $_clean[‘encryptedAnswer‘] = md5(($_POST[‘encryptedAnswer‘]));
        $_clean[‘userimage‘] = $_POST[‘userimage‘];
        $_clean[‘realName‘] = _check($_POST[‘realName‘]);
        $_clean[‘province‘] = _check($_POST[‘province‘]);
        $_clean[‘theCity‘] = _check($_POST[‘theCity‘]);
        $_clean[‘county‘] = _check($_POST[‘county‘]);
        $_clean[‘address‘] = _check($_POST[‘address‘]);
        $_clean[‘qq‘] = _check($_POST[‘qq‘]);
        $_clean[‘phone‘] = _check($_POST[‘phone‘]);
        $_clean[‘totalSyJf‘] = _check($_POST[‘totalSyJf‘]);
        $_clean[‘cash‘] = _check($_POST[‘cash‘]);
        $_clean[‘level‘] = _check($_POST[‘level‘]);
        $_clean[‘levelDate‘] = _check($_POST[‘levelDate‘]);
        $_clean[‘userType‘] = _check($_POST[‘userType‘]);
        $_clean[‘isfrom1‘] = _check($_POST[‘isfrom1‘]);
        $_clean[‘lotteryNumber‘] = _check($_POST[‘lotteryNumber‘]);
        
        $_sql = "SELECT isfrom1 FROM tb_user WHERE id = ‘{$_clean[‘isfrom1‘]}‘";
        $_result = _query($_sql);
        $_rows = _fetch_array($_result);
        $_sqlAdd = "INSERT INTO tb_user VALUES (NULL,‘{$_clean[‘regIP‘]}‘,‘$_now‘,‘{$_clean[‘regName‘]}‘,‘{$_clean[‘Email‘]}‘,‘{$_clean[‘regPwd‘]}‘,‘{$_clean[‘tradingPwd‘]}‘,‘{$_clean[‘encryptedQuestion‘]}‘,‘{$_clean[‘encryptedAnswer‘]}‘,‘{$_clean[‘userimage‘]}‘,‘{$_clean[‘realName‘]}‘,‘{$_clean[‘province‘]}‘,‘{$_clean[‘theCity‘]}‘,‘{$_clean[‘county‘]}‘,‘{$_clean[‘address‘]}‘,‘{$_clean[‘qq‘]}‘,‘{$_clean[‘phone‘]}‘,‘{$_clean[‘totalSyJf‘]}‘,‘{$_clean[‘cash‘]}‘,‘{$_clean[‘level‘]}‘,0,1,‘{$_clean[‘isfrom1‘]}‘,‘{$_rows[‘isfrom1‘]}‘,0,‘{$_rows[‘lotteryNumber‘]}‘)";
        _query($_sqlAdd);
        
        if ( _affected_rows() == 1 ) {
            _close();
            _location(‘添加成功!‘,‘user.php‘);
        } else {
            _close();
            _location(‘添加失败!‘,‘user_add.php‘);
        }
    }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://www.mamicode.com/js/setday.js" type="text/javascript"></script>
<title>后台管理--添加会员</title>
<style type="text/css">
*{
    margin:0;
    padding:0;
}
body {
    background-color: #F8F9FA;
}
</style>
<link href="http://www.mamicode.com/images/skin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
//市 数据保存到数组
var subvalCity = new Array();
<?php
$rs = _query("select * from tb_area where areaType=2 and state=0 order by sort asc");
$counts = 0;
while( $row = _fetch_array($rs) ){
?>
subvalCity[<?php echo $counts?>] = new Array(‘<?php echo $row["areaId"]?>‘,‘<?php echo $row["id"]?>‘,‘<?php echo $row["areaName"]?>‘)
<?php
$counts = $counts + 1;
}
_free_result($rs);
?>
function provinceChange(locationid)
{
    document.admin.theCity.length = 0;
    document.admin.theCity.options[0] = new Option(‘--请选择市--‘,‘0‘);
    document.admin.county.length = 0;
    document.admin.county.options[0] = new Option(‘--请选择区县--‘,‘0‘);
    for (i=0; i<subvalCity.length; i++)
    {
        if (subvalCity[i][0] == locationid) {
            document.admin.theCity.options[document.admin.theCity.length] = new Option(subvalCity[i][2],subvalCity[i][1]);
        }
    }
}

//区 数据保存到数组
var subvalCounty = new Array();
<?php
$rs1 = _query("select * from tb_area where areaType=3 and state=0 order by sort asc");
$counts1 = 0;
while( $row1 = _fetch_array($rs1) ){
?>
subvalCounty[<?php echo $counts1?>] = new Array(‘<?php echo $row1["areaId"]?>‘,‘<?php echo $row1["id"]?>‘,‘<?php echo $row1["areaName"]?>‘)
<?php
$counts1 = $counts1 + 1;
}
_free_result($rs1);
?>
function theCityChange(locationid)
{
    document.admin.county.length = 0;
    document.admin.county.options[0] = new Option(‘--请选择区县--‘,‘0‘);
    for (i=0; i<subvalCounty.length; i++)
    {
        if (subvalCounty[i][0] == locationid) {
            document.admin.county.options[document.admin.county.length] = new Option(subvalCounty[i][2],subvalCounty[i][1]);
        }
    }
}

function test()
{
    if(document.admin.regName.value=http://www.mamicode.com/=‘‘)
    {
        alert(‘请输入账号名称‘);
        return false;
    }
    if(document.admin.Email.value=http://www.mamicode.com/=‘‘)
    {
       alert(‘请输入账号邮箱‘);
       return false;
    }
    if(document.admin.regPwd.value=http://www.mamicode.com/=‘‘)
    {
        alert(‘请输入账号密码‘);
        return false;
    }
    if(document.admin.tradingPwd.value=http://www.mamicode.com/=‘‘)
    {
        alert(‘交易密码‘);
        return false;
    }
    if(document.admin.encryptedQuestion.value=http://www.mamicode.com/=‘‘)
    {
        alert(‘密码问题‘);
        return false;
    }
    return true;
}
 </script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
 
  <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="http://www.mamicode.com/images/left-top-right.gif" width="17" height="29" /></td>
  <td  valign="top" background="images/content-bg.gif">
      <table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><div class="titlebt">会员管理</div></td>
      </tr>
    </table>
  <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="http://www.mamicode.com/images/nav-right-bg.gif" width="16" height="29" /></td>
  <tr>
    <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><div>
        <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr><td height="10"></td></tr>
          <tr>
            <td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="nowtable">
                <form name="admin" id="admin" method="POST" action="?action=add" onsubmit="return test();">
                  <tr bgcolor="#f2f2f2">
                    <td width="25%" align="right" class="left_txt2" > 账号名称:</td>
                    <td width="21%" class="left_txt2"><input type="text" name="regName" size="30" id="regName" /></td>
                    <td width="11%" align="right" class="left_txt2" >会员图像:</td>
                    <td width="43%"  class="left_txt2"><input type="text" name="userimage" id="userimage" style="width:152px" />
                    <input type="button" value="http://www.mamicode.com/上传" onClick="window.open(‘../admin/upload.php?formname=admin&editname=userimage‘,‘‘,‘status=no,scrollbars=no,top=35,width=650,height=350‘)"/></td>
                  </tr>
                  <tr bgcolor="#f2f2f2">
                    <td align="right" class="left_txt2">账号邮箱:</td>
                    <td class="left_txt2"><input type="text" name="Email" size="30" id="Email" /></td>
                    <td align="right" class="left_txt2">真实名称:</td>
                    <td class="left_txt2"><input type="text" name="realName" size="30" id="realName" /></td>
                  </tr>
                  <tr bgcolor="#f2f2f2">
                    <td align="right" class="left_txt2">密码:</td>
                    <td class="left_txt2"><input type="password" name="regPwd" size="30" id="regPwd" /></td>
                    <td class="left_txt2" align="right">省:</td>
                    <td class="left_txt2"><select id="province" name="province" onchange="provinceChange(this.value) ">
                        <option value="" >请选择省份</option>
                        <?php
                            $_sql = "SELECT id,areaName FROM tb_area WHERE areaType = 1 AND state = 0";
                            $_result = _query($_sql);
                            while( $_rows = _fetch_array($_result) ){
                                $_html = array();
                                $_html[‘id‘] = $_rows[‘id‘];
                                $_html[‘areaName‘] = $_rows[‘areaName‘];
                                $_html = _html($_html);        
                            ?>
                        <option value="http://www.mamicode.com/<?php echo $_html[‘id‘] ?>" <?php if($_html3[‘province‘] == $_html[‘id‘]){?> selected="selected"<?php }?>><?php echo $_html[‘areaName‘] ?></option>
                        <?php
                            }
                            _free_result($_result);
                        ?>
                      </select>
                    </td>
                  </tr>
                  <tr bgcolor="#f2f2f2">
                    <td align="right" class="left_txt2">交易密码:</td>
                    <td class="left_txt2"><input type="password" name="tradingPwd" size="30" id="tradingPwd" /></td>
                    <td class="left_txt2" align="right">市:</td>
                    <td class="left_txt2"><select name="theCity" id="theCity"  onchange="theCityChange(this.value)">
                        <option value="http://www.mamicode.com/0">-- 请选择市--</option>
                        <?php
                                $_sql = "SELECT id,areaName FROM tb_area WHERE areaType = 2 AND state = 0";
                                $_result = _query($_sql);
                                while( $_rows = _fetch_array($_result) ){
                                    $_html = array();
                                    $_html[‘id‘] = $_rows[‘id‘];
                                    $_html[‘areaName‘] = $_rows[‘areaName‘];
                                    $_html = _html($_html);        
                                ?>
                        <option value="http://www.mamicode.com/<?php echo $_html[‘id‘] ?>" <?php if($_html3[‘theCity‘] == $_html[‘id‘]){?> selected="selected"<?php }?>><?php echo $_html[‘areaName‘] ?></option>
                        <?php
                                }
                                _free_result($_result);
                            ?>
                      </select>
                    </td>
                  </tr>
                  <tr bgcolor="#f2f2f2">
                    <td align="right" class="left_txt2">密码问题:</td>
                    <td class="left_txt2"><input type="text" name="encryptedQuestion" size="30" id="encryptedQuestion" /></td>
                    <td class="left_txt2" align="right">区县:</td>
                    <td class="left_txt2"><select name="county" id="county" onChange="countyChange(this.value)" >
                        <option value="http://www.mamicode.com/0">--请选择区县--</option>
                        <?php
                                if( $_html3[‘theCity‘] > 0 ){
                                    $_sql2 = "SELECT id,areaName FROM tb_area WHERE areaType = 3 AND areaId = ‘{$_html3[‘theCity‘]}‘ AND state = 0";
                                    $_result2 = _query($_sql2);
                                    while( $_rowsCounty = _fetch_array($_result2) ){
                            ?>
                        <option value="http://www.mamicode.com/<?php echo $_rowsCounty[‘id‘] ?>" <?php if($_html3["county"] == $_rowsCounty[‘id‘]){?> selected="selected"<?php }?>><?php echo $_rowsCounty[‘areaName‘] ?></option>
                        <?php
                                    }
                                    _free_result($_result2);
                                }
                            ?>
                      </select>
                    </td>
                  </tr>
                  <tr bgcolor="#f2f2f2">
                    <td align="right" class="left_txt2">密保答案:</td>
                    <td class="left_txt2"><input type="password" name="encryptedAnswer" size="30" id="encryptedAnswer" /></td>
                    <td class="left_txt2" align="right" >详细地址:</td>
                    <td class="left_txt2"><input name="address" type="text" id="address" size="30"/></td>
                  </tr>
                  <tr bgcolor="#f2f2f2" >
                    <td align="right" class="left_txt2">QQ:</td>
                    <td class="left_txt2"><input type="text" name="qq" size="30" id="qq" /></td>
                    <td align="right" class="left_txt2">用户等级:</td>
                    <td class="left_txt2"><select name="level" id="level">
                        <option value="">--请选择用户等级--</option>
                        <?php
                                $_sql4 = "SELECT id,levelName FROM tb_level WHERE state = 0";
                                $_result4 = _query($_sql4);
                                while( $_rows4 = _fetch_array($_result4) ){    
                            ?>
                        <option value="http://www.mamicode.com/<?php echo $_rows4[‘id‘] ?>"><?php echo $_rows4[‘levelName‘] ?></option>
                        <?php
                                }
                                _free_result($_result4);
                            ?>
                      </select>
                    </td>
                  </tr>
                  <tr bgcolor="#f2f2f2">
                    <td align="right" class="left_txt2">电话:</td>
                    <td bgcolor="#f2f2f2"><input name="phone" type="text" id="phone" size="30" /></td>
                    <td align="right" class="left_txt2">会员类型:</td>
                    <td class="left_txt2"><select name="userType" id="userType">
                        <option value="">--请选择会员类型--</option>
                        <option value="http://www.mamicode.com/1">个人会员</option>
                        <option value="http://www.mamicode.com/2">商家会员</option>
                      </select></td>
                  </tr>
                  <tr bgcolor="#f2f2f2">
                    <td class="left_txt2" align="right" >易币余额:</td>
                    <td class="left_txt2" ><input name="totalSyJf" type="text" id="totalSyJf" size="30" /></td>
                    <td class="left_txt2" align="right">会员有效期:</td>
                    <td class="left_txt2"><input name="levelDate" type="text" id="levelDate" size="30" onclick="new Calendar().show(this);" readonly="readonly"/></td>
                  </tr>
                  <tr bgcolor="#f2f2f2">
                    <td class="left_txt2" align="right">现金余额:</td>
                    <td class="left_txt2"><input type="text" name="cash" id="cash" size="30" /></td>
                    <td align="right" class="left_txt2">直接推广人ID:</td>
                    <td class="left_txt2"><input type="text" name="isfrom1" id="isfrom1" size="30" /></td>
                  </tr>
                  <tr>
                    <td bgcolor="#f2f2f2" colspan="4" align="center" class="left_txt"><input type="submit" name="button" id="button" value="http://www.mamicode.com/创建" />
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                      <input type="reset" name="button2" id="button2" value="http://www.mamicode.com/重置" /></td>
                  </tr>
                </form>
              </table></td>
          </tr>
        </table>
        <!---->
      </div></td>
    <td background="images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="images/mail_leftbg.gif"><img src="http://www.mamicode.com/images/buttom_left2.gif" width="17" height="17" /></td>
    <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="http://www.mamicode.com/images/buttom_bgs.gif" width="17" height="17" /></td>
    <td background="images/mail_rightbg.gif"><img src="http://www.mamicode.com/images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>
</body>
</html>





php杂乱