コード例 #1
0
$auto_cancel = $_REQUEST['auto_cancel'] ? $_REQUEST['auto_cancel'] : 0;
$cancel_type = $_REQUEST['cancel_type'] ? $_REQUEST['cancel_type'] : '';
$high_temp = $_REQUEST['high_temp'] ? $_REQUEST['high_temp'] : "";
$low_temp = $_REQUEST['low_temp'] ? $_REQUEST['low_temp'] : "";
$tablename = "event_practice_settings";
if (!($token && $practice_id && $player_id)) {
    $success = "0";
    $msg = "Incomplete Parameters";
    $data = array();
} else {
    // +-----------------------------------+
    // + STEP 3: perform operations		   +
    // +-----------------------------------+
    $user_id = Users::getUserId($token);
    if ($user_id) {
        GeneralFunctions::setGameSettings($tablename, $practice_id, $conversation_status, $auto_cancel, $cancel_type, $high_temp, $low_temp);
        for ($i = 0; $i < $arr_size; $i++) {
            $sql = "SELECT * FROM event_practice_players WHERE practice_id=:practice_id and user_id=:player_id";
            $sth = $conn->prepare($sql);
            $sth->bindValue('practice_id', $practice_id);
            $sth->bindValue('player_id', $player_id[$i]);
            try {
                $sth->execute();
            } catch (Exception $e) {
            }
            $tour[$i] = $sth->fetchAll(PDO::FETCH_ASSOC);
            if (!count($tour[$i])) {
                $sql = "INSERT into event_practice_players(id,practice_id,user_id,player_profile,player_status,accept_status,created_on) \n\t\t  VALUES(DEFAULT,:practice_id,:player_id,:player_profile,0,0,UTC_TIMESTAMP())";
                $sth = $conn->prepare($sql);
                $sth->bindValue('practice_id', $practice_id);
                $sth->bindValue('player_id', $player_id[$i]);