iGuest 3 Report post Posted March 6, 2005 Alright Naz, can you post the contents of bank.php around line 69? If you can't figure out which line that is, just post the first hundred lines or so. Share this post Link to post Share on other sites
iGuest 3 Report post Posted March 6, 2005 <?php/*************************************************************************** * bank.php * ------------------- * Version : 1.5.0 * began : Tuesday, December 17th, 2002 * released : Wednesday, December 18th, 2002 * last updated : Monday, June 30th, 2003 * email : zarath@knightsofchaos.com * ***************************************************************************//*************************************************************************** * * copyright (C) 2002/2003 IcE-RaiN/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://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);include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_bank.' . $phpEx);//// Start session management//$userdata = session_pagestart($user_ip, PAGE_INDEX);init_userprefs($userdata);//// End session management//if ( !$userdata['session_logged_in'] ){ $redirect = "bank.$phpEx"; $redirect .= ( isset($user_id) ) ? '&user_id=' . $user_id : ''; header('Location: ' . append_sid("login.$phpEx?redirect=$redirect", true));}$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'); }if ($board_config['bankopened'] == "off") { message_die(GENERAL_MESSAGE, $lang['error_bank_closed']); }$restockntime = time();if (($restockntime - $board_config['banklastrestocked']) > $board_config['bankpayouttime']){ $sql = "update " . CONFIG_TABLE . " set config_value='$restockntime' where config_name='banklastrestocked'"; if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Updating Bank Time!<br>'.mysql_error()); } $sql = "select * from phpbb_bank"; if ( !($uiresult = $db->sql_query($sql)) ) { message_die(CRITICAL_ERROR, 'Error Getting Bank Users!<br>'.mysql_error()); } $interesttime = $restockntime - $board_config['banklastrestocked']; $interesttime = $interesttime / $board_config['bankpayouttime']; for ($x = 0; $x < mysql_num_rows($uiresult); $x++) { $holding = ""; $holdingplus = ""; $uirow = mysql_fetch_array($uiresult); $holdingplus = ((($uirow['holding'] / 100) * $board_config['bankinterest']) * $interesttime); $holding = $uirow['holding'] + $holdingplus; $holding = round($holding); $usql = "update phpbb_bank set holding='$holding' where name='$uirow[name]'"; if ( !($db->sql_query($usql)) ) { message_die(GENERAL_MESSAGE, 'Error Giving Interest Out!<br>'.mysql_error()); } } header("Location: bank.php");}$sql = "select * from phpbb_bank where name='{$userdata['user_id']}'";if ( !($result = $db->sql_query($sql)) ) { message_die(CRITICAL_ERROR, 'Error Getting Bank Users!<br>'.mysql_error()); }$row = mysql_fetch_array($result);//default bank.php (bank-info) pageif (empty($_REQUEST['action'])){ $template->set_filenames(array( 'body' => 'bank_body.tpl') ); if (!is_numeric($row['holding'])) { $bankcommands = '<tr><td class="row2"><span class="gensmall">'.$lang['no_account'].'!</span></td></tr><tr><td class="row2"><span class="gen"><a href="'.append_sid("bank.$phpEx?action=createaccount").'" title="Open an Account!">'.$lang['open_account'].'</a></span></td></tr>'; $title = $board_config['bankname'].'; '.$lang['open_account']; $tablerows = 1; } $banklocation = ' -> <a href="'.append_sid("bank.".$phpEx).'" class="nav">'.$board_config['bankname'].'</a>'; if (!isset($title)) { $sql = "select * from phpbb_bank where id>0"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Getting Total Users!<br>'.mysql_error()); } $bankusers = mysql_num_rows($result); $bankholdings = 0; for ($x = 0;$x < mysql_num_rows($result);$x++) { $bhrow = mysql_fetch_array($result); $bankholdings = $bankholdings + $bhrow['holding']; } if ($row['fees'] == "on") { $withdrawtotal = round($row['holding'] / 100 * $board_config['bankfees']); $withdrawtotal = $row['holding'] - $withdrawtotal; } else { $withdrawtotal = $row['holding']; } $title = $board_config['bankname'].'; '.$lang['deposit_withdraw'].' '.$board_config['points_name']; $tablerows = 2; $bankcommands = '<tr><td class="row2" colspan="2"><span class="gen"><b>'.$lang['bank_actions'].'</b></span></td></tr><form method="post" action="'.append_sid("bank.$phpEx?action=deposit").'"><tr><td class="row2"><input type="submit" class="liteoption" name="Deposit" value="'.$lang['button_deposit'].'"></td><td class="row2"><input type="text" class="post" name="deposit" size="20" value="'.$userdata['user_points'].'"></td></tr></form><form method="post" action="'.append_sid("bank.$phpEx?action=withdraw").'"><tr><td class="row2"><input type="submit" class="liteoption" name="Withdraw" value="'.$lang['button_withdraw'].'"></td><td class="row2"><input type="text" class="post" name="withdraw" size="20" value="'.$withdrawtotal.'"></td></tr></form><tr><td class="row2" colspan="2"><br></td></tr><tr><td class="row2" colspan="2"><span class="gen"><b>'.$lang['bank_info'].'</b></span></td></tr><tr><td class="row2"><span class="gen">'.$lang['bank_balance'].'</span></td><td class="row2"><span class="gen">'.$row['holding'].' '.$board_config['points_name'].'</span></td></tr><tr><td class="row2" colspan="2"><br></td></tr> <tr><td class="row2"><span class="gen">'.$lang['interest_rate'].'</span></td><td class="row2"><span class="gen">'.$board_config['bankinterest'].'%</span></td></tr><tr><td class="row2"><span class="gen">'.$lang['withdraw_rate'].'</span></td><td class="row2"><span class="gen">'.$board_config['bankfees'].'%</span></td></tr><tr><td class="row2"><span class="gen">'.$lang['total_accounts'].'</span></td><td class="row2"><span class="gen">'.$bankusers.'</span></td></tr><tr><td class="row2"><span class="gen">'.$lang['holding'].'</span></td><td class="row2"><span class="gen">'.$bankholdings.' '.$board_config['points_name'].'</span></td></tr><tr><td class="row2"><span class="gen">'.$lang['bank_openedsince'].'</span></td><td class="row2"><span class="gen">'.date("F j, Y, g:i a", $board_config['bankopened']).'</span></td></tr>'; } $page_title = $board_config['bankname']; $template->assign_vars(array( 'BANKLOCATION' => $banklocation, 'L_BANK_TITLE' => $title, 'BANKTABLEROWS' => $tablerows, 'BANKLIST' => $bankcommands, )); $template->assign_block_vars('', array());}elseif ($_REQUEST['action'] == "createaccount"){ if ( !$userdata['session_logged_in'] ) { $redirect = "bank.$phpEx&action=createaccount"; $redirect .= ( isset($user_id) ) ? '&user_id=' . $user_id : ''; header('Location: ' . append_sid("login.$phpEx?redirect=$redirect", true)); } $template->set_filenames(array( 'body' => 'bank_body.tpl') ); if (is_numeric($row['holding'])) { $bankcommands = '<tr><td class="row2"><span class="gensmall">'.$lang['yes_account'].'!</span></td></tr>'; } else { $opentime = time(); $sql = "insert into phpbb_bank (name, opentime, fees) values('{$userdata['user_id']}', '$opentime', 'on')"; if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Adding User Account!<br>'.mysql_error()); } $bankcommands = '<tr><td class="row2"><span class="gensmall">'.$lang['welcome_bank'].' '.$board_config['bankname'].'! <br>'.$lang['start_balance'].'<br>'.$lang['your_account'].'</span></td></tr>'; } $banklocation = ' -> <a href="'.append_sid("bank.".$phpEx).'" class="nav">'.$board_config['bankname'].'</a> -> <a href="'.append_sid("bank.".$phpEx."?action=createaccount").'" class="nav">'.$lang['open_account'].'</a>'; if (!isset($title)) { $title = $board_config['bankname'].'; '.$lang['open_account']; } $page_title = $board_config['bankname']; $template->assign_vars(array( 'BANKLOCATION' => $banklocation, 'L_BANK_TITLE' => $title, 'BANKTABLEROWS' => 1, 'BANKLIST' => $bankcommands, )); $template->assign_block_vars('', array());} //start of deposit pageelseif ($_REQUEST['action'] == "deposit"){ $template->set_filenames(array( 'body' => 'bank_body.tpl')); if ( !$userdata['session_logged_in'] ) { $redirect = "bank.$phpEx&action=deposit&deposit=$deposit"; $redirect .= ( isset($user_id) ) ? '&user_id=' . $user_id : ''; header('Location: ' . append_sid("login.$phpEx?redirect=$redirect", true)); } $deposit = round($_REQUEST['deposit']); if ((!is_numeric($deposit)) || ($deposit < 1)) { message_die(GENERAL_MESSAGE, $lang['error_deposit']); } if ($deposit > $userdata['user_points']) { message_die(GENERAL_MESSAGE, $lang['error_not_enough_deposit'].'!'); } $newbalance = $row['holding'] + $deposit; $newtotaldep = $row['totaldeposit'] + $deposit; $newpoints = $userdata['user_points'] - $deposit; $sql = "update " . USERS_TABLE . " set user_points='$newpoints' where user_id='{$userdata['user_id']}'"; if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Updating User Points!<br>'.mysql_error()); } $sql = "update phpbb_bank set holding='$newbalance', totaldeposit='$newtotaldep' where name='{$userdata['user_id']}'"; if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Updating User Points!<br>'.mysql_error()); } $newtotaldeps = $board_config['banktotaldeposits'] + $deposit; $sql = "update " . CONFIG_TABLE . " set config_value='$newtotaldeps' where config_name='banktotaldeposits'"; if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Updating Total Deposits!<br>'.mysql_error()); } $bankcommands = '<tr><td class="row2"><span class="gensmall">'.$lang['have_deposit'].' '.$deposit.' '.$board_config['points_name'].' '.$lang['to_account'].'<br>'.$lang['new_balance'].' '.$newbalance.'.<br>'.$lang['leave_with'].' '.$newpoints.' '.$board_config['points_name'].' '.$lang['on_hand'].'.</span></td></tr>'; $banklocation = ' -> <a href="'.append_sid("bank.".$phpEx).'" class="nav">'.$board_config['bankname'].'</a> -> <a href="'.append_sid("bank.$phpEx?action=deposit&deposit=$deposit").'" class="nav">'.$lang['deposit'].' '.$board_config['points_name'].'</a>'; $page_title = $board_config['bankname']; $title = 'Deposit '.$board_config['points_name']; $template->assign_vars(array( 'BANKLOCATION' => $banklocation, 'L_BANK_TITLE' => $title, 'BANKTABLEROWS' => 1, 'BANKLIST' => $bankcommands, )); $template->assign_block_vars('', array());}elseif ($_REQUEST['action'] == "withdraw"){ $template->set_filenames(array( 'body' => 'bank_body.tpl')); if ( !$userdata['session_logged_in'] ) { $redirect = "bank.$phpEx&action=withdraw&withdraw=$withdraw"; $redirect .= ( isset($user_id) ) ? '&user_id=' . $user_id : ''; header('Location: ' . append_sid("login.$phpEx?redirect=$redirect", true)); } $withdraw = round($_REQUEST['withdraw']); if ((!is_numeric($withdraw)) || ($withdraw < 1)) { message_die(GENERAL_MESSAGE, $lang['error_withdraw']); } if ($row['fees'] == "on") { $withdrawtotal = round((($withdraw / 100) * $board_config['bankfees'])); } else { $withdrawtotal = 0; } $withdrawtotal = $withdrawtotal + $withdraw; if ($row['holding'] < $withdrawtotal) { message_die(GENERAL_MESSAGE, $lang['error_not_enough_withdraw']); } $newbalance = $row['holding'] - $withdrawtotal; $newpoints = $userdata['user_points'] + $withdraw; $newtotalwit = $row['totalwithdrew'] + $withdraw; if ( !($db->sql_query("update " . USERS_TABLE . " set user_points='$newpoints' where user_id='{$userdata['user_id']}'")) ) { message_die(GENERAL_MESSAGE, 'Fatal Updating User Points!<br>'.mysql_error()); } if ( !($db->sql_query("update phpbb_bank set holding='$newbalance', totalwithdrew='$newtotalwit' where name='{$userdata['user_id']}'")) ) { message_die(GENERAL_MESSAGE, 'Fatal Updating User Points!<br>'.mysql_error()); } $newtotalwith = $board_config['banktotalwithdrew'] + $withdraw; $sql = "update " . CONFIG_TABLE . " set config_value='$newtotalwith' where config_name='banktotalwithdrew'"; if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Updating Total Withdrew!<br>'.mysql_error()); } $bankcommands = '<tr><td class="row2"><span class="gensmall">'.$lang['have_withdraw'].' '.$withdraw.' '.$board_config['points_name'].' '.$lang['from_account'].'.<br>'.$lang['new_balance'].' '.$newbalance.'.<br>'.$lang['now_have'].' '.$newpoints.' '.$board_config['points_name'].' '.$lang['on_hand'].'.</span></td></tr>'; $banklocation = ' -> <a href="'.append_sid("bank.".$phpEx).'" class="nav">'.$board_config['bankname'].'</a> -> <a href="'.append_sid("bank.$phpEx?action=deposit&deposit=$deposit").'" class="nav">'.$lang['withdraw'].' '.$board_config['points_name'].'</a>'; $page_title = $board_config['bankname']; $title = 'Withdraw '.$board_config['points_name']; $template->assign_vars(array( 'BANKLOCATION' => $banklocation, 'L_BANK_TITLE' => $title, 'BANKTABLEROWS' => 1, 'BANKLIST' => $bankcommands, )); $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);?> Share this post Link to post Share on other sites
iGuest 3 Report post Posted March 6, 2005 Okay, is there a bank admin panel? If so, can you find a field for Payout time or something similar? Share this post Link to post Share on other sites
iGuest 3 Report post Posted March 6, 2005 what do you mean? :S Share this post Link to post Share on other sites
iGuest 3 Report post Posted March 6, 2005 I think I got what you mean..thanks btw! Share this post Link to post Share on other sites
iGuest 3 Report post Posted March 6, 2005 Bang. Fixed. The script divides something by the time between payouts. You had that set to zero, so it was trying to divide by zero. The other errors were a result of the first error. :wink: Share this post Link to post Share on other sites
iGuest 3 Report post Posted March 6, 2005 1 more question, how to remove the BAN PANEL at the header..? Share this post Link to post Share on other sites
iGuest 3 Report post Posted March 6, 2005 Post the code for templates/*/overall_header.tpl, please, and I'll tell you what to delete. :DEDIT: And what's the interest period set to? I.E. how often is the interest awarded? Share this post Link to post Share on other sites
iGuest 3 Report post Posted March 6, 2005 <?xml version="1.0" encoding="{S_CONTENT_ENCODING}"?><!-- mod : ranks --><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://forums.xisto.com/no_longer_exists/ xmlns="http://forums.xisto.com/no_longer_exists/; dir="{S_CONTENT_DIRECTION}"><head><meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}" /><meta http-equiv="Content-Style-Type" content="text/css" />{META}{NAV_LINKS}<title>{SITENAME} :: {PAGE_TITLE}</title><link rel="stylesheet" href="templates/fisubice/{T_HEAD_STYLESHEET}" type="text/css" /><!-- BEGIN switch_enable_pm_popup --><script type="text/javascript"><!-- if ( {PRIVATE_MESSAGE_NEW_FLAG} ) { window.open('{U_PRIVATEMSGS_POPUP}', '_phpbbprivmsg', 'HEIGHT=225,resizable=yes,WIDTH=400');; }//--></script><!-- END switch_enable_pm_popup --></head><body><a name="top" id="top"></a><table class="bodyline" width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td><table width="100%" border="0" cellspacing="0" cellpadding="2"><tr> <td align="center" class="topnav"> <a href="{U_FAQ}">{L_FAQ}</a> ? <a href="{U_SEARCH}">{L_SEARCH}</a> ? <a href="{U_MEMBERLIST}">{L_MEMBERLIST}</a> ? <a href="{U_GROUP_CP}">{L_USERGROUPS}</a> ? <a href="{U_RANKS}" class="mainmenu">{L_RANKS}</a><!-- BEGIN switch_user_logged_out --> ? <a href="{U_REGISTER}">{L_REGISTER}</a><!-- END switch_user_logged_out --> ? <a href="{U_PROFILE}">{L_PROFILE}</a> ? <a href="Ban Panel" hspace="3" />Ban Panel</a> ? <a href="{U_PRIVATEMSGS}">{PRIVATE_MESSAGE_INFO}</a> ? <a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a> ? <a href="{U_BANK}" class="mainmenu">{BANK}</a></td></tr></table></table><p></p><center><script type="text/javascript"><!--google_ad_client = "pub-6156159733481735";google_ad_width = 728;google_ad_height = 90;google_ad_format = "728x90_as";google_ad_channel ="";//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script><center><script'>http://pagead2.googlesyndication.com/pagead/show_ads.js"></script><center><script type="text/javascript"><!--google_ad_client = "pub-6156159733481735";google_ad_width = 728;google_ad_height = 90;google_ad_format = "728x90_as";google_ad_channel ="";//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script> Share this post Link to post Share on other sites
iGuest 3 Report post Posted March 6, 2005 Find this part: <a href="Ban Panel" hspace="3" />Ban Panel</a> and remove it. And read my edit above. Share this post Link to post Share on other sites
iGuest 3 Report post Posted March 6, 2005 every 3600 seconds = 1hr Share this post Link to post Share on other sites
iGuest 3 Report post Posted March 6, 2005 Ooo. Nice **Goes to invest** Share this post Link to post Share on other sites