function processRegistration($tweet)
{
    $language = findLanguage($tweet);
    if (!$language) {
        // no language specified!
        // we need to have a language to sign up!
        replyTweet($tweet, "You can't sign up to a language challenge \n            without a language! Specify one with a hashtag.");
    } else {
        // add a new user!
        insertParticipant($tweet->user->screen_name, $tweet->user->name, "twitter");
        $success = insertEntry($tweet->user->screen_name, $language['Code']);
        // Reply to all specific registrations
        if (!$success) {
            $message = "You're already studying " . $language['Name'] . "!";
        } else {
            $message = "has registered for the Super Challenge in " . $language['Name'] . ". Good luck!";
        }
        replyTweet($tweet, $message);
    }
}
Пример #2
0
        // Get the ID from the last insert and set $trip_id
        $trip_id = mysqli_insert_id($conn);
        echo "successfully added to db";
    } else {
        echo "Error: " . $sql . "<br>" . mysqli_error($conn);
    }
    //insert creator of trip to participants table
    $sql2 = "INSERT INTO participants (trip_id, user_id) VALUES ('{$trip_id}', '{$tripUserId}')";
    if (mysqli_query($conn, $sql2)) {
    } else {
        echo "Error: " . $sql2 . "<br>" . mysqli_error($conn);
    }
    //Select the userID of the invited user
    $part_id = getUserId($partEmail);
    //Insert invited user ID, tripID to participants table
    insertParticipant($trip_id, $part_id);
} else {
    echo "Something is wrong!";
    //Something wrong with the trip ID
}
$participants = getParticipants($trip_id);
//Display input for adding expenses
echo "<h1>" . $tripName . "</h1>";
echo "Add an expense below!";
echo '<form action="expenses/submit.php" method="post">';
echo 'Expense Name: <input type="text" name="expenseTitle" id="expenseTitle"><br>';
echo 'Cost: <input type="text" name="expenseCost" id="expenseCost"><br>';
echo 'Number of Purchasers: <input type="text" name="expensePurchasers" id="expensePurchasers"><br>';
echo 'Number of Users: <input type="text" name="expenseUsers" id="expenseUsers"><br>';
echo '<select name="purchasers" multiple>';
while ($info = mysqli_fetch_array($participants)) {