Bank Mod problem - wrong path

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Bank Mod problem - wrong path
DeadVoltWalking
CZ Newbie
 Codezwiz Site Donator
DeadVoltWalking has been a member for over 17 year's 17 Year Member
Gender: Male
Website:
Status: Offline
Joined: Mar 20, 2007
0.00 posts per day
Posts: 10
Points: 2,700
   
I installed the bank mod and got the admin section to work(could set up the bank), but when I open the bank, it goes to www.sitename/bank.php, when it should be going to www.sitename/modules.php?name=bank

If the bank is turned off, it goes to [ Register or login to view links on this board. ] , and says "sorry but the bank is closed...etc" but as soon as it is turned on, it goes to the [ Register or login to view links on this board. ] location....

I assume it has to do with something in bank.php, but I'm a noob and can't figure out where in the file I can designate the root path, if that is even possible..

<?php
/***************************************************************************
*                               bank.php
*                            -------------------
*   Version              : 1.5.0
*   began                : Tuesday, December 17th, 2002
*   released             : Wednesday, December 18th, 2002
*   last updated         : Monday, June 30th, 2003
*   email                : [ Register or login to view links on this board. ]
*
***************************************************************************/

/***************************************************************************
*
*   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://www.gnu.org/copyleft/gpl.html
*
***************************************************************************/

if (!eregi("modules.php", $PHP_SELF)) {
    die ("You can't access this file directly...");
}
if ($popup != "1"){
    $module_name = basename(dirname(__FILE__));
    require("modules/".$module_name."/nukebb.php");
}
else
{
    $phpbb_root_path = 'modules/Forums/';
}

define('IN_PHPBB', true);
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, $nukeuser);
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) page
if (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 page
elseif ($_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('includes/page_header.' . $phpEx);

$template->pparse('body');

include('includes/page_tail.' . $phpEx);

?>


I'm using Ravennuke 7.6, which I suppose could be the problem, but I've gotten other mods to work, such as the Arcade and the Cash mod.

Is there anything that I can adjust in the bank.php that will make the link "www.sitename/modules.php?name=bank" instead of going to the main php root? Or is this mod just not going to work with my PHP version?

I tried to cheat, and made a redirect to "www.sitename/modules.php?name=bank" , but, as I should have realized would happen, it just looped back and forth from the bank.php file I put in the root(the redirect), and the actual bank.php.

Thanks for your help.


Back to top Reply with quote
#2   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,440
   
Is it supposed to be:

modules.php?name=Bank

or

modules.php?name=Forums&file=bank

I thought it was the latter. Let me know and I will try to help you out.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   re: Bank Mod problem - wrong path
DeadVoltWalking
CZ Newbie
 Codezwiz Site Donator
DeadVoltWalking has been a member for over 17 year's 17 Year Member
Gender: Male
Website:
Status: Offline
Joined: Mar 20, 2007
0.00 posts per day
Posts: 10
Points: 2,700
   
I'm an idiot...I found it.
header("Location: bank.php");



Should be
header("Location: modules.php?name=Forums&file=bank");


Works now...I thought I had tried that..Must have done it wrong before..

Duh on my part..


Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum