真的吗?bartman926 寫:如果猜得沒錯...jikey 寫:安装了股票的数量外挂我不能增加新股了!!~~~
重装了也不行~
代碼: 選擇全部
Couldn't insert new stock DEBUG MODE SQL Error : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' 12345, 12345, 12345, 12345)' at line 2 INSERT INTO phpbb_vault_exchange (stock_id, stock_name, stock_desc,stock_total,stock_price,stock_previous_price,stock_worst_price,stock_best_price) VALUES ( 5, '4445' , '233' ,, 12345, 12345, 12345, 12345) Line : 253 File : c:\program files\easyphp1-7\www\cash_testing\admin\admin_vault_exchange.php
这是我修改后的可以帮我看看那里发生错误代碼: 選擇全部
<?php /*************************************************************************** * admin_vault_exchange.php * ------------------ * begin : 10/01/2004 * * ***************************************************************************/ if( !empty($setmodules) ) { $file = basename(__FILE__); $module['Vault']['Vault_exchange'] = $file; return; } define('IN_PHPBB', true); $phpbb_root_path = '../'; require($phpbb_root_path . 'extension.inc'); require("pagestart.$phpEx"); $template->set_filenames(array( 'body' => 'admin/config_vault_exchange_body.tpl') ); $submit = isset($HTTP_POST_VARS['submit']); $sql = "SELECT * FROM " . VAULT_GENERAL_TABLE ; if(!$result = $db->sql_query($sql)) { message_die(CRITICAL_ERROR, "Could not query config information in admin_board", "", __LINE__, __FILE__, $sql); } while( $row = $db->sql_fetchrow($result) ) { $vault[$row['config_name']] = $row['config_value']; } if ( $submit ) { $use = intval ( $HTTP_POST_VARS['use']); $min = intval ( $HTTP_POST_VARS['min']); $max = intval ( $HTTP_POST_VARS['max']); $time = intval ( $HTTP_POST_VARS['time']); $lsql= "UPDATE ". CONFIG_TABLE . " SET config_value = '$use' WHERE config_name = 'stock_use' "; if ( !($lresult = $db->sql_query($lsql)) ) { message_die(GENERAL_ERROR, $lang['Vault_update_error'] , "", __LINE__, __FILE__, $lsql); } $lsql= "UPDATE ". VAULT_GENERAL_TABLE . " SET config_value = '$min' WHERE config_name = 'stock_min_change' "; if ( !($lresult = $db->sql_query($lsql)) ) { message_die(GENERAL_ERROR, $lang['Vault_update_error'] , "", __LINE__, __FILE__, $lsql); } $lsql= "UPDATE ". VAULT_GENERAL_TABLE . " SET config_value = '$max' WHERE config_name = 'stock_max_change' "; if ( !($lresult = $db->sql_query($lsql)) ) { message_die(GENERAL_ERROR, $lang['Vault_update_error'] , "", __LINE__, __FILE__, $lsql); } $lsql= "UPDATE ". CONFIG_TABLE . " SET config_value = '$time' WHERE config_name = 'stock_time' "; if ( !($lresult = $db->sql_query($lsql)) ) { message_die(GENERAL_ERROR, $lang['Vault_update_error'] , "", __LINE__, __FILE__, $lsql); } vault_update_general_config(); message_die(GENERAL_MESSAGE, sprintf($lang['Vault_exchange_updated_return_settings'], '<a href="' . append_sid(basename(__FILE__)) . '">', '</a>'), $lang['Vault_settings']); } if( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) ) { $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode']; } else { $mode = ""; } if( isset($HTTP_POST_VARS['add']) || isset($HTTP_GET_VARS['add']) ) { $template->set_filenames(array( "body" => 'admin/config_vault_exchange_add_body.tpl') ); $template->assign_block_vars('exchange_add',array()); $s_hidden_fields = '<input type="hidden" name="mode" value="savenew" />'; $template->assign_vars(array( 'L_VAULT_EXCHANGE_ADD_SETTINGS' => $lang['Vault_exchange_settings_add'], 'L_VAULT_EXCHANGE_ADD_SETTINGS_EXPLAIN' => $lang['Vault_exchange_settings_explain_add'], 'L_STOCK_EXCHANGE_ACTIONS_ADD' => $lang['Vault_exchange_actions_add'], 'L_STOCK_NAME' => $lang['Vault_exchange_actions_name'], 'L_STOCK_DESC' => $lang['Vault_exchange_actions_desc'], 'L_STOCK_AMOUNT' => $lang['Vault_exchange_actions_amount'], "S_HIDDEN_FIELDS" => $s_hidden_fields) ); } else if ( $mode != "" ) { switch( $mode ) { case 'delete': $stock_id = ( !empty($HTTP_POST_VARS['id']) ) ? $HTTP_POST_VARS['id'] : $HTTP_GET_VARS['id']; $sql = "SELECT * FROM " . VAULT_EXCHANGE_USERS_TABLE . " WHERE stock_id = " . $stock_id; $result = $db->sql_query($sql); if( !$result ) { message_die(GENERAL_ERROR, "Couldn't delete stock", "", __LINE__, __FILE__, $sql); } $users = $db->sql_fetchrowset($result); for ( $i = 0 ; $i < count ( $users ) ; $i ++ ) { $ssql = "SELECT stock_price FROM " . VAULT_EXCHANGE_TABLE . " WHERE stock_id = " . $stock_id; $sresult = $db->sql_query($ssql); if( !$sresult ) { message_die(GENERAL_ERROR, "Couldn't delete stock", "", __LINE__, __FILE__, $ssql); } $prize = $db->sql_fetchrow($sresult); $price = $prize['stock_price'] * $users[$i]['stock_amount']; $usql = "UPDATE " . USERS_TABLE . " SET user_points = user_points + $price WHERE user_id = ".$users[$i]['user_id']; $uresult = $db->sql_query($usql); if( !$uresult ) { message_die(GENERAL_ERROR, "Couldn't delete stock", "", __LINE__, __FILE__, $usql); } } $sql = "DELETE FROM " . VAULT_EXCHANGE_USERS_TABLE . " WHERE stock_id = " . $stock_id; $result = $db->sql_query($sql); if( !$result ) { message_die(GENERAL_ERROR, "Couldn't delete stock", "", __LINE__, __FILE__, $sql); } $sql = "DELETE FROM " . VAULT_EXCHANGE_TABLE . " WHERE stock_id = " . $stock_id; $result = $db->sql_query($sql); if( !$result ) { message_die(GENERAL_ERROR, "Couldn't delete stock", "", __LINE__, __FILE__, $sql); } message_die(GENERAL_MESSAGE, sprintf($lang['Vault_exchange_deleted_return_settings'], '<a href="' . append_sid(basename(__FILE__)) . '">', '</a>'), $lang['Vault_settings']); break; case 'edit': $stock_id = ( !empty($HTTP_POST_VARS['id']) ) ? $HTTP_POST_VARS['id'] : $HTTP_GET_VARS['id']; $sql = "SELECT * FROM " . VAULT_EXCHANGE_TABLE . " WHERE stock_id = " . $stock_id; $result = $db->sql_query($sql); if( !$result ) { message_die(GENERAL_ERROR, 'Could not obtain stock exchange information', "", __LINE__, __FILE__, $sql); } $stock_data = $db->sql_fetchrow($result); $template->set_filenames(array( "body" => 'admin/config_vault_exchange_add_body.tpl') ); $template->assign_block_vars('exchange_edit',array()); $s_hidden_fields = '<input type="hidden" name="mode" value="save" /><input type="hidden" name="stock_id" value="' . $stock_data['stock_id'] . '" />'; $template->assign_vars(array( 'STOCK_NAME' => $stock_data['stock_name'], 'STOCK_TOTAL' => $stock_data['stock_total'], 'L_STOCK_TOTAL' => $lang['Vault_exchange_stock_total'], 'STOCK_DESC' => $stock_data['stock_desc'], 'STOCK_AMOUNT' => $stock_data['stock_price'], 'L_STOCK_EXCHANGE_ACTIONS_EDIT' => $lang['Vault_exchange_actions_edit'], 'L_VAULT_EXCHANGE_EDIT_SETTINGS' => $lang['Vault_exchange_settings_edit'], 'L_VAULT_EXCHANGE_EDIT_SETTINGS_EXPLAIN' => $lang['Vault_exchange_settings_explain_edit'], 'L_STOCK_NAME' => $lang['Vault_exchange_actions_name'], 'L_STOCK_DESC' => $lang['Vault_exchange_actions_desc'], 'L_STOCK_AMOUNT' => $lang['Vault_exchange_actions_amount'], "S_HIDDEN_FIELDS" => $s_hidden_fields) ); break; case "save": $stock_name = ( isset($HTTP_POST_VARS['stock_name']) ) ? trim($HTTP_POST_VARS['stock_name']) : trim($HTTP_GET_VARS['stock_name']); $stock_desc = ( isset($HTTP_POST_VARS['stock_desc']) ) ? trim($HTTP_POST_VARS['stock_desc']) : trim($HTTP_GET_VARS['stock_desc']); $stock_price = ( isset($HTTP_POST_VARS['stock_price']) ) ? intval($HTTP_POST_VARS['stock_price']) : intval($HTTP_GET_VARS['stock_price']); $stock_total = ( isset($HTTP_POST_VARS['stock_total']) ) ? intval($HTTP_POST_VARS['stock_total']) : intval($HTTP_GET_VARS['stock_total']); $stock_id = ( isset($HTTP_POST_VARS['stock_id']) ) ? intval($HTTP_POST_VARS['stock_id']) : intval($HTTP_GET_VARS['stock_id']); if ($stock_name == '' || $stock_desc == '' || $stock_price == '' || $stock_total == '') { message_die(MESSAGE, $lang['Fields_empty']); } $sql = "UPDATE " . VAULT_EXCHANGE_TABLE . " SET stock_name = '" . str_replace("\'", "''", $stock_name) . "', stock_desc = '" . str_replace("\'", "''", $stock_desc) . "', stock_total = $stock_total, stock_price = $stock_price WHERE stock_id = " . $stock_id; $result = $db->sql_query($sql); if( !$result ) { message_die(GENERAL_ERROR, "Couldn't update stock", "", __LINE__, __FILE__, $sql); } message_die(GENERAL_MESSAGE, sprintf($lang['Vault_exchange_edited_return_settings'], '<a href="' . append_sid(basename(__FILE__)) . '">', '</a>'), $lang['Vault_settings']); break; case "savenew": $sql = "SELECT * FROM " . VAULT_EXCHANGE_TABLE ." ORDER BY stock_id DESC LIMIT 1"; $result = $db->sql_query($sql); if( !$result ) { message_die(GENERAL_ERROR, 'Could not obtain stock exchange information', "", __LINE__, __FILE__, $sql); } $stock_data = $db->sql_fetchrow($result); $stock_name = ( isset($HTTP_POST_VARS['stock_name']) ) ? trim($HTTP_POST_VARS['stock_name']) : trim($HTTP_GET_VARS['stock_name']); $stock_desc = ( isset($HTTP_POST_VARS['stock_desc']) ) ? trim($HTTP_POST_VARS['stock_desc']) : trim($HTTP_GET_VARS['stock_desc']); $stock_price = ( isset($HTTP_POST_VARS['stock_price']) ) ? intval($HTTP_POST_VARS['stock_price']) : intval($HTTP_GET_VARS['stock_price']); $stock_id = $stock_data['stock_id'] +1; if ($stock_name == '' || $stock_desc == '' || $stock_price == '' ) { message_die(MESSAGE, $lang['Fields_empty']); } $sql = "INSERT INTO " . VAULT_EXCHANGE_TABLE . " (stock_id, stock_name, stock_desc,stock_total,stock_price,stock_previous_price,stock_worst_price,stock_best_price) VALUES ( $stock_id, '" . str_replace("\'", "''", $stock_name) . "' , '" . str_replace("\'", "''", $stock_desc) . "' ,$stock_total, $stock_price, $stock_price, $stock_price, $stock_price)"; $result = $db->sql_query($sql); if( !$result ) { message_die(GENERAL_ERROR, "Couldn't insert new stock", "", __LINE__, __FILE__, $sql); } message_die(GENERAL_MESSAGE, sprintf($lang['Vault_exchange_added_return_settings'], '<a href="' . append_sid(basename(__FILE__)) . '">', '</a>'), $lang['Vault_settings']); break; } } else { $sql = "SELECT * FROM " . VAULT_EXCHANGE_TABLE ." ORDER BY stock_id "; $result = $db->sql_query($sql); if( !$result ) { message_die(GENERAL_ERROR, "Couldn't obtain stock exchange from database", "", __LINE__, __FILE__, $sql); } $exchange = $db->sql_fetchrowset($result); for($i = 0; $i < count($exchange); $i++) { $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; $stock_name = isset($lang[$exchange[$i]['stock_name']]) ? $lang[$exchange[$i]['stock_name']] : $exchange[$i]['stock_name']; $stock_desc = isset($lang[$exchange[$i]['stock_desc']]) ? $lang[$exchange[$i]['stock_desc']] : $exchange[$i]['stock_desc']; $template->assign_block_vars("exchange", array( "ROW_COLOR" => "#" . $row_color, "ROW_CLASS" => $row_class, "STOCK_NAME" => $stock_name, "STOCK_DESC" => $stock_desc, "STOCK_AMOUNT" => $exchange[$i]['stock_price'], "U_STOCK_EDIT" => append_sid("admin_vault_exchange.$phpEx?mode=edit&id=" . $exchange[$i]['stock_id']), "U_STOCK_DELETE" => append_sid("admin_vault_exchange.$phpEx?mode=delete&id=" . $exchange[$i]['stock_id'])) ); } $template->assign_vars(array( 'L_STOCK_EXCHANGE_ACTIONS' => $lang['Vault_exchange_actions'], 'L_STOCK_NAME' => $lang['Vault_exchange_actions_name'], 'L_STOCK_DESC' => $lang['Vault_exchange_actions_desc'], 'L_STOCK_AMOUNT' => $lang['Vault_exchange_actions_amount'], 'L_ACTION' => $lang['Vault_exchange_action'], 'L_EDIT' => $lang['Vault_exchange_edit'], 'L_DELETE' => $lang['Vault_exchange_delete'], 'L_STOCK_ADD' => $lang['Vault_exchange_actions_add'], )); } $template->assign_vars(array( 'VAULT_EXCHANGE_USE_CHECKED' => ( $board_config['stock_use'] ? 'CHECKED' :'' ), 'VAULT_EXCHANGE_TIME' => $board_config['stock_time'], 'VAULT_EXCHANGE_TIME_EXPLAIN' => $lang['Vault_time_explain'].vault_make_time($board_config['stock_time']), 'VAULT_EXCHANGE_MAX' => $vault['stock_max_change'], 'VAULT_EXCHANGE_MIN' => $vault['stock_min_change'], 'L_VAULT_EXCHANGE_LANGUAGE_KEY' => $lang['Vault_language_key'], 'L_VAULT_EXCHANGE_SETTINGS' => $lang['Vault_exchange_settings'], 'L_VAULT_EXCHANGE_SETTINGS_EXPLAIN' => $lang['Vault_exchange_settings_explain'], 'L_VAULT_EXCHANGE_USE' => $lang['Vault_exchange_use'], 'L_VAULT_EXCHANGE_MIN' => $lang['Vault_exchange_min'], 'L_VAULT_EXCHANGE_MIN_EXPLAIN' => $lang['Vault_exchange_min_explain'], 'L_VAULT_EXCHANGE_MAX' => $lang['Vault_exchange_max'], 'L_VAULT_EXCHANGE_MAX_EXPLAIN' => $lang['Vault_exchange_max_explain'], 'L_VAULT_EXCHANGE_TIME' => $lang['Vault_exchange_time'], 'L_VAULT_EXCHANGE_TIME_EXPLAIN' => $lang['Vault_exchange_time_explain'], 'L_SUBMIT' => $lang['Submit'], 'S_VAULT_ACTION' => append_sid(basename(__FILE__)), "S_HIDDEN_FIELDS" => $s_hidden_fields) ); $template->pparse('body'); include('./page_footer_admin.'.$phpEx); ?>
加入~有兩處...您漏了代碼: 選擇全部
$stock_total = ( isset($HTTP_POST_VARS['stock_total']) ) ? intval($HTTP_POST_VARS['stock_total']) : intval($HTTP_GET_VARS['stock_total']);
$sql = "INSERT INTO " . VAULT_EXCHANGE_TABLE . "......
上方那一處...
但是我看了看我没有漏掉哩