include "../dbconnection.php";
header('Content-type: application/json');
if (isset($_REQUEST['game_score'])) {
    $game_score = $_REQUEST['game_score'];
    $user_id = $_SESSION['user_loged_id'];
    $game_id = $_SESSION['game_id'];
    addNewUserGameScore($user_id, $game_id, $game_score);
    $game_results = getGameById($game_id);
    $game_result = mysql_fetch_array($game_results);
    $game_point_ratio = $game_result['game_point_ratio'];
    $total_points = floor($game_score / $game_point_ratio);
    $user_points = getPointsByUserGame($game_id, $user_id);
    $game_user_point = mysql_fetch_array($user_points);
    $game_leader_boards = getGameScoreLeaderBoardByUserId($user_id);
    $game_leaderboard = mysql_fetch_array($game_leader_boards);
    $points_leaders = getPointsLeaderBoardByUserId($user_id);
    $point_leaderboard = mysql_fetch_array($points_leaders);
    if ($point_leaderboard['point_leader_id'] < 1) {
        $points_leaderboard_score = $total_points;
        $current_point = $total_points;
        addNewPointLeaderBoard($user_id, $points_leaderboard_score, $current_point);
    } else {
        $points_leaderboard_score = $point_leaderboard['total_points'] + $total_points;
        $current_point = $point_leaderboard['current_point'] + $total_points;
        updatePointLeaderBoard($user_id, $points_leaderboard_score, $current_point);
    }
    if ($game_leaderboard['leader_board_id'] > 0) {
        $game_leaderboard_score = $game_leaderboard['leader_board_score'] + $game_score;
        updateGameScoreLeaderBoard($user_id, $game_leaderboard_score);
    } else {
        $game_leaderboard_score = $game_score;
Ejemplo n.º 2
0
session_start();
include "dbconnection.php";
$user_id = mysql_real_escape_string($_REQUEST['user_id']);
$reward_id = mysql_real_escape_string($_REQUEST['reward_id']);
$users = getUserById($user_id);
$user = mysql_fetch_array($users);
$user_email = $user['email'];
$username = $user['name'];
$rewards = getRewardById($reward_id);
$reward = mysql_fetch_array($rewards);
$reward_name = $reward['reward_name'];
$reward_point = $reward['reward_points'];
$user_redeem_points = getRedeemPointsByUserId($user_id);
$user_redeem_point = mysql_fetch_array($user_redeem_points);
addNewReedemPoints($user_id, $reward_id, $reward_point);
$point_leader_boards = getPointsLeaderBoardByUserId($user_id);
$point_leader_board = mysql_fetch_array($point_leader_boards);
$leader_borad_score = $point_leader_board['total_points'] - $reward_point;
updatePointLeaderBoard($user_id, $leader_borad_score);
$subject = "Maverick Game Rewards Redeem Details";
$from = "*****@*****.**";
$email_server = "*****@*****.**";
$to = $user_email;
$mail_body = "Dear {$username},<br/><br/>Your request of maverick reward has been received our team will contact you in 48 hours during weekdays for any queries or cancellation of this reward please write to us with in 24 hrs at <strong>info@maverickgame.com</strong>.<br>We wish you best of luck on better game performance and more rewards in future. Keep Playing Keep Winning.  <br/> <br/> Regards,<br/><br/>Team Maverick Game";
$body = wordwrap($mail_body, 2000);
//$body_user = wordwrap($mail_body_user,70);
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= "From: " . $from . "\r\n";
$headers .= 'Bcc:raheelaslam@golive.com.pk ,amohsin@golive.com.pk,info@maverickgame.com' . "\r\n";
$headers .= "Reply-To: " . $user_email . "\r\n";