Mark F Posted July 11, 2008 Posted July 11, 2008 My loan officer page is displaying as a white page for some reason. Does anyone know why this would be? I am using MC-Codes v2.0 <?php session_start(); require "globals.php"; print "<h3>Loan Officer</h3> Welcome to the Loan Officer!"; if($ir['level']>=10 || $ir['user_level'] == 1) { if($ir['loan_days'] == $ir['loan_days_max']) { print "You have had your bank account frozen. and you have lost your house. From now on until your loan balance is paid fully you will not recieve any money for your efforts."; $db->query("UPDATE users SET bank_frozen=1,lose_house=1 WHERE userid=$userid"); exit; } else { switch($_GET['action']) { case "deposit": deposit(); break; case "withdraw": withdraw(); break; default: index(); break; } function index() { global $ir,$db,$userid,$h; $loanleft = $ir['maxloan']-$ir['loan']+$ir['loanintrest']; print "\n[b]Your maxloan is \${$ir['maxloan']}. Your current loan is \${$ir['loan']}.[/b] At the end of each day, 10% of your loan amount will be taken away from your on-hand cash until you repay your loan. <table width='75%' border='2'> <tr> <td width='50%'>[b]Pay Back Money[/b] <form action='loanofficer.php?action=deposit' method='post'> Amount: <input type='text' name='deposit' value='{$ir['loan']}' /> <input type='submit' value='Pay Back' /></form></td> <td> [b]Take money[/b] <form action='loanofficer.php?action=withdraw' method='post'> Amount: <input type='text' name='withdraw' value='$loanleft' /> <input type='submit' value='Take Out' /></form></td> </tr> </table>"; } function deposit() { global $ir,$db,$userid,$h; $_POST['deposit']=abs((int) $_POST['deposit']); if($_POST['deposit'] > $ir['money']) { print "You do not have enough money to deposit this amount."; } else { $gain=$_POST['deposit']; $ir['loan']-=$gain; mysql_query("UPDATE users SET loan=loan-$gain, money=money-{$_POST['deposit']} where userid=$userid",$db); print "You hand over \${$_POST['deposit']} to be paid for your loan, [b]You now have a loan of \${$ir['loan']} taken out.[/b] [url='loanofficer.php']> Back[/url]"; } } function withdraw() { global $ir,$db,$userid,$h; $_POST['withdraw']=abs((int) $_POST['withdraw']); $loanleftstill = $ir['maxloan'] - $ir['loan']; if($_POST['withdraw'] > $loanleftstill) { print "You don't have enough money left in your max loan to withdraw this amount, choose a different amount or upgrade your max loan."; } else { $gain=$_POST['withdraw']; $ir['loan']+=$gain; mysql_query("UPDATE users SET loan=loan+$gain, money=money+$gain where userid=$userid",$db); print "You ask for and get a loan of $gain, [b]You now have a loan of \${$ir['loan']} taken out.[/b] [url='loanofficer.php']> Back[/url]"; } $h->endpage(); ?> Quote
AlabamaHit Posted July 11, 2008 Posted July 11, 2008 Re: Help Needed with Loan Officer All i see wrong on very quick look over is at the top... You don't need that session_start(); Take is out maybe its trying to run 2 sessions causing it????? Just a thought.... Quote
Mark F Posted July 11, 2008 Author Posted July 11, 2008 Re: Help Needed with Loan Officer Still not working, though thanks. Quote
Tonka Posted July 11, 2008 Posted July 11, 2008 Re: Help Needed with Loan Officer try this loanshark, http://criminalexistence.com/ceforums/index.php?topic=1571.0, you'll just need to convert it to v2 Quote
Dave Posted July 13, 2008 Posted July 13, 2008 Re: Help Needed with Loan Officer Does your host have PHP errors turned on? Quote
Guest Anonymous Posted July 13, 2008 Posted July 13, 2008 Re: Help Needed with Loan Officer Add in your .htaccess php_flag display_errors on Should bring up a error on the page. Quote
Akash Posted July 14, 2008 Posted July 14, 2008 Re: Help Needed with Loan Officer Umm I'm not too sure, but you've missed out quite a few {'s or }'s. So below, I've done what I think may work Please Note: This is not tested, and the { or } may be added in the wrong place ['b] <?php require "globals.php"; print "<h3>Loan Officer</h3> Welcome to the Loan Officer!"; if($ir['level']>=10 || $ir['user_level'] == 1) { if($ir['loan_days'] == $ir['loan_days_max']) { print "You have had your bank account frozen. and you have lost your house. From now on until your loan balance is paid fully you will not recieve any money for your efforts."; $db->query("UPDATE users SET bank_frozen=1,lose_house=1 WHERE userid=$userid"); exit; } } else { switch($_GET['action']) { case "deposit": deposit(); break; case "withdraw": withdraw(); break; default: index(); break; } function index() { global $ir,$db,$userid,$h; $loanleft = $ir['maxloan']-$ir['loan']+$ir['loanintrest']; print "\n[b]Your maxloan is \${$ir['maxloan']}. Your current loan is \${$ir['loan']}.[/b] At the end of each day, 10% of your loan amount will be taken away from your on-hand cash until you repay your loan. <table width='75%' border='2'> <tr> <td width='50%'>[b]Pay Back Money[/b] <form action='loanofficer.php?action=deposit' method='post'> Amount: <input type='text' name='deposit' value='{$ir['loan']}' /> <input type='submit' value='Pay Back' /></form></td> <td> [b]Take money[/b] <form action='loanofficer.php?action=withdraw' method='post'> Amount: <input type='text' name='withdraw' value='$loanleft' /> <input type='submit' value='Take Out' /></form></td> </tr> </table>"; } function deposit() { global $ir,$db,$userid,$h; $_POST['deposit']=abs((int) $_POST['deposit']); if($_POST['deposit'] > $ir['money']) { print "You do not have enough money to deposit this amount."; } else { $gain=$_POST['deposit']; $ir['loan']-=$gain; mysql_query("UPDATE users SET loan=loan-$gain, money=money-{$_POST['deposit']} where userid=$userid",$db); print "You hand over \${$_POST['deposit']} to be paid for your loan, [b]You now have a loan of \${$ir['loan']} taken out.[/b] [url='loanofficer.php']> Back[/url]"; } } function withdraw() { global $ir,$db,$userid,$h; $_POST['withdraw']=abs((int) $_POST['withdraw']); $loanleftstill = $ir['maxloan'] - $ir['loan']; if($_POST['withdraw'] > $loanleftstill) { print "You don't have enough money left in your max loan to withdraw this amount, choose a different amount or upgrade your max loan."; } else { $gain=$_POST['withdraw']; $ir['loan']+=$gain; mysql_query("UPDATE users SET loan=loan+$gain, money=money+$gain where userid=$userid",$db); print "You ask for and get a loan of $gain, [b]You now have a loan of \${$ir['loan']} taken out.[/b] [url='loanofficer.php']> Back[/url]"; } } } $h->endpage(); ?> Quote
Mark F Posted July 15, 2008 Author Posted July 15, 2008 Re: Help Needed with Loan Officer Umm I'm not too sure, but you've missed out quite a few {'s or }'s. So below, I've done what I think may work Please Note: This is not tested, and the { or } may be added in the wrong place ['b] <?php require "globals.php"; print "<h3>Loan Officer</h3> Welcome to the Loan Officer!"; if($ir['level']>=10 || $ir['user_level'] == 1) { if($ir['loan_days'] == $ir['loan_days_max']) { print "You have had your bank account frozen. and you have lost your house. From now on until your loan balance is paid fully you will not recieve any money for your efforts."; $db->query("UPDATE users SET bank_frozen=1,lose_house=1 WHERE userid=$userid"); exit; } } else { switch($_GET['action']) { case "deposit": deposit(); break; case "withdraw": withdraw(); break; default: index(); break; } function index() { global $ir,$db,$userid,$h; $loanleft = $ir['maxloan']-$ir['loan']+$ir['loanintrest']; print "\n[b]Your maxloan is \${$ir['maxloan']}. Your current loan is \${$ir['loan']}.[/b] At the end of each day, 10% of your loan amount will be taken away from your on-hand cash until you repay your loan. <table width='75%' border='2'> <tr> <td width='50%'>[b]Pay Back Money[/b] <form action='loanofficer.php?action=deposit' method='post'> Amount: <input type='text' name='deposit' value='{$ir['loan']}' /> <input type='submit' value='Pay Back' /></form></td> <td> [b]Take money[/b] <form action='loanofficer.php?action=withdraw' method='post'> Amount: <input type='text' name='withdraw' value='$loanleft' /> <input type='submit' value='Take Out' /></form></td> </tr> </table>"; } function deposit() { global $ir,$db,$userid,$h; $_POST['deposit']=abs((int) $_POST['deposit']); if($_POST['deposit'] > $ir['money']) { print "You do not have enough money to deposit this amount."; } else { $gain=$_POST['deposit']; $ir['loan']-=$gain; mysql_query("UPDATE users SET loan=loan-$gain, money=money-{$_POST['deposit']} where userid=$userid",$db); print "You hand over \${$_POST['deposit']} to be paid for your loan, [b]You now have a loan of \${$ir['loan']} taken out.[/b] [url='loanofficer.php']> Back[/url]"; } } function withdraw() { global $ir,$db,$userid,$h; $_POST['withdraw']=abs((int) $_POST['withdraw']); $loanleftstill = $ir['maxloan'] - $ir['loan']; if($_POST['withdraw'] > $loanleftstill) { print "You don't have enough money left in your max loan to withdraw this amount, choose a different amount or upgrade your max loan."; } else { $gain=$_POST['withdraw']; $ir['loan']+=$gain; mysql_query("UPDATE users SET loan=loan+$gain, money=money+$gain where userid=$userid",$db); print "You ask for and get a loan of $gain, [b]You now have a loan of \${$ir['loan']} taken out.[/b] [url='loanofficer.php']> Back[/url]"; } } } $h->endpage(); ?> It no longer displays up as a blank page, though it is still not working, thanks anyhow. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.