I have a webpage that isnt within my phpbb forum.
This webpage is a simple blackjack game.
I have managed to grab the ultimate points balance per user and implement it as a balance in my game.
Problem is how do I get the backjack final balance (when you finished playing etc) back into the ultimate points balance in the forum?
What I mean is:
user has 3000 UP in forum.
Clicks on link in forum to go to website with game and UP balance is copied across, so user has 3000 UP to play with.
After they have finished the game they click a button to exit and that also transfers the new UP balance from the game into the forum UP and updates it, so if the user has won and their balance is now 4000, when they go back to the forum their UP balance is updated from 3000 to 4000
This is what worked on my 3.0 board.
Code: Select all
<?php
/* First, get userpoints passed in URL from JavaScript section of main custom page 'bjack_new_session.php' */
$points=$_GET['newPoints'];
/* Begin Second Custom Page set up */
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
/* Start session management */
$user->session_begin();
$auth->acl($user->data);
$user->setup();
$userid = $user->data['user_id'];
$username = $user->data['username'];
$userpoints = $user->data['user_points'];
/* Update DB userpoints for the current user only*/
$sql_arr = array(
'user_points' => $points,
);
$sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_arr) . '
WHERE user_id = ' . (int) $userid;
$db->sql_query($sql);
/* Close the DB connection after every update */
mysql_close();
?>




