1 頁 (共 1 頁)

[問題]單一安裝版的樂透彩券

發表於 : 2003-12-25 22:48
scott511747
http://phpbbhacks.com/viewhack.php?id=1198

有人能在2.0.6運作嗎?因為版本好像只到2.0.3而已,且控制台的設定無法更新.....

要先裝積分系統~虛擬貨幣可嗎?

發表於 : 2003-12-25 23:32
mit
我有裝這個外掛,不過是1.0.0版的。
我用phpbb2.0.6,而且沒有積分系統,只有Cash Mod。
運作都沒啥問題。
不過我裝沒多久就關掉它了,是不是有其他問題我不知道,
只不過目前都沒有發現。

Re: [問題]單一安裝版的樂透彩券

發表於 : 2003-12-26 00:04
依夢兒
scott511747 寫:虛擬貨幣可嗎?
理論上把外掛中的 user_points 字串置換為 user_money 就行了。

Re: [問題]單一安裝版的樂透彩券

發表於 : 2005-04-09 02:23
fenbaj2000
依夢兒 寫:
scott511747 寫:虛擬貨幣可嗎?
理論上把外掛中的 user_points 字串置換為 user_money 就行了。
但是我查了裏面好像都沒有user_pointw裏面只有user_money
我是裝http://phpbb-tw.net/phpbb/viewtopic.php?t=33720這邊的彩票程式(Lottery)和貨幣整合且中文化就是和上面的大大一樣的情形後台設定按上傳會重置聽說要手動改^^`我把我的lottery.php,post出來請各位大大幫幫忙
<?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
//
// Stop anonymous memberlist viewing
if (!$userdata['session_logged_in'])
{
message_die(GENERAL_MESSAGE, $lang['Not_Authorised']);
}


$user_id = ( isset($HTTP_GET_VARS['user_id']) ) ? intval($HTTP_GET_VARS['user_id']) : 0;
\r
if ($board_config['lottery_status'] == "off") { message_die(GENERAL_MESSAGE, 'The lottery is currently turned off!<br>Try again later.'); }




//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_money, 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_money'] + $pool;
$sql = "update " . USERS_TABLE . " set user_money='$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



$sql = "select * from phpbb_lottery where id>0";
if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Getting Total Lottery Entries!'); }
$lotteryentries = mysql_num_rows($result);

if ($board_config['lottery_start'] != 0) {
$timeleft = $board_config['lottery_start'] + $board_config['lottery_length'];
$timeleft = $timeleft - time();
}
else { $timeleft = -1; }
$pool = $board_config['lottery_base'];
$poola = $lotteryentries * $board_config['lottery_cost'];
$pool = $pool + $poola;



$location = ' -> <a href="'.append_sid('lottery.'.$phpEx).'" class="nav">'.$board_config['lottery_name'].'</a>';
$title = $board_config['lottery_name'].' Information';
$tablerows = 2;
if ($tickbuy == "yes") {
$commands = '<tr><td class="row2" colspan="2"><span class="gen"><b>心動不如馬上行動</b></span></td></tr><form method="post" action="'.append_sid("lottery.$phpEx?action=buyticket").'"><tr><td class="row2" align="center" colspan="2">
我要購買<input type="text" class="post" style="width:40px" name="ti" size="10" maxlength="8" value="1" />張彩券\r

<input type="submit" name="buyticket" value="購買"></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'].' Information</b></span></td>
</tr>
<tr>
<td class="row2"><span class="gen">您已購買張數</span></td>
<td class="row2"><span class="gen">'.mysql_num_rows($usresult).'</span></td>
</tr>
<tr>
<td class="row2"><span class="gen">每張彩卷價格</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">基本頭彩彩金</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">彩卷銷售張數</span></td>
<td class="row2"><span class="gen">'.$lotteryentries.'</span></td>
</tr>


<tr>
<td class="row2"><font color="#3399FF"><span class="gen"><font color="#0099FF">累積頭彩彩金</font></span></font></td>
<td class="row2"><font color="#FF6600"><span class="gen"><font color="#FF0000">'.$pool.'</font></span></font></td>
</tr>

<tr>
<td class="row2"><span class="gen">距離開獎時間</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">前一期頭彩得主</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")

for($i = 0; $i < $ti ; $i++)

{
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_money 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">You already have a ticket, and buying another ticket would exceed the maximum amount allowed.</span></td></tr>'; }
elseif ($userinfo['user_money'] - $board_config['lottery_cost'] < 0) { $commands = '<tr><td class="row2"><span class="gensmall">您的錢不夠了喔!</span></td></tr>'; }
else
{
$newpoints = $userinfo['user_money'] - $board_config['lottery_cost'];
$sql = "update " . USERS_TABLE . " set user_money='$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">感謝你購買 '.$board_config['lottery_name'].' ,您的購買已經成功。</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">Buy Ticket</a>';
if (!isset($title)) { $title = 'Buy Ticket'; }
$page_title = $board_config['lottery_name'];\r
$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);

?>

發表於 : 2005-04-09 08:29
DL
這是很舊版的,那個人經常都不去裝新版本的外掛,你看那篇文章是損失,這裡有新版本的檔案下載,還翻譯好了:http://phpbb-tw.net/phpbb/viewtopic.php ... %BC%D6%B3z

發表於 : 2005-04-09 08:36
DL
你去看那個網站更是損失