コード例 #1
0
                }
                break;
            case 'dob':
                $success = updateUserField($email, $_GET['value'], "updateDOB", $errMsg);
                if ($success) {
                    $_SESSION['user']['dob'] = $value;
                }
                break;
            case 'nation':
                $success = updateUserField($email, $_GET['value'], "updateNationName", $errMsg);
                if ($success) {
                    $_SESSION['user']['nationality'] = $value;
                }
                break;
        }
        $retJson = jsonResult($success, $errMsg);
        echo $retJson;
    }
}
function updateUserField($email, $value, $procName, &$errMsg = "")
{
    $returnVal = true;
    $conn = connectDatabase();
    $stmt = $conn->prepare("Call {$procName}(?,?)");
    $stmt->bind_param("ss", $email, $value);
    $stmt->execute();
    if ($stmt->errno !== 0) {
        $returnVal = false;
    }
    $errMsg = $stmt->error;
    $stmt->close();
コード例 #2
0
function jsonGoodResult($result = TRUE, $msg = '', $args = array(), $type = 'status', $show_always = FALSE)
{
    jsonResult($result, $msg, $type, $args, $show_always);
}
コード例 #3
0
ファイル: bubble.php プロジェクト: findbrick/bubble
/**
 * 广播信息到所有用户
 * @param $ws
 * @param $from_fd
 * @param $action
 * @param int $code
 * @param string $info
 * @param string $data
 * @param bool $all
 */
function broadcast($ws, $from_fd, $action, $code = SUCCESS_CODE, $info = '', $data = '', $all = false)
{
    foreach ($ws->connections as $fd) {
        if (!$all && $fd == $from_fd) {
            continue;
        }
        $ws->push($fd, jsonResult($action, $code, $info, $data));
    }
}