Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

Have errors in your coding or want something specific added to your game? Check out our paid support here.


This forum is now closed and has moved to a new location! Click here to find out why.

AuthorTopic: Send Crystals/Bank/Cyber/Cash ALL in ONE + security added  (Read 1059 times)

JoshuaDams

  • Active Member
  • **
  • Reputation Power: 129
  • JoshuaDams is working their way up.JoshuaDams is working their way up.JoshuaDams is working their way up.
  • Offline Offline
  • Posts: 240
    • MSN Messenger - immortalthug4ever@hotmail.com
    • View Profile
    • WWW
Send Crystals/Bank/Cyber/Cash ALL in ONE + security added
« on: January 24, 2010, 11:35:03 PM »
Ok, so it always bugged me that there were 4 scripts for something 1 script could do.  not to mention i hate having a "cluttered" public_html root.  So I have started merging all files that can be merged and sticking others in certain function folders I made.

This just took me about an hour or so to do so I figure I'd release it as it's been awhile since I've released anything for free :P


This is Send Bank, Send Cyber, Send Crystals, Send Cash  All in One script. 

Only need to create 1 File and edit one file.

lets get started.

First create a file called         Send.php
Code: [Select]
<?php
/******This Mod Re-Vamped By Immortal Thug***********
*******Please Leave this Notice**********************
*******Free for members of MWG***********************
****************************************************/
require_once("globals.php");

$_GET['ID'] = isset($_GET['ID']) && is_numeric($_GET['ID']) ? abs(@intval($_GET['ID'])) : false;
$_GET['action'] = isset($_GET['action']) && is_string($_GET['action']) ? strtolower(trim($_GET['action'])) : false;
$_POST['points'] = abs(@intval($_POST['points']));


        switch(
$_GET['action'])
{
   case 
"sendbank":
   
sendbank();
   break;

   case 
"sendoff";
   
sendoff();
   break;

   case 
"sendcash";
   
sendcash();
   break;

   case 
"sendpoints";
   
sendpoints();
   break;
}


if (!
in_array($_GET['action'], array('sendbank''sendoff''sendcash''sendpoints'))) 
{
   echo 
"Operation not understood!";
exit;
}


  function 
