Re: Free Loan Shark System
Version 2
this does work tryed it
<?php
require "globals.php";
switch($_GET['action'])
{
case 'borrow': borrow_money_start(); break;
case 'borrowed': borrow_money(); break;
case 'repay': repay_money_start(); break;
case 'repayed': repay_money(); break;
case 'invest': invest_money(); break;
case 'invested': invested_money(); break;
default: loanshark_main(); break;
}
function loanshark_main()
{
global $ir,$c,$userid,$h;
$maxloan=$ir['level']*50000;
echo "<h2>Loan Shark</h2>
You currently have a loan of \${$ir['loan']}
The max you can loan is \$$maxloan
- [url='loanshark.php?action=borrow']Loan Money[/url]
- [url='loanshark.php?action=repay']Repay Loan[/url]
- [url='loanshark.php?action=invest']Invest Money[/url]
";
}
function borrow_money_start()
{
global $ir,$c,$userid,$h;
$maxloan=$ir['level']*50000;
echo "The max amount you can borrow is \$$maxloan
You currently have a lone of \${$ir['loan']}
<form action='loanshark.php?action=borrowed' method='post'>
Ammount: <input type=text value='$maxloan' name=borrowed>
<input type=submit value='Borrow'>";
}
function borrow_money()
{
global $ir,$c,$userid,$h;
$maxloan=$ir['level']*50000;
$loan=$ir['loan'];
if ($loan == $maxloan)
{
die("You have already taken out the max loan possible you must pay it back before you can loan more
> [url='loanshark.php?action=repay']Repay[/url]");
}
if ($_POST['borrowed'] >= $maxloan)
{
die("You are trying to loan more then your max lone
> [url='loanshark.php?action=borrow']Back[/url]");
}
mysql_query("UPDATE users SET loan=loan+{$_POST['borrowed']} WHERE userid=$userid",$c);
mysql_query("UPDATE users SET money=money+{$_POST['borrowed']} WHERE userid=$userid",$c);
echo"You Borrowed from the loan shark
> [url='loanshark.php']Back[/url]";
}
function repay_money_start()
{
global $ir,$c,$userid,$h;
echo"You have a lone of \${$ir['loan']}
<form action='loanshark.php?action=repayed' method='post'>
Ammount: <input type=text value='{$ir['loan']}' name=repayed>
<input type=submit value='Repay'>";
}
function repay_money()
{
global $ir,$c,$userid,$h;
if($ir['loan'] <= 0)
{
die("You are trying to payback more then u have to
> [url='loanshark.php']Back[/url]");
}
mysql_query("UPDATE users SET loan=loan-{$_POST['repayed']} WHERE userid=$userid",$c);
mysql_query("UPDATE users SET money=money-{$_POST['repayed']} WHERE userid=$userid",$c);
echo"You repayed the loan shark
> [url='loanshark.php']Back[/url]";
}
function invest_money()
{
global $ir,$c,$userid,$h;
echo"Here you can invest money on the spot and watch your money sink or float its simple you state the ammount you wish to invest in the box below and click Invest
You have [b]{$ir['investments']}[/b] dayily invest statment's left
<form action='loanshark.php?action=invested' method='post'>
Ammount: \$<input type=text name=invest>
<input type=submit value='Invest'>
";
}
function invested_money()
{
global $ir,$c,$userid,$h;
if ($ir['investments'] < 1)
{
die("You have used up all your dayily investments
> [url='loanshark.php?action=invest']Back[/url]");
}
if(rand(1,100) <= 50)
{
$gainedmoney=(int) rand(1,30);
print "<font color=green>[b]Result: You hand over {$_POST['invest']} to the old man at the counter
One week later you get a phone call its the old man he explains that your investment has payed off
You invested ${$_POST['invest']} and ended up making \$$gainedmoney extra.</font>[/b]
You have [b]{$ir['investments']}[/b] dayily invest statment's left
> [url='loanshark.php?action=invest']Try Again[/url]";
mysql_query("UPDATE users SET investments=investments-1",$c);
mysql_query("UPDATE users SET money=money+$gainedmoney WHERE userid=$userid",$c);
}
else
{
if ($ir['investments'] < 1)
{
die("You have used up all your dayily investments
> [url='loanshark.php?action=invest']Back[/url]");
}
$lostmoney=(int) rand(1,10);
mysql_query("UPDATE users SET money=money-$lostmoney WHERE userid=$userid", $c);
echo"<font color=red>[b]Result: You invested \${$_POST['invest']} and lost \$$lostmoney out of your overall investment.
One week later you get a phone call its the old man he explains that your investment has failed
</font>[/b]
You have [b]{$ir['investments']}[/b] dayily invest statment's left
> [url='loanshark.php?action=invest']Try Again[/url]
";
mysql_query("UPDATE users SET investments=investments-1",$c);
}
}
$h->endpage();
?>