window.location.href='./login.php';"); ?>
getAll("SELECT * FROM pre_group"); foreach($rs as $row){ $usergroup[$row['gid']] = $row['name']; $select.=''; } unset($rs); $my=isset($_GET['my'])?$_GET['my']:null; if($my=='add') { echo '

添加商户

'; echo '
'; echo '
















'; echo '
>>返回商户列表'; echo '
'; } elseif($my=='edit') { $uid=intval($_GET['uid']); $row=$DB->getRow("select * from pre_user where uid='$uid' limit 1"); if(!$row)showmsg('该商户不存在',4); echo '

修改商户信息

'; echo '
'; echo '

















'; echo '
>>返回商户列表'; echo '
'; } elseif($my=='add_submit') { $gid=$_POST['gid']; $settle_id=$_POST['settle_id']; $account=$_POST['account']; $username=$_POST['username']; $money='0.00'; $url=$_POST['url']; $email=$_POST['email']; $qq=$_POST['qq']; $phone=$_POST['phone']; $certno=$_POST['certno']; $certname=$_POST['certname']; $cert=$_POST['cert']; $mode=$_POST['mode']; $pay=$_POST['pay']; $settle=$_POST['settle']; $status=$_POST['status']; if($account==NULL or $username==NULL){ showmsg('保存错误,请确保加*项都不为空!',3); } else { $key = random(32); $sds=$DB->exec("INSERT INTO `pre_user` (`gid`, `key`, `account`, `username`, `money`, `url`, `addtime`, `settle_id`, `phone`, `email`, `qq`, `certno`, `certname`, `cert`, `mode`, `pay`, `settle`, `status`) VALUES ('{$gid}', '{$key}', '{$account}', '{$username}', '{$money}', '{$url}', '{$date}', '{$settle_id}', '{$phone}', '{$email}', '{$qq}', '{$certno}', '{$certname}', '{$cert}', '{$mode}', '{$pay}', '{$settle}', '{$status}')"); $uid=$DB->lastInsertId(); if($sds){ if(!empty($_POST['pwd'])){ $pwd = getMd5Pwd(trim($_POST['pwd']), $uid); $DB->exec("update `pre_user` set `pwd` ='{$pwd}' where `uid`='$uid'"); } showmsg('添加商户成功!商户ID:'.$uid.'
密钥:'.$key.'

>>返回商户列表',1); }else showmsg('添加商户失败!
错误信息:'.$DB->error(),4); } } elseif($my=='edit_submit') { $uid=$_GET['uid']; $rows=$DB->getRow("select * from pre_user where uid='$uid' limit 1"); if(!$rows) showmsg('当前商户不存在!',3); $gid=$_POST['gid']; $settle_id=$_POST['settle_id']; $account=$_POST['account']; $username=$_POST['username']; $money=$_POST['money']; $url=$_POST['url']; $email=$_POST['email']; $qq=$_POST['qq']; $phone=$_POST['phone']; $certno=$_POST['certno']; $certname=$_POST['certname']; $cert=$_POST['cert']; $mode=$_POST['mode']; $pay=$_POST['pay']; $settle=$_POST['settle']; $status=$_POST['status']; if($account==NULL or $username==NULL){ showmsg('保存错误,请确保加*项都不为空!',3); } else { $sql="update `pre_user` set `gid` ='$gid',`account` ='{$account}',`username` ='{$username}',`settle_id` ='$settle_id',`money` ='{$money}',`url` ='{$url}',`email` ='$email',`qq` ='$qq',`phone` ='$phone',`certno` ='$certno',`certname` ='$certname',`cert` ='$cert',`mode` ='$mode',`pay` ='$pay',`settle` ='$settle',`status` ='$status' where `uid`='$uid'"; if(!empty($_POST['pwd'])){ $pwd = getMd5Pwd(trim($_POST['pwd']), $uid); $sqs=$DB->exec("update `pre_user` set `pwd` ='{$pwd}' where `uid`='$uid'"); } if($DB->exec($sql)!==false||$sqs) showmsg('修改商户信息成功!

>>返回商户列表',1); else showmsg('修改商户信息失败!'.$DB->error(),4); } } elseif($my=='delete') { $uid=$_GET['uid']; $sql="DELETE FROM pre_user WHERE uid='$uid'"; if($DB->exec($sql)) exit(""); else exit(""); } ?>