sendbank()
{
global 
$db,$h,$ir,$userid;


if(!
$_GET['ID'])
{
echo 
"Invalid ID.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}

else if(
$_GET['ID'] == $userid)
{
echo 
"Is there a particular reason you are sending money to yourself?<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}

else
{
$it=$db->query("SELECT `userid`, `bankmoney`, `lastip` FROM users WHERE userid={$_GET['ID']}");
$er=$db->fetch_row($it);

if(
$er['bankmoney']==-|| $ir['bankmoney']==-1)
{
echo 
"Sorry,you or the person you are sending cash to does not have a bank account.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}

if(
$_POST['points'])
{
if(
$_POST['points'] > $ir['bankmoney'])
{
echo 
"You are trying to send more than you have.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}

else
{
$db->query(sprintf("UPDATE `users` SET `bankmoney`=`bankmoney`-%u WHERE `userid`=%d"$_POST['points'], $userid));
$db->query(sprintf("UPDATE `users` SET `bankmoney`=`bankmoney`+%u WHERE `userid`=%d"$_POST['points'], $_GET['ID']));
echo 
"Your Bank Transferred \$".number_format($_POST['points'])."  to ID ".number_format($_GET['ID']).".";
event_add($_GET['ID'],"You received \$".number_format($_POST['points'])." into your bank account from ".stripslashes($ir['username']).".");

$db->query("INSERT INTO bankxferlogs VALUES ('', $userid, {$_GET['ID']}, {$_POST['points']}, unix_timestamp(), '{$ir['lastip']}', '{$er['lastip']}', 'bank')");
}
}
else
{
print 
"<h3>Bank Xfer</h3>
You are sending bank money to ID: <b>{$_GET['ID']}</b>.
<br>You have <b>\$"
.number_format($ir['bankmoney'])."</b> you can send.
<form action='sendbank.php?action=sendbank&ID={$_GET['ID']}' method='post'>
Money: <input type='text' name='points' /><br />
<input type='submit' value='Send' /></form>"
;
}
}
}
$h->endpage();

  function 
sendoff()
{
global 
$db,$ir,$h,$userid;

if(!
$_GET['ID'])
{
echo 
"Invalid ID.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}

else if(
$_GET['ID'] == $userid)
{
echo 
"Is there a particular reason you are sending money to yourself?<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}


else
{
$it=$db->query("SELECT `userid`, `cybermoney`, `lastip` FROM users WHERE userid={$_GET['ID']}");
$er=$db->fetch_row($it);


if(
$er['cybermoney']==-|| $ir['cybermoney']==-1)
{
echo 
"Sorry,you or the person you are sending cash to does not have an off-shore account.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}


if(
$_POST['points'])
{
if(
$_POST['points'] > $ir['cybermoney'])
{
echo 
"You are trying to send more than you have.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}
else
{
$db->query(sprintf("UPDATE `users` SET `cybermoney`=`cybermoney`-%u WHERE `userid`=%d"$_POST['points'], $userid));
$db->query(sprintf("UPDATE `users` SET `cybermoney`=`cybermoney`+%u WHERE `userid`=%d"$_POST['points'], $_GET['ID']));
echo 
"You CyberBank Transferred \$".number_format($_POST['points'])."  to ID ".number_format($_GET['ID']).".";
event_add($_GET['ID'],"You received \${$_POST['points']} into your cyber bank account from ".stripslashes($ir['username']).".");

$db->query("INSERT INTO bankxferlogs VALUES ('', $userid, {$_GET['ID']}, {$_POST['points']}, unix_timestamp(), '{$ir['lastip']}', '{$er['lastip']}', 'cyber')");
}
}
else
{
echo 
"<h3>Off-Shore Xfer</h3>
You are sending off-shore bank money to ID: <b>{$_GET['ID']}</b>.
<br>You have <b>\$"
.number_format($ir['cybermoney'])."</b> you can send.
<form action='sendcyber.php?action=sendoff&ID={$_GET['ID']}' method='post'>
Money: <input type='text' name='points' /><br />
<input type='submit' value='Send' /></form>"
;
}
}
}
$h->endpage();




  function 
sendpoints()
{
  global 
$db$userid$ir;

if(!
$_GET['ID'])
{
echo 
"Invalid ID.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}

else if(
$_GET['ID'] == $userid)
{
echo 
"Is there a particular reason you are sending points to yourself?<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}

else
{
if(
$_POST['points'])
{
if(
$_POST['points'] > $ir['crystals'])
{
echo 
"You are trying to send more than you have.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}

else
{
$db->query(sprintf("UPDATE `users` SET `crystals`=`crystals`-%u WHERE `userid`=%d"$_POST['points'], $userid));
$db->query(sprintf("UPDATE `users` SET `crystals`=`crystals`+%u WHERE `userid`=%d"$_POST['points'], $_GET['ID']));
echo 
"You sent ".number_format($_POST['points'])." points to ID ".number_format($_GET['ID']).".";
event_add($_GET['ID'],"You received {$_POST['points']} points from ".stripslashes($ir['username']).".");

$it=$db->query("SELECT `lastip` FROM `users` WHERE `userid`={$_GET['ID']}");
$er=$db->fetch_row($it);
$db->query("INSERT INTO crystalxferlogs VALUES ('', $userid, {$_GET['ID']}, {$_POST['points']}, unix_timestamp(), '{$ir['lastip']}', '{$er['lastip']}')");
}
}
else
{
echo 
"<h3> Sending Points</h3>
You are sending points to ID: <b>{$_GET['ID']}</b>.
<br>You have <b>"
.number_format($ir['points'])."</b> points you can send.
<form action='send.php?action=sendpoints&ID={$_GET['ID']}' method='post'>
Points: <input type='text' name='points' /><br />
<input type='submit' value='Send' /></form>"
;
print 
"<h3>Latest 5 Transfers</h3>
<table width=75% border=2> <tr style='background:gray'>  <th>Time</th> <th>User From</th> <th>User To</th> <th>Amount</th> </tr>"
;

$q=$db->query("SELECT cx.*,u1.username as sender, u2.username as sent FROM crystalxferlogs cx LEFT JOIN users u1 ON cx.cxFROM=u1.userid LEFT JOIN users u2 ON cx.cxTO=u2.userid WHERE cx.cxFROM=$userid ORDER BY cx.cxTIME DESC LIMIT 5");
while(
$r=$db->fetch_row($q)){
if(
$r['cxFROMIP'] == $r['cxTOIP']) { $m="<span style='color:red;font-weight:800'>MULTI</span>"; } else { $m=""; }
print 
"<tr> <td>" date("F j, Y, g:i:s a",$r['cxTIME']) . "</td><td>{$r['sender']} [{$r['cxFROM']}] </td><td>{$r['sent']} [{$r['cxTO']}] </td> <td> {$r['cxAMOUNT']} points</td> </tr>";
}
print 
"</table>";
}
}
}
$h->endpage();

  function 
sendcash()
{
  global 
$db$ir$userid$h;


$_POST['cash'] = abs(@intval($_POST['cash']));

if(!
$_GET['ID'])
{
echo 
"Invalid ID.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}

else if(
$_GET['ID'] == $userid)
{
echo 
"Is there a particular reason you are sending cash to yourself?<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}

else
{
if(
$_POST['cash'])
{
if(
$_POST['cash'] > $ir['cash'])
{
echo 
"You are trying to send more than you have.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}
else
{
$db->query(sprintf("UPDATE `users` SET `money`=`money`-%u WHERE `userid`=%d"$_POST['cash'], $userid));
$db->query(sprintf("UPDATE `users` SET `money`=`money`+%u WHERE `userid`=%d"$_POST['cash'], $_GET['ID']));
echo 
"You sent \$".number_format($_POST['cash'])." to ID ".number_format($_GET['ID']).".";
event_add($_GET['ID'],"You received \${$_POST['cash']} from {$ir['username']}.",$c);

$it=$db->query("SELECT `lastip` FROM `users` WHERE `userid`={$_GET['ID']}");
$er=$db->fetch_row($it);
$db->query("INSERT INTO cashxferlogs VALUES ('', $userid, {$_GET['ID']}, {$_POST['cash']}, unix_timestamp(), '{$ir['lastip']}', '{$er['lastip']}')");
}
}
else
{
print 
"<h3> Sending Money</h3>
You are sending money to ID: <b>{$_GET['ID']}</b>.
<br>You have <b>\$"
.number_format($ir['money'])."</b> you can send.
<form action='send.php?action=sendcash&ID={$_GET['ID']}' method='post'>
Amnt: <input type='text' name='cash' /><br />
<input type='submit' value='Send' /></form>"
;
print 
"<h3>Latest 5 Transfers</h3>
<table width=75% border=2> <tr style='background:gray'>  <th>Time</th> <th>User From</th> <th>User To</th> <th>Amount</th> </tr>"
;
$q=$db->query("SELECT cx.*,u1.username as sender, u2.username as sent FROM cashxferlogs cx LEFT JOIN users u1 ON cx.cxFROM=u1.userid LEFT JOIN users u2 ON cx.cxTO=u2.userid WHERE cx.cxFROM=$userid ORDER BY cx.cxTIME DESC LIMIT 5");
while(
$r=$db->fetch_row($q))
{
if(
$r['cxFROMIP'] == $r['cxTOIP']) { $m="<span style='color:red;font-weight:800'>MULTI</span>"; } else { $m=""; }
print 
"<tr> <td>" date("F j, Y, g:i:s a",$r['cxTIME']) . "</td><td>{$r['sender']} [{$r['cxFROM']}] </td><td>{$r['sent']} [{$r['cxTO']}] </td> <td> \${$r['cxAMOUNT']}</td> </tr>";
}
print 
"</table>";
}
}
}
$h->endpage();


?>

Next open up viewuser.php

Find sendbank/sendcash/sendcrys/sendcyber.php

Replace those links with these


Code: [Select]
<a href="send.php?action=sendcash&ID='.$r['userid'].'">Send Cash</a>
<a href="send.php?action=sendpoints&ID='.$r['userid'].'">Send Points</a>                                           
<a href="send.php?action=sendbank&ID='.$r['userid'].'">Bank Xfer</a>
<a href="send.php?action=sendoff&ID='.$r['userid'].'">SendCyber</a>


Bit of security added to it and just neatened up a bit.  Tested and fully works on my re-coded engine, only thing that has been altered from my verison was the table names

Danny696

  • Senior Member
  • ****
  • Reputation Power: 317
  • Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.
  • Offline Offline
  • Posts: 540
    • View Profile
    • WWW
Re: Send Crystals/Bank/Cyber/Cash ALL in ONE + security added
« Reply #1 on: January 25, 2010, 10:11:43 AM »
ever thought about doing: $data = array_merge($_GET, $_POST); i use it sometimes, saves me remembering if i get'ed it od post'ed it
Logged
Project Choosen - 10%
Daniel - Hanson . Com

HauntedDawg

  • Basic Member
  • *
  • Reputation Power: 12
  • HauntedDawg has no influence.
  • Offline Offline
  • Posts: 25
    • View Profile
Re: Send Crystals/Bank/Cyber/Cash ALL in ONE + security added
« Reply #2 on: January 26, 2010, 06:14:18 AM »
ever thought about doing: $data = array_merge($_GET, $_POST); i use it sometimes, saves me remembering if i get'ed it od post'ed it

Ever thought about using $data = $_REQUEST; ? :P
Logged

Danny696

  • Senior Member
  • ****
  • Reputation Power: 317
  • Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.
  • Offline Offline
  • Posts: 540
    • View Profile
    • WWW
Re: Send Crystals/Bank/Cyber/Cash ALL in ONE + security added
« Reply #3 on: January 26, 2010, 11:36:07 AM »
doesnt $_REQUEST include other super globals, or just post+get??
Logged
Project Choosen - 10%
Daniel - Hanson . Com

Danny696

  • Senior Member
  • ****
  • Reputation Power: 317
  • Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.
  • Offline Offline
  • Posts: 540
    • View Profile
    • WWW
Re: Send Crystals/Bank/Cyber/Cash ALL in ONE + security added
« Reply #4 on: January 30, 2010, 09:05:22 AM »
Quote from: PHP.net
Cookie values also exist in $_REQUEST.
Logged
Project Choosen - 10%
Daniel - Hanson . Com

Jordan

  • Active Member
  • **
  • Reputation Power: 55
  • Jordan has no influence.
  • Offline Offline
  • Posts: 102
  • Website Developer for hire;
    • MSN Messenger - Pudda2008@hotmail.co.uk
    • View Profile
    • WWW
    • Email
Re: Send Crystals/Bank/Cyber/Cash ALL in ONE + security added
« Reply #5 on: February 03, 2010, 01:57:52 PM »
Okay. I installed this and noticed a bug. I made it work (Should be anyway) I did test it and it looked fine however I could have missed a spot.

Code: [Select]
<?php
/*
MCCode V2 - Send.php
Coded by Immortal;
-- FREE TO ALL MEMBERS OF THE FORUM --
*/
require_once("globals.php");
$_GET['ID'] = isset($_GET['ID']) && is_numeric($_GET['ID']) ? abs(@intval($_GET['ID'])) : false;
$_GET['action'] = isset($_GET['action']) && is_string($_GET['action']) ? strtolower(trim($_GET['action'])) : false;
$_POST['points'] = abs(@intval($_POST['points']));
        switch(
$_GET['action'])
{
   case 
'sendbank':
   
sendbank();
   break;
   case 
'sendoff';
   
sendoff();
   break;
   case 
'sendcash';
   
sendcash();
   break;
   case 
'sendpoints';
   
sendpoints();
   break;
}
if (!
in_array($_GET['action'], array('sendbank''sendoff''sendcash''sendpoints')))
{
   echo 
"Operation not understood!";
exit;
}
  function 
sendbank()
{
global 
$db,$h,$ir,$userid;
if(!
$_GET['ID'])
{
echo 
"Invalid ID.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}
else if(
$_GET['ID'] == $userid)
{
echo 
"Is there a particular reason you are sending money to yourself?<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}
else
{
$it=$db->query("SELECT `userid`, `bankmoney`, `lastip` FROM users WHERE userid={$_GET['ID']}");
$er=$db->fetch_row($it);
if(
$er['bankmoney']==-|| $ir['bankmoney']==-1)
{
echo 
"Sorry,you or the person you are sending cash to does not have a bank account.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}
if(
$_POST['points'])
{
if(
$_POST['points'] > $ir['bankmoney'])
{
echo 
"You are trying to send more than you have.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}
else
{
$db->query(sprintf("UPDATE `users` SET `bankmoney`=`bankmoney`-%u WHERE `userid`=%d"$_POST['points'], $userid));
$db->query(sprintf("UPDATE `users` SET `bankmoney`=`bankmoney`+%u WHERE `userid`=%d"$_POST['points'], $_GET['ID']));
echo 
"Your Bank Transferred \$".number_format($_POST['points'])."  to ID ".number_format($_GET['ID']).".";
event_add($_GET['ID'],"You received \$".number_format($_POST['points'])." into your bank account from ".stripslashes($ir['username']).".");
$db->query("INSERT INTO bankxferlogs VALUES ('', $userid, {$_GET['ID']}, {$_POST['points']}, unix_timestamp(), '{$ir['lastip']}', '{$er['lastip']}', 'bank')");
}
}
else
{
print 
"<h3>Bank Xfer</h3>
You are sending bank money to ID: <b>{$_GET['ID']}</b>.
<br>You have <b>\$"
.number_format($ir['bankmoney'])."</b> you can send.
<form action='sendbank.php?action=sendbank&ID={$_GET['ID']}' method='post'>
Money: <input type='text' name='points' /><br />
<input type='submit' value='Send' /></form>"
;
}
}
}
$h->endpage();
  function 
sendoff()
{
global 
$db,$ir,$h,$userid;
if(!
$_GET['ID'])
{
echo 
"Invalid ID.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}
else if(
$_GET['ID'] == $userid)
{
echo 
"Is there a particular reason you are sending money to yourself?<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}
else
{
$it=$db->query("SELECT `userid`, `cybermoney`, `lastip` FROM users WHERE userid={$_GET['ID']}");
$er=$db->fetch_row($it);
if(
$er['cybermoney']==-|| $ir['cybermoney']==-1)
{
echo 
"Sorry,you or the person you are sending cash to does not have an off-shore account.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}
if(
$_POST['points'])
{
if(
$_POST['points'] > $ir['cybermoney'])
{
echo 
"You are trying to send more than you have.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}
else
{
$db->query(sprintf("UPDATE `users` SET `cybermoney`=`cybermoney`-%u WHERE `userid`=%d"$_POST['points'], $userid));
$db->query(sprintf("UPDATE `users` SET `cybermoney`=`cybermoney`+%u WHERE `userid`=%d"$_POST['points'], $_GET['ID']));
echo 
"You CyberBank Transferred \$".number_format($_POST['points'])."  to ID ".number_format($_GET['ID']).".";
event_add($_GET['ID'],"You received \${$_POST['points']} into your cyber bank account from ".stripslashes($ir['username']).".");
$db->query("INSERT INTO bankxferlogs VALUES ('', $userid, {$_GET['ID']}, {$_POST['points']}, unix_timestamp(), '{$ir['lastip']}', '{$er['lastip']}', 'cyber')");
}
}
else
{
echo 
"<h3>Off-Shore Xfer</h3>
You are sending off-shore bank money to ID: <b>{$_GET['ID']}</b>.
<br>You have <b>\$"
.number_format($ir['cybermoney'])."</b> you can send.
<form action='sendcyber.php?action=sendoff&ID={$_GET['ID']}' method='post'>
Money: <input type='text' name='points' /><br />
<input type='submit' value='Send' /></form>"
;
}
}
}
$h->endpage();
  function 
sendpoints()
{
  global 
$db$userid$ir;
if(!
$_GET['ID'])
{
echo 
"Invalid ID.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}
else if(
$_GET['ID'] == $userid)
{
echo 
"Is there a particular reason you are sending points to yourself?<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}
else
{
if(
$_POST['points'])
{
if(
$_POST['points'] > $ir['crystals'])
{
echo 
"You are trying to send more than you have.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}
else
{
$db->query(sprintf("UPDATE `users` SET `crystals`=`crystals`-%u WHERE `userid`=%d"$_POST['points'], $userid));
$db->query(sprintf("UPDATE `users` SET `crystals`=`crystals`+%u WHERE `userid`=%d"$_POST['points'], $_GET['ID']));
echo 
"You sent ".number_format($_POST['points'])." points to ID ".number_format($_GET['ID']).".";
event_add($_GET['ID'],"You received {$_POST['points']} points from ".stripslashes($ir['username']).".");
$it=$db->query("SELECT `lastip` FROM `users` WHERE `userid`={$_GET['ID']}");
$er=$db->fetch_row($it);
$db->query("INSERT INTO crystalxferlogs VALUES ('', $userid, {$_GET['ID']}, {$_POST['points']}, unix_timestamp(), '{$ir['lastip']}', '{$er['lastip']}')");
}
}
else
{
echo 
"<h3> Sending Points</h3>
You are sending points to ID: <b>{$_GET['ID']}</b>.
<br>You have <b>"
.number_format($ir['points'])."</b> points you can send.
<form action='send.php?action=sendpoints&ID={$_GET['ID']}' method='post'>
Points: <input type='text' name='points' /><br />
<input type='submit' value='Send' /></form>"
;
print 
"<h3>Latest 5 Transfers</h3>
<table width=75% border=2> <tr style='background:gray'>  <th>Time</th> <th>User From</th> <th>User To</th> <th>Amount</th> </tr>"
;
$q=$db->query("SELECT cx.*,u1.username as sender, u2.username as sent FROM crystalxferlogs cx LEFT JOIN users u1 ON cx.cxFROM=u1.userid LEFT JOIN users u2 ON cx.cxTO=u2.userid WHERE cx.cxFROM=$userid ORDER BY cx.cxTIME DESC LIMIT 5");
while(
$r=$db->fetch_row($q)){
if(
$r['cxFROMIP'] == $r['cxTOIP']) { $m="<span style='color:red;font-weight:800'>MULTI</span>"; } else { $m=""; }
print 
"<tr> <td>" date("F j, Y, g:i:s a",$r['cxTIME']) . "</td><td>{$r['sender']} [{$r['cxFROM']}] </td><td>{$r['sent']} [{$r['cxTO']}] </td> <td> {$r['cxAMOUNT']} points</td> </tr>";
}
print 
"</table>";
}
}
}
$h->endpage();
  function 
sendcash()
{
  global 
$db$ir$userid$h;
$_POST['cash'] = abs(@intval($_POST['cash']));
if(!
$_GET['ID'])
{
echo 
"Invalid ID.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}
else if(
$_GET['ID'] == $userid)
{
echo 
"Is there a particular reason you are sending cash to yourself?<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}
else
{
if(
$_POST['cash'])
{
if(
$_POST['cash'] > $ir['cash'])
{
echo 
"You are trying to send more than you have.<br /><a href='index.php'>Back</a>";
$h->endpage();
exit;
}
else
{
$db->query(sprintf("UPDATE `users` SET `money`=`money`-%u WHERE `userid`=%d"$_POST['cash'], $userid));
$db->query(sprintf("UPDATE `users` SET `money`=`money`+%u WHERE `userid`=%d"$_POST['cash'], $_GET['ID']));
echo 
"You sent \$".number_format($_POST['cash'])." to ID ".number_format($_GET['ID']).".";
event_add($_GET['ID'],"You received \${$_POST['cash']} from {$ir['username']}.",$c);
$it=$db->query("SELECT `lastip` FROM `users` WHERE `userid`={$_GET['ID']}");
$er=$db->fetch_row($it);
$db->query("INSERT INTO cashxferlogs VALUES ('', $userid, {$_GET['ID']}, {$_POST['cash']}, unix_timestamp(), '{$ir['lastip']}', '{$er['lastip']}')");
}
}
else
{
print 
"<h3> Sending Money</h3>
You are sending money to ID: <b>{$_GET['ID']}</b>.
<br>You have <b>\$"
.number_format($ir['money'])."</b> you can send.
<form action='send.php?action=sendcash&ID={$_GET['ID']}' method='post'>
Amnt: <input type='text' name='cash' /><br />
<input type='submit' value='Send' /></form>"
;
print 
"<h3>Latest 5 Transfers</h3>
<table width=75% border=2> <tr style='background:gray'>  <th>Time</th> <th>User From</th> <th>User To</th> <th>Amount</th> </tr>"
;
$q=$db->query("SELECT cx.*,u1.username as sender, u2.username as sent FROM cashxferlogs cx LEFT JOIN users u1 ON cx.cxFROM=u1.userid LEFT JOIN users u2 ON cx.cxTO=u2.userid WHERE cx.cxFROM=$userid ORDER BY cx.cxTIME DESC LIMIT 5");
while(
$r=$db->fetch_row($q))
{
if(
$r['cxFROMIP'] == $r['cxTOIP']) { $m="<span style='color:red;font-weight:800'>MULTI</span>"; } else { $m=""; }
print 
"<tr> <td>" date("F j, Y, g:i:s a",$r['cxTIME']) . "</td><td>{$r['sender']} [{$r['cxFROM']}] </td><td>{$r['sent']} [{$r['cxTO']}] </td> <td> \${$r['cxAMOUNT']}</td> </tr>";
}
print 
"</table>";
}
}
}
$h->endpage();
?>

Should work. If not comment here and I'll re-try
Logged
Contact me
MakeWebGames.com

Drizzah

  • Basic Member
  • *
  • Reputation Power: 4
  • Drizzah has no influence.
  • Offline Offline
  • Posts: 8
    • View Profile
Re: Send Crystals/Bank/Cyber/Cash ALL in ONE + security added
« Reply #6 on: April 05, 2010, 12:18:53 AM »
The only thing I notice when testing this out is that instead of having the footer of the page show once. It is making it show four times. I tried the first code displayed here and also the supposed fixed one below it.
Logged
Good Info and Help with Securing
Strip HTML Tags - PHP Filtering

JoshuaDams

  • Active Member
  • **
  • Reputation Power: 129
  • JoshuaDams is working their way up.JoshuaDams is working their way up.JoshuaDams is working their way up.
  • Offline Offline
  • Posts: 240
    • MSN Messenger - immortalthug4ever@hotmail.com
    • View Profile
    • WWW
Re: Send Crystals/Bank/Cyber/Cash ALL in ONE + security added
« Reply #7 on: April 05, 2010, 03:01:13 PM »
$h->endpage();

Put at the end of each function and that should clear that up.
 


This forum is now closed and has moved to a new location! Click here to find out why.