Jump to content
MakeWebGames

bank to bank xfer


nheimberg

Recommended Posts

Re: bank to bank xfer

ok, maybe I will get a reply if I post the code. Like I said, this just a modified send cash, so I am not claiming that I wrote it.

<?php

session_start();

require "global_func.php";

if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }

$userid=$_SESSION['userid'];

require "header.php";

$h = new headers;

$h->startheaders();

include "mysql.php";

global $c;

$is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error());

$ir=mysql_fetch_array($is);

check_level();

$fm=money_formatter($ir['money']);

$cm=money_formatter($ir['crystals'],'');

$lv=date('F j, Y, g:i a',$ir['laston']);

$h->userdata($ir,$lv,$fm,$cm);

$h->menuarea();

$_GET['ID'] = abs((int) $_GET['ID']);

$_POST['bankmoney'] = abs((float) $_POST['bankmoney']);

if($ir['donatordays']>=1){

if(!((int)$_GET['ID']))

{

print "Invalid User ID";

}

else if($_GET['ID'] == $userid)

{

print "Haha, what does sending money to yourself do anyway?";

}

else

{

if((float) $_POST['bankmoney'])

{

if($_POST['bankmoney'] > $ir['bankmoney'])

{

print "MOTHER OF HELL! DON'T SEND money YOU DON'T DAMN WELL HAVE!!!";

}

else

{

mysql_query("UPDATE users SET bankmoney=bankmoney-{$_POST['bankmoney']} WHERE userid=$userid",$c);

mysql_query("UPDATE users SET bankmoney=bankmoney+{$_POST['bankmoney']} WHERE userid={$_GET['ID']}",$c);

print "You sent \${$_POST['bankmoney']} to ID {$_GET['ID']}.";

event_add($_GET['ID'],"You were transferred \${$_POST['bankmoney']} from {$ir['username']}.",$c);

$it=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid={$_GET['ID']}",$c) or die(mysql_error());

$er=mysql_fetch_array($it);

mysql_query("INSERT INTO bankxferlogs VALUES ('', $userid, {$_GET['ID']}, {$_POST['bankmoney']}, unix_timestamp(), '{$ir['lastip']}', '{$er['lastip']}')",$c);

}

}

else

{

print "<h3> Transferring Money</h3>

You are transferring money to ID: {$_GET['ID']}.

<form action='bankxfer.php?ID={$_GET['ID']}' method='post'>

Amnt: <input type='text' name='bankmoney' />

<input type='submit' value='Send' /></form>";

print "<h3>Latest 5 Transfers</h3>

<table width=75% border=2> <tr style='background:gray'> <th><font color=black>Time</font></th> <th><font color=black>User From</font></th> <th><font color=black>User To</font></th> <th><font color=black>Amount</font></th> </tr>";

$q=mysql_query("SELECT bx.*,u1.username as sender, u2.username as sent FROM bankxferlogs bx LEFT JOIN users u1 ON bx.bxFROM=u1.userid LEFT JOIN users u2 ON bx.bxTO=u2.userid WHERE bx.bxFROM=$userid ORDER BY bx.bxTIME DESC LIMIT 5",$c) or die(mysql_error()."

"."SELECT bx.*,u1.username as sender, u2.username as sent FROM bankxferlogs bx LEFT JOIN users u1 ON bx.bxFROM=u1.userid LEFT JOIN users u2 ON bx.bxTO=u2.userid WHERE bx.bxFROM=$userid ORDER BY bx.bxTIME DESC LIMIT 5");

while($r=mysql_fetch_array($q))

{

if($r['bxFROMIP'] == $r['bxTOIP']) { $m="<span style='color:red;font-weight:800'>MULTI</span>"; } else { $m=""; }

print "<tr> <td>" . date("F j, Y, g:i:s a",$r['bxTIME']) . "</td><td>{$r['sender']} [{$r['bxFROM']}] </td><td>{$r['sent']} [{$r['bxTO']}] </td> <td> \${$r['bxAMOUNT']}</td> </tr>";

}

print "</table>";

}

$h->endpage();

}

}

else{

print"Donators Only function.";

$h->endpage();

}

?>

and the sql table that I am using is :

CREATE TABLE `bankxferlogs` (

`bxID` int(11) NOT NULL auto_increment,

`bxFROM` int(11) NOT NULL default '0',

`bxTO` int(11) NOT NULL default '0',

`bxAMOUNT` bigint(20) NOT NULL default '0',

`bxTIME` int(11) NOT NULL default '0',

`bxFROMIP` varchar(15) NOT NULL default '127.0.0.1',

`bxTOIP` varchar(15) NOT NULL default '127.0.0.1',

`bxCONTENT` longtext NOT NULL,

PRIMARY KEY (`bxID`)

) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2091 ;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...