Guest User

bank 2

a guest
Dec 8th, 2012
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.03 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4.  
  5. include_once "includes/db_connect.php";
  6.  
  7. include_once "includes/functions.php";
  8.  
  9. logincheck();
  10.  
  11. $username=$_SESSION['username'];
  12.  
  13. $query=mysql_query("SELECT * FROM users WHERE username='$username'");
  14.  
  15. $fetch=mysql_fetch_object($query);
  16.  
  17.  
  18. ?>
  19. <html>
  20. <head>
  21. <link href="style.css" rel="stylesheet" type="text/css">
  22.  
  23. </head>
  24. <body>
  25.  
  26. <style type="text/css">
  27. .select {
  28. display: inline;
  29. padding: 5px 30px 5px 30px;
  30. }
  31.  
  32. .selected {
  33. display: inline;
  34. padding: 5px 30px 5px 30px;
  35. }
  36.  
  37. .row td {
  38. height: 20px;
  39. }
  40.  
  41. .alt td {
  42. height: 20px;
  43. }
  44.  
  45. .
  46. .button {
  47. margin-left: auto;
  48. margin-right: auto;
  49. }
  50.  
  51. .unselected_link {background: url(images/subhead.png) repeat-x;
  52. padding: 5px 20px 5px 20px;
  53. border: 1px solid #000000;
  54. width: 120px; }
  55. .selected_link {background: url(images/selected_box.png) repeat-x;
  56. padding: 5px 20px 5px 20px;
  57. border: 1px solid #000000;
  58. width: 120px; }
  59. </style>
  60.  
  61. <?
  62.  
  63. if(strip_tags($_POST['deposit'])){
  64.  
  65. $amount=intval(strip_tags($_POST['amount']));
  66.  
  67. if ($amount > "0"){
  68.  
  69. if ($amount == 0 || !$amount || ereg('[^0-9]',$amount)){
  70.  
  71. print "<center>You cant deposit that amount!<br><br>";
  72.  
  73. }elseif ($amount != 0 && $amount && !ereg('[^0-9]',$amount)){
  74.  
  75. if ($amount > $fetch->money){
  76.  
  77. echo "<center>You do not have that much money!<br><br>";
  78.  
  79. }elseif ($amount <= $fetch->money){
  80.  
  81. $user_loose = $fetch->money - $amount;
  82.  
  83. $bank_add = $amount;
  84.  
  85. mysql_query("UPDATE users SET money=money-$amount WHERE username='$username'");
  86. mysql_query("UPDATE users SET bankamount=bankamount+$amount WHERE username='$username'");
  87.  
  88. echo "<center>You have deposited &pound;".number_format($amount)." into your bank!<br><br>";
  89.  
  90. }}}}
  91.  
  92.  
  93. if(strip_tags($_POST['withdraw'])){
  94. $amount = $_POST['amount'];
  95.  
  96. if ($amount > "0"){
  97. if ($amount == 0 || !$amount || ereg('[^0-9]',$amount)){
  98. print "You cant withdraw that amount.";
  99.  
  100. }elseif ($amount != 0 || $amount || !ereg('[^0-9]',$amount)){
  101.  
  102. if ($amount > $fetch->bankamount){ echo "<center>You have not got that much money in your bank!<br><br>"; }elseif ($amount <= $fetch->bankamount){
  103.  
  104. $user_loose = $fetch->money - $amount;
  105.  
  106. $bank_add = $amount;
  107.  
  108. mysql_query("UPDATE users SET money=money+$amount WHERE username='$username'");
  109. mysql_query("UPDATE users SET bankamount=bankamount-$amount WHERE username='$username'");
  110.  
  111. echo "<center>You have withdrawn &pound;".number_format($amount)." from your bank!<br><br>";
  112.  
  113. }}}}
  114.  
  115. ?>
  116.  
  117. <table width="400" class="table" align="center" cellspacing="0" border="0" cellpadding="0">
  118. <tr class="header">
  119. <td colspan="2">Bank</td>
  120. </tr>
  121. <tr height="50px">
  122. <td align='center'><p>This shows you how much money is in your bank account and in your hand.</p>
  123. <p><i>Money in your bank account is safe from killers!</i></p></td>
  124. </tr>
  125. </table>
  126. <br />
  127. <form action="" method=POST>
  128. <table width="600" align="center">
  129. <tr>
  130. <td width="50%" align="left">
  131. <table width="90%" class="table" align="center" border=0 cellspacing="0"
  132. cellpadding="0">
  133. <tr class="header">
  134. <td>Actions</td>
  135. </tr>
  136. <tr>
  137. <td colspan="2" align="center" valign="bottom"><br />Amount: <input type="text" class="textbox" name="amount" id="amount" class="textinput"><br />
  138.  
  139. <br />
  140. <input type="submit" name="deposit" id="deposit" class="button" value="Deposit" /> - <input type="submit" name="withdraw" class="button" value="Withdraw" /><br /><br />
  141. </td>
  142. </tr>
  143. </table>
  144. </td>
  145.  
  146. <td width="50%" align="right" valign="top">
  147.  
  148. <table width="90%" class="table" align="center" border=0 cellspacing="0" cellpadding=0>
  149. <tr class="header">
  150. <td colspan="2">Infomation</td>
  151. </tr>
  152. <tr>
  153. <td width="75" style="padding:8px;" align="right">Hand:</td>
  154. <td>&pound;<?php echo "".number_format($fetch->money).""; ?></td>
  155. </td>
  156. </tr>
  157. <tr>
  158. <td style="padding:8px;" align="right">Bank:</td>
  159. <td>&pound;<?php echo "".number_format($fetch->bankamount).""; ?></td>
  160. </tr>
  161. <tr>
  162. <td style="padding:8px;" align="right">Send Money</td>
  163. <td><a href=sendmoney.php>Click Here</a></td>
  164. </tr>
  165. </table>
  166. </td>
  167. </tr>
  168. </table>
  169. </form>
  170. <table width="650" align="center" colspan="4">
  171. <tr>
  172. <td valign="top" colspan="2">
  173. <table class="table" border=0 cellpadding=0 width="350" align="center" cellspacing="0">
  174. <tr><td colspan="3" class="header">Last 10 Sent</td></tr>
  175. <tr><td align="center" colspan="1" class='subhead'>To</td><td align="center" class='subhead'>Amount</td><td align="center" colspan="1" class='subhead'>Date</td></tr>
  176. <?
  177.  
  178. $k=mysql_query("SELECT * FROM `transfers` WHERE `from`='$username' ORDER BY id DESC LIMIT 10");
  179.  
  180. while($p=mysql_fetch_object($k)){
  181.  
  182. echo "<tr>
  183.  
  184. <td class=\"tableborder\" style='padding:10px' align=\"center\"><a href='profile.php?viewuser=$p->to'>$p->to</a></td>
  185.  
  186. <td class=\"tableborder\" style='padding:10px' align=\"center\">£".number_format($p->amount)." $types</td>
  187.  
  188. <td class=\"tableborder\" style='padding:10px' align=\"center\">$p->date</td>
  189.  
  190. </tr>"; } ?></table></td><td valign='top' colspan='2'>
  191.  
  192.  
  193. <table class="table" border=0 cellpadding=0 width="350" align="center" cellspacing="0">
  194. <tr><td colspan="3" class="header">Last 10 Received</td></tr>
  195. <tr><td align="center" class='subhead'>From</td><td align="center" class='subhead'>Amount</td><td align="center" class='subhead'>Date</td></tr>
  196.  
  197. <?
  198.  
  199. $ka=mysql_query("SELECT * FROM `transfers` WHERE `to`='$username' ORDER BY id DESC LIMIT 10");
  200.  
  201. while($pa=mysql_fetch_object($ka)){
  202.  
  203. echo "<tr>
  204.  
  205. <td class=\"tableborder\" style='padding:10px' align=\"center\"><a href='profile.php?viewuser=$pa->from'>$pa->from</a></td>
  206.  
  207. <td class=\"tableborder\" style='padding:10px' align=\"center\">£".number_format($pa->amount)."</td>
  208.  
  209. <td class=\"tableborder\" style='padding:10px' align=\"center\">$pa->date</td>
  210.  
  211. </tr>"; } ?></table></td></tr></table>
  212.  
  213. </body>
Add Comment
Please, Sign In to add comment