請問是要如何手動修改呢??
張數的問題,我想這個不知道是不是你們要的
http://yll.loxa.edu.tw/phpBB2/viewtopic.php?t=1769
版主: 版主管理群
代碼: 選擇全部
//
// Get winner's name and current items (incase items need to be added!)
//
$sql = "SELECT `username`, `user_items`
FROM " . USERS_TABLE . "
WHERE user_id='{$row['user_id']}'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, sprintf($lang['lottery_error_selecting'], 'users'), '', __LINE__, __FILE__, $sql);
}
if (!( $row2 = $db->sql_fetchrow($result) ))
{
message_die(GENERAL_ERROR, sprintf($lang['lottery_error_selecting'], 'lottery'), '', __LINE__, __FILE__, $sql);
}
$winnername = addslashes($row2['username']);
#
# Explode items array, loop over items array to make sure all item exist
# Replace all RANDOM (lowercase) items with items from price to price [in store]
#
$item_array = explode(';', $board_config['lottery_win_items']);
$add_items = array();
for ($i = 0; $i < count($item_array); $i++)
{
$item_array[$i] = trim($item_array[$i]);
if ( strtolower($item_array[$i]) == 'random' )
{
$shop_sql = ( !empty($board_config['lottery_random_shop']) ) ? "AND shop = '" . addslashes($board_config['lottery_random_shop']) . "'" : '';
$sql = "SELECT name
FROM " . SHOP_ITEM_TABLE . "
WHERE cost > '" . $board_config['lottery_item_mcost'] . "'
AND cost < '" . $board_config['lottery_item_xcost'] . "'
" . $shop_sql . "
ORDER BY RAND()
LIMIT 0, 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, sprintf($lang['lottery_error_selecting'], 'shop items'), '', __LINE__, __FILE__, $sql);
}
$sql_count = $db->sql_numrows($result);
if ( $sql_count > 0 )
{
if (!( $item_row = $db->sql_fetchrow($result) ))
{
message_die(GENERAL_ERROR, sprintf($lang['lottery_error_selecting'], 'shop items'), '', __LINE__, __FILE__, $sql);
}
$add_items[] = $item_row['name'];
}
}
elseif ( !empty($item_array[$i]) )
{
$sql = "SELECT *
FROM " . SHOP_ITEM_TABLE . "
WHERE name = '" . addslashes($item_array[$i]) . "'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, sprintf($lang['lottery_error_selecting'], 'shop items'), '', __LINE__, __FILE__, $sql);
}
$sql_count = $db->sql_numrows($result);
if ( $sql_count > 0 )
{
$add_items[] = $item_array[$i];
}
}
}
if ( count($add_items) > 0 )
{
$new_items = addslashes($row2['user_items'] . '? . implode('睧', $add_items) . '?);
#
# Add up new total & insert into database
#
$sql = "UPDATE " . USERS_TABLE . "
SET user_items = '$new_items'
WHERE user_id='{$row['user_id']}'";
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, sprintf($lang['lottery_error_updating'], 'users'), '', __LINE__, __FILE__, $sql);
}
}