if ($json = json_decode($msg)) { } else { continue; } if ($json->event == "follow") { $source = userid_to_username($json->source->id); $target = userid_to_username($json->target->id); do_follow($source, $target); } else { if ($json->event == "favorite") { $source = userid_to_username($json->source->id); list($target, $text) = tweetid_to_user_status($json->target_object->id); do_favorite("favorite", $source, $target, $text); } else { if ($json->event == "unfavorite") { $source = userid_to_username($json->source->id); list($target, $text) = tweetid_to_user_status($json->target_object->id); do_favorite("unfavorite", $source, $target, $text); } else { if ($json->event == "retweet") { //no-op for now.. will be displayed as text.. } else { if ($json->text != "") { /* could be retweet, DM, mention, or regular tweet */ if (isset($json->retweeted_status)) { do_rt($json->user->screen_name, $json->retweeted_status->user->screen_name, $json->retweeted_status->text); } else { if (isset($json->sender_screen_name)) { /* DM */ do_dm($json->sender_screen_name, $json->recipient_screen_name, $json->text); } else {
$q = $dbh->prepare("DELETE FROM cm_users WHERE id = ?"); $q->bindParam(1, $users); $q->execute(); $error = $q->errorInfo(); break; case 'update': $post = bindPostVals($_POST); $q = $dbh->prepare("UPDATE cm_users SET " . $post['columns'] . " WHERE id = :id"); $q->execute($post['values']); $error = $q->errorInfo(); //see if new was set to yes; if so send email. if ($_POST['new'] === 'yes' || $_POST['status'] === 'active') { //Notify new user $email = $_POST['email']; $subject = "ClinicCases: Your ClinicCases account is now activated."; $body = "You new ClinicCases account has been activated. Your username is " . userid_to_username($dbh, $_POST['id']) . ".\n\nPlease log on to ClinicCases at " . CC_BASE_URL; mail($email, $subject, $body, CC_EMAIL_HEADERS, "-f " . CC_EMAIL_FROM); //Set to not new $q = $dbh->prepare("UPDATE cm_users SET new = '' WHERE id = ?"); $q->bindParam(1, $_POST['id']); $q->execute(); } break; case 'create': $post = bindPostVals($_POST); $q = $dbh->prepare("UPDATE cm_users SET " . $post['columns'] . " WHERE id = :id"); $q->execute($post['values']); $error = $q->errorInfo(); if (!$error[1]) { //Create username $fname = trim(str_replace(' ', '', $_POST['first_name']));
while ($scor = $db->fetch_row($scora)) { $unams = $db->fetch_row($db->query("SELECT username FROM users WHERE userid={$scor['userid']}")); print "<tr><td>{$unams['username']}</td><td>{$scor['score']} points</td><td> <a href=?act=view&id={$scor['gameid']}>View</a> </td></tr>"; } print "</table>"; } if ($_GET['act'] == 'replay') { $gameid = $_GET['id']; $db->query("INSERT INTO {$gpre}game (userid) VALUES({$userid})"); $pp = $db->query("SELECT * FROM {$gpre}game WHERE gameover=0 AND userid={$userid}"); setup_game($userid); $_GET['act'] = 'play'; $pany = 1; } $id = abs((int) $_GET['id']); if ($_GET['act'] == 'view') { $vgs = $db->query("SELECT * FROM {$gpre}scores WHERE gameid={$id}"); if (!$db->num_rows($vgs)) { die; } $vg = $db->fetch_row($vgs); print "<h2>" . userid_to_username($vg['userid']) . " scored " . number_format($vg['score']) . "</h2>\n\t> <a href='s_pp_game.php?act=highscores'>Back to High Scores</a><br />"; draw_board($ir['userid'], $id, 1); } if ($pany && $_GET['act'] == 'play') { $p = $db->fetch_row($pp); $gameid = $p['id']; print "\n <center><div id = \"gamediv\">\n <img src='images/pp/s14.gif' onerror=\"refreshPage();\" onload=\"refreshPage();\" onclick=\"refreshPage();\">\n <br /><button type=\"button\" onclick=\"refreshPage();\">Begin Playing</button>\n </div>"; } print "</center>"; $h->endpage();
include $gprefix . "_config.php"; } else { die("Error."); } include "globals.php"; $myrooms = check_room($gpres, $ir['userid']); $_GET['act'] = mysql_escape($_GET['act']); print "<center><h3>{$gamename}</h3><br />"; if (is_array($myrooms) && $_GET['act'] != "leave") { print "<font color=green>Your are currently in the following room(s):</font><br /><table class='table'>\n\t<tr><th>Room Name</th><th>Opponent</th><th>Action</th></tr>"; foreach ($myrooms as &$room) { $tmrn = $db->fetch_row($db->query("SELECT name,p1,p2 FROM {$gpre}room WHERE id={$room}")); if ($tmrn['p1'] == $ir['userid']) { $unmtxt = userid_to_username($tmrn['p2']); } else { $unmtxt = userid_to_username($tmrn['p1']); } print "<tr><td>{$tmrn['name']}</td><td>{$unmtxt}</td>\n\t\t<td>> <a href='sb_game.php?g={$gpre}&id={$room}'>Go to room.</a></td>"; } print "</table><br /><br /><b>Other Rooms</b><br /><br />"; } else { if ($rules) { $extralinkhead = " | <a href='sb_rooms.php?g={$gpre}&act=rules'><b>View Rules</b></a> "; } if ($gpres != "ttt") { $halloffame = " | <a href='sb_halloffame.php?g={$gpres}'><b>Hall of Fame</b></a>"; } print "<center><a href='sb_rooms.php?g={$gpre}'><b>Home</b></a> | <a href='sb_rooms.php?g={$gpre}&act=create'><b>Create a Room</b></a> | <a href='sb_rooms.php?g={$gpre}&act=search'><b>Search For a Room</b></a>{$halloffame}{$extralinkhead}</center><br /><br />"; } if ($_GET['act'] == 'create') { $_POST['name'] = preg_replace("/[^a-zA-Z0-9?!.,\\s]/", "", $_POST['name']);