$email = $_POST['email']; $captcha = $_POST['captcha']; $code = $code ? $code : ""; $id = $id ? $id : 0; $method = $method ? $method : ''; $email = $email ? $email : ''; $captcha = $captcha ? $captcha : ''; if ($method == 'active') { $db = new MySQL($log); if ($mysqli = $db->openDB()) { $user = new User($mysqli, $log); $invitation = new Invitation($mysqli, $log); if ($user->getUserByID($id)) { if ($user->status == 2) { $s_email = $user->email; $v_res = $invitation->validateEmailCode($code, $id); if ($v_res['result']) { $user->status = 1; if ($user->updateUser($id)) { $res['result'] = true; $res['message'] = '恭喜您,用户已激活成功'; $res['action'] = 'login'; } } else { $res['message'] = $v_res['reason']; $res['action'] = 'resend'; } } else { $res['message'] = '用户已被激活或已禁用!'; $res['action'] = 'resend'; }