public static function real($set) { //判断有没有通过实名认证,如果没有,则开始,有则返回 $db_link = new db_union_mysql(); switch ($set) { case 'set': if ($_POST) { $data['name'] = $_POST['name']; $data['card_type'] = $_POST['card_type']; $data['card_id'] = $_POST['card_id']; $data['card_img'] = $_POST['card_img']; $data['card_img_2'] = $_POST['card_img_2']; $data['rid'] = $db_link->db_select_id(db_id, $_SESSION[uid], '该用户的实名认证记录')[num]; $real = $data['rid']; $real = $db_link->db_inset('`real`', '', "{$_SESSION['uid']},{$data['rid']},'{$data['name']}'," . "'{$data['card_type']}',{$data['card_id']},'{$data['card_img']}','{$data['card_img_2']}',now(),null,null"); //更新实名认证状态记录 $real = $db_link->db_edit('user', 'u_real=1', "uid={$_SESSION['uid']}"); } break; default: $real = $db_link->db_read('`real`', '', 'uid', $_SESSION[uid]); break; } $db_link->db_closemysql($db_link, $real); return $real ? $real : NULL; }
public static function wirteData() { //连接数据库 $dbLink = new db_union_mysql(); //创建全局id索引表 $id = $dbLink->db_select_id('u_user', 'user_reg', HOST_USER, '创建新用户'); //如果创建一个全局id成功,就开始写入用户列表,用数组 $id['ok']的值来判断是否写入数据库中成功,成功则开始写入数据库u_user表中 if ($id['ok']) { $db = self::$data; $id['ok'] = $dbLink->db_inset('u_user', '', "{$id['id']},NULL,'{$db['name']}',{$db['u_phone']},\n NULL,NULL,NULL,'{$db['pass']}','0.png',1,{$db['sex']},0,now(),'{$_SERVER['SERVER_ADDR']}'"); } else { //全局注册失败,返回一个错误号 $writeErr = new error_App('user_reg'); } //注册成功,执行写入操作并关闭数据库 $dbLink->db_closemysql($dbLink, $id['ok']); //在session中记录相应的用户帐号和登录状态 $_SESSION['uid'] = $id['id']; $_SESSION['login'] = 1; return TRUE; }
function db_inset($biao, $name = '', $value = '') { //判断有没有字段值 if (!$name) { // echo "INSERT INTO $biao VALUES ($value)"; self::$return = $this->db_query("INSERT INTO {$biao} VALUES ({$value})"); // or die('操作失败' . mysql_error()); } else { // echo "INSERT INTO $biao ($name) VALUES ($value)"; self::$return = $this->db_query("INSERT INTO {$biao} ({$name}) VALUES ({$value})"); // or die('操作失败' . mysql_error()); } return self::$return; }