-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathassign_targets.php
36 lines (30 loc) · 1020 Bytes
/
assign_targets.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
require_once('libraries/library.php');
// Get variables:
// $gameid = ID of game you want to assign targets on
// $newgame = 'true' // If you want to reassign targets of this game
// $
if (isset($_GET['gameid']) && is_numeric($_GET['gameid'])) {
$gameid = $_GET['gameid'];
connect();
$gnamesql = mysql_query("select `name` from `face_games` where `id` = ".$gameid);
$gname = mysql_result($gnamesql, 0);
} else {
die("gameid not specified.");
}
if ($_GET['newgame'] == 'true') {
$newgame = true;
} else {
$newgame = false;
}
$return = assign_targets($gameid, $newgame);
print_r($return);
require_once('libraries/googlevoice.php');
require_once('/home/webby/fbhackathon/credentials.php');
$gv = new GoogleVoice(VOICE_USER, VOICE_PASS);
$players = getUsersInGame($gameid);
foreach ($players as $player) {
$msg = "Your target for the game \"".$gname."\" is " . $players[$player['target_id']]['name'] . ". Let the games begin!";
$gv->sendSMS(substr($player['phone'], 2), $msg);
}
?>