<?php require_once "db/db_client_class.php"; $account_db = new CDBAccount(); if (!$account_db) { exit; } $id = 0; if (!empty($weixin) && !empty($account)) { $res = array(); $id_status = $account_db->queryAccountInfoByAccountPasswd($account, $passwd); if (count($id_status) <= 0) { //如果账号密码不对,则查看一下账号是否存在 $id_status2 = $account_db->queryAccountInfoByAccount($account); if (count($id_status2) <= 0) { //如果账号不存在,则直接注册绑定新账号 $id = $account_db->insertAccountInfo($name, $account, $passwd, $weixin, $phone, $email, $type); } } else { //账号密码正确,直接绑定账号 $id = $account_db->bindAccountOpenid($account, $weixin); } } if ($id <= 0) { $res['register_status'] = 'failed'; } else { $res['register_status'] = 'success'; } echo json_encode($res);
<?php require_once "db/db_account_class.php"; $account_db = new CDBAccount(); if (!$account_db) { exit; } $username = $params['username']; $password = $params['password']; $email = $params['email']; $phonenumber = $params['phonenumber']; $site = $params['site']; $time = time(); $id = 0; $id = $account_db->insertAccountInfo($username, $phonenumber, $password, $email, $site, $time); if ($id <= 0) { $res['register_status'] = 'failed'; } else { $res['register_status'] = 'success'; } echo json_encode($res);