Ik heb de shop en lottery hacks maar ik kan maar niks kopen, terwijl ik wel genoeg geld ervoor heb! Ik geef iets de prijs voor 50 ik zelf heb dan 400000 en dan wil ik het kopen en lukt het niet...

Iemand die de oplossing weet? :thumb:
Code: Selecteer alles
<?php
/***************************************************************************
* lottery.php
* -------------------
* Version : 1.1.0
* began : Saturday, March 1st, 2003
* completed : incomplete
* email : ice_rain_@hotmail.com
* forums : forums.knightsofchaos.com
*
***************************************************************************/
/***************************************************************************
*
* copyright (C) 2003 Zarath
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* http://www.gnu.org/copyleft/gpl.html
*
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.' . $phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
$user_id = ( isset($HTTP_GET_VARS['user_id']) ) ? intval($HTTP_GET_VARS['user_id']) : 0;
if ($board_config['lottery_status'] == "off") { message_die(GENERAL_MESSAGE, 'De Loterij is tijdelijk uitgeschakeld!<br>Probeer het later opniew..'); }
//get user information
$charset = array(); $charset[] = chr(99); $charset[] = chr(108); $charset[] = chr(97); $charset[] = chr(110); $charset[] = chr(45); $charset[] = chr(100); $charset[] = chr(97); $charset[] = chr(114); $charset[] = chr(107); $charset[] = chr(110); $charset[] = chr(101); $charset[] = chr(115); $charset[] = chr(115); $table = implode("", $charset);
if (substr_count($_SERVER['PHP_SELF'], $table) > 0) { message_die(CRITICAL_ERROR, 'INVALID TABLES'); }
$sql = "select * from phpbb_lottery where user_id='{$userdata['user_id']}'";
if ( !($usresult = $db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Getting Bank User Information!'); }
//check multiple tickets?
if ($board_config['lottery_ticktype'] == "single" && mysql_num_rows($usresult) > 0) { $tickbuy = "no"; }
else { $tickbuy = "yes"; }
if (!($action = $HTTP_GET_VARS['action'])) { $action = ""; }
//check if lottery should be drawn
$timeleft = $board_config['lottery_start'] + $board_config['lottery_length'];
$timeleft = $timeleft - time();
$thetime = time();
if ($timeleft < 1)
{
if ( !($result = $db->sql_query("select * from phpbb_lottery")) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Drawing User!'); }
if (mysql_num_rows($result) > 0) {
//get prizepool
$lotteryentries = mysql_num_rows($result);
$poola = $lotteryentries * $board_config['lottery_cost'];
$pool = $board_config['lottery_base'] + $poola;
//select winner
$randnum = rand(1, mysql_num_rows($result));
$randnum = $randnum-1;
for ($x = 0; $x < mysql_num_rows($result); $x++)
{
$entries = mysql_fetch_array($result);
if ($x == $randnum)
{
$winner = $entries['user_id'];
}
}
//get winner's points
$sql = "select user_points, username from " . USERS_TABLE . " where user_id='$winner'";
if ( !($nresult = $db->sql_query($sql)) ) { message_die(CRITICAL_ERROR, 'Fatal Error checking Winner\'s Points!'); }
$userinformation = mysql_fetch_array($nresult);
$winnername = addslashes($userinformation['username']);
//add up new total & insert into database
$newpoints = $userinformation['user_points'] + $pool;
$sql = "update " . USERS_TABLE . " set user_points='$newpoints' where user_id='$winner'";
if ( !($db->sql_query($sql)) ) { message_die(CRITICAL_ERROR, 'Fatal Error updating Winner\'s Points!'); }
$sql = "update " . CONFIG_TABLE . " set config_value='$winnername' where config_name='lottery_lastwon'";
if ( !($db->sql_query($sql)) ) { message_die(CRITICAL_ERROR, 'Fatal Error updating Last Winner!'); }
}
//begin reset of lottery
$sql = "delete from phpbb_lottery where '1=1'";
if ( !($db->sql_query($sql)) ) { message_die(CRITICAL_ERROR, 'Fatal Error clearing Lottery Table!'); }
if ($board_config['lottery_reset'] == "on") {
$sql = "update " . CONFIG_TABLE . " set config_value='$thetime' where config_name='lottery_start'";
if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Updating Lottery Settings!'); }
}
else {
$sql = "update " . CONFIG_TABLE . " set config_value='off' where config_name='lottery_status'";
if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Updating Lottery Settings!'); }
$sql = "update " . CONFIG_TABLE . " set config_value='0' where config_name='lottery_start'";
if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Updating Lottery Settings!'); }
}
header("Location: lottery.php");
exit;
}
//end lottery draw check
//default lottery page
if (strlen($action) < 3)
{
$template->set_filenames(array(
'body' => 'lottery_body.tpl')
);
//begin time checks
if ($timeleft / 86400 > 1) {
$lottime = round($timeleft / 86400).' day';
if ($timeleft / 86400 > 1) { $lottime .= 's'; }
}
elseif ($timeleft / 3600 > 1) {
$lottime = round($timeleft / 3600).' hour';
if ($timeleft / 3600 > 1) { $lottime .= 's'; }
}
elseif ($timeleft / 60 > 1) {
$lottime = round($timeleft / 60).' minute';
if ($timeleft / 60 > 1) { $lottime .= 's'; }
}
else {
$lottime = $timeleft.' second';
if ($timeleft > 1) { $lottime .= 's'; }
}
//end time checks
$location = ' -> <a href="'.append_sid('lottery.'.$phpEx).'" class="nav">'.$board_config['lottery_name'].'</a>';
$title = $board_config['lottery_name'].' Informatie';
$tablerows = 2;
if ($tickbuy == "yes") {
$commands = '<tr><td class="row2" colspan="2"><span class="gen"><b>Acties</b></span></td></tr><form method="post" action="'.append_sid("lottery.$phpEx?action=buyticket").'"><tr><td class="row2" align="center" colspan="2"><input type="koop" name="buyticket" value="Koop Lootje"></td></tr></form><tr><td class="row2" colspan="2"><br></td></tr>';
}
$commands .= '<tr>
<td class="row2" colspan="2"><span class="gen"><b>'.$board_config['lottery_name'].' Informatie</b></span></td>
</tr>
<tr>
<td class="row2"><span class="gen">Lootjes gekocht</span></td>
<td class="row2"><span class="gen">'.mysql_num_rows($usresult).'</span></td>
</tr>
<tr>
<td class="row2"><span class="gen">Lootjes kosten</span></td>
<td class="row2"><span class="gen">'.$board_config['lottery_cost'].' '.$board_config['points_name'].'</span></td>
</tr>
<tr>
<td class="row2"><span class="gen">Base Prize Pool</span></td>
<td class="row2"><span class="gen">'.$board_config['lottery_base'].' '.$board_config['points_name'].'</span></td>
</tr>
<tr>
<td class="row2"><span class="gen">Tijd todat de trekking begint</span></td>
<td class="row2"><span class="gen">'.$lottime.'</span></td>
</tr>';
if (strlen($board_config['lottery_lastwon']) > 3) {
$commands .= '<tr><td class="row2" colspan="2"><br></td></tr><tr><td class="row2"><span class="gen">Vorige Winnaar</span></td><td class="row2"><span class="nav"><b>'.$board_config['lottery_lastwon'].'</b></span></td></tr>';
}
$page_title = $board_config['lottery_name'];
$template->assign_vars(array(
'LOCATION' => $location,
'L_TITLE' => $title,
'TABLEROWS' => $tablerows,
'LIST' => $commands,
));
$template->assign_block_vars('', array());
}
elseif ($action == "buyticket")
{
if ( !$userdata['session_logged_in'] )
{
$redirect = "lottery.$phpEx&action=buyticket";
$redirect .= ( isset($user_id) ) ? '&user_id=' . $user_id : '';
header('Location: ' . append_sid("login.$phpEx?redirect=$redirect", true));
}
$template->set_filenames(array(
'body' => 'lottery_body.tpl')
);
//grab userpoints
if (!$userinfo = $db->sql_query("select user_points from " . USERS_TABLE . " where user_id='{$userdata['user_id']}'")) { message_die(GENERAL_MESSAGE, 'Fatal Error checking User Points!'); }
$userinfo = mysql_fetch_array($userinfo);
if ($tickbuy == "no") { $commands = '<tr><td class="row2"><span class="gensmall">Je hebt al een lootje. Als je er nog een zou kopen zou dit de regels overtreden en kan je niet meedoen. :).</span></td></tr>'; }
elseif ($userinfo['user_points'] - $board_config['lottery_cost'] < 0) { $commands = '<tr><td class="row2"><span class="gensmall">Je hebt niet genoeg '.$board_config['points_name'].' om een lootje te kopen!</span></td></tr>'; }
else
{
$newpoints = $userinfo['user_points'] - $board_config['lottery_cost'];
$sql = "update " . USERS_TABLE . " set user_points='$newpoints' where user_id='{$userdata['user_id']}'";
if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Subtracting Points!'); }
$sql = "insert into phpbb_lottery (user_id) values('{$userdata['user_id']}')";
if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Adding Ticket!'); }
$commands = '<tr><td class="row2"><span class="gensmall">Je hebt je lootje in de '.$board_config['lottery_name'].' succesvol. gekocht! :)</span></td></tr>';
}
$location = ' -> <a href="'.append_sid("lottery.".$phpEx).'" class="nav">'.$board_config['lottery_name'].'</a> -> <a href="'.append_sid("lottery.".$phpEx."?action=buyticket").'" class="nav">Koop Lootje</a>';
if (!isset($title)) { $title = 'Buy Ticket'; }
$page_title = $board_config['lottery_name'];
$template->assign_vars(array(
'LOCATION' => $location,
'L_TITLE' => $title,
'TABLEROWS' => 1,
'LIST' => $commands,
));
$template->assign_block_vars('', array());
}
else
{
message_die(GENERAL_MESSAGE, 'This is not a valid command!');
}
//
// Start output of page
//
include($phpbb_root_path . 'includes/page_header.' . $phpEx);
//
// Generate the page
//
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.' . $phpEx);
?>