$cacheTime = 30; $sql = "SELECT help_messages.*, gf.email, gf.gender, gf.name, gf.picture, gf.link , gt.email as to_email, gt.gender as to_gender, gt.name as to_name, gt.picture as to_picture, gt.link as to_link FROM help_messages LEFT JOIN google_auth as gf ON help_messages.uid = gf.uid LEFT JOIN google_auth as gt ON help_messages.to_uid = gt.uid WHERE 1 AND ((help_messages.uid = ? AND help_messages.to_uid = ?) OR (help_messages.uid = ? AND help_messages.to_uid = ?)) AND help_messages.module_id = ? AND help_messages.deleted = 0"; $sql .= sprintf(" AND help_messages.id = %s", $modelGeneral->qstr($colname_rsID)); $sql .= " ORDER BY message_date DESC"; $query_limit_rsView = sprintf("%s LIMIT %d, %d", $sql, $startRow_rsView, $maxRows_rsView); $details = $modelGeneral->fetchAll($query_limit_rsView, $params, $cacheTime); if (!empty($_POST['MM_Insert']) && $_POST['MM_Insert'] === 'formMessage' && !empty($uid)) { postMessage($approved); $cache = 0; $modelGeneral->clearCache($query_limit_rsView, $params); header("Location:" . $currentURL . "/auto/messages?uid=" . $uid . "&module_id=" . $colname_rsModule . "&id=" . $colname_rsID); exit; } //get points if (!empty($uid)) { $returnPoints = updatePoints($uid, $_SESSION['user']['id']); } //include(SITEDIR.'/libraries/addresses/nearby.php'); if (empty($users)) { throw new Exception('No messages available.'); } ?> <script language="javascript"> $( document ).ready(function() { $( "#message" ).focus(); }); </script> <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <style type="text/css"> .conversation-wrap {
// add point to picks table for user and gsis_id addPoint($db, $pick['pick_id'], 1, false); updatePoints($db, $this_user_id, $this_group_id, $this_season_year, $this_season_type, $this_week, false); } else { $result_str = "winning"; //echo "<span style=\"color:green;\">Winning</span>"; } } elseif (getGameWinner($this_gsis_id) == "tied") { $result_str = "tied"; //echo "<span style=\"color:blue;\">Tied</span>"; } else { if ($this_finished == "t") { $result_str = "incorrect"; //echo "<span style=\"color:red;\">Loser</span>"; addPoint($db, $pick['pick_id'], 0, false); updatePoints($db, $this_user_id, $this_group_id, $this_season_year, $this_season_type, $this_week, false); } else { $result_str = "losing"; //echo "<span style=\"color:red;\">Losing</span>"; } } } else { $result_str = "not started"; } break; } else { $home_style = "notPicked"; $away_style = "notPicked"; $result_str = "not picked"; $this_score = ""; }
<div class="[ col-xs-12 col-sm-offset-0 col-sm-12 ]"> <ul class="event-list"> <?php foreach ($rsView as $key => $rowResult) { //decryption foreach ($resultModuleFields as $k => $v) { if (!empty($rowResult[$v['field_name']]) && $v['encrypted'] == 1) { $rowResult[$v['field_name']] = decryptText($rowResult[$v['field_name']]); } } //decryption //point system if ($resultModule['user_points_matching'] == 1 && !empty($_SESSION['user']['id'])) { $id = !empty($_SESSION['user']['id']) ? $_SESSION['user']['id'] : ''; $id2 = $rowResult['uid']; $pointSystem = updatePoints($id, $id2); $points = ''; $points_result = ''; if (!empty($pointSystem)) { $points = $pointSystem[$id][$id2]['points']; $points_result = $pointSystem[$id][$id2]['results']; } } if ($resultModule['custom_points_matching'] == 1 && !empty($_SESSION['user']['id'])) { $matchResult = matchUserDate($_SESSION['user']['id'], $rowResult['clatitude'], $rowResult['clongitude'], $rowResult['custom_date']); if (!empty($matchResult)) { $pointsCustom = $matchResult['points']; $points_result_custom = $matchResult['results']; } //end if }
if ($game['home_score'] > $game['away_score']) { $winning_team = $game['home_team']; } elseif ($game['home_score'] == $game['away_score']) { $winning_team = "tied"; } else { $winning_team = $game['away_team']; } if ($has_finished) { if ($winning_team == $user_winner) { //pick correct addPoint($db, $user_pick_id, 1, FALSE); updatePoints($db, $user_user_id, $user_group_id, $user_season_year, $user_season_type, $user_week, false); } else { //($winning_team != $user_winner || $winning_team == 'tied') addPoint($db, $user_pick_id, 0, FALSE); updatePoints($db, $user_user_id, $user_group_id, $user_season_year, $user_season_type, $user_week, false); } //reconcile to prevent future changes $sql = "UPDATE picks SET reconciled=1 WHERE pick_id='{$user_pick_id}'"; if (mysqli_query($db, $sql)) { // echo "Point $user_pick_id Reconciled for User $user_user_id.\n"; } else { echo mysqli_error($db); } } } } echo "Picks reconciled. "; //--RECONCILE WIINERS //get all non-reconciled PICKS // Get all of the users picks
function playCard($id, $position, $card, $cardowner, $endturn) { if ($position < 10) { $position = "0" . $position; } $position = "Field" . $position; $query = "SELECT CardID FROM tempcard"; $result = mysql_query($query); $newID = mysql_num_rows($result); $newID++; $cardid = $card->cardid; $cardname = $card->cardname; $cardtop = $card->top; $cardright = $card->right; $cardbottom = $card->bottom; $cardleft = $card->left; $cardtype = $card->type; $cardeffect = $card->effect; //Set card on field $sql = "INSERT INTO tempcard (CardID, TempCardID, TempCardOwner, CardName, CardTop, CardRight, CardBot, CardLeft, CardType, CardEffect)\n VALUES ('{$cardid}', '{$newID}', '{$cardowner}', '{$cardname}', '{$cardtop}', '{$cardright}', '{$cardbottom}', '{$cardleft}', '{$cardtype}', '{$cardeffect}')"; mysql_query($sql); $sql = "UPDATE field SET " . $position . "='{$newID}' WHERE FieldID = '{$id}'"; mysql_query($sql); //Remove Card from hand removeSpecificCard($id, $cardowner, $cardid); //UpdatePoints updatePoints($id, $cardowner, 1); }
function calculateattack() { $pointbonus = 0; $adjacent = $this->getAdjecentCards(); if ($adjacent[0]->cardid != 0) { if ($this->card->top > $adjacent[0]->bottom && $this->user != $adjacent[0]->tempOwner) { stealFieldCard($adjacent[0]->tempID, $this->user); $pointbonus++; } } if ($adjacent[1]->cardid != 0) { if ($this->card->right > $adjacent[1]->left && $this->user != $adjacent[1]->tempOwner) { stealFieldCard($adjacent[1]->tempID, $this->user); $pointbonus++; } } if ($adjacent[2]->cardid != 0) { if ($this->card->bottom > $adjacent[2]->top && $this->user != $adjacent[2]->tempOwner) { stealFieldCard($adjacent[2]->tempID, $this->user); $pointbonus++; } } if ($adjacent[3]->cardid != 0) { if ($this->card->left > $adjacent[3]->right && $this->user != $adjacent[3]->tempOwner) { stealFieldCard($adjacent[3]->tempID, $this->user); $pointbonus++; } } updatePoints($this->id, $this->user, $pointbonus); //Database Call }
function reconcilePoints($db, $user_id, $group_id, $season_year, $season_type, $week, $verbose) { // check picks table for games that match season/week and sum them //$sql = "SELECT SUM(points) AS points_sum FROM picks WHERE user_id='$user_id' AND season_year='$season_year' AND season_type='$season_type' AND week='$week'"; //$result = mysqli_query($db,$sql); //$row = mysqli_fetch_assoc($result); //$sum = $row['points_sum']; //echo $sum; $this_points_id = updatePoints($db, $user_id, $group_id, $season_year, $season_type, $week, $verbose); //piggy pack on update script on final time $sql = "UPDATE points SET reconciled=1 WHERE points_id='{$this_points_id}'"; echo "<p>{$sql}</p>"; //$result = mysqli_query($db,$sql); if (mysqli_query($db, $sql)) { if ($verbose) { echo "Point total id <b>{$this_points_id}</b> for user_id <b>{$user_id}</b> in group_id <b>{$group_id}</b> for <b>{$season_year}</b> <b>{$season_type}</b> Week <b>{$week}</b> has been <b>RECONCILED</b>.<br>\n"; } } else { echo mysqli_error($db); } }