Jump to content
MakeWebGames

Recommended Posts

Posted

Re: v1 cash logs

I had the same trouble on my game in the earlier days, i forgot what i done to fix it. Just check that the number of things that are being inserted into the log matches the number of fields in the cashxferlog table. Also make sure the right thing is being inserted.

Posted

Re: v1 cash logs

Well after many attempts i have had no luck. I was wondering if maybe you could take a quick look at it and point me in the right direction ?

Well anyway here it is:

 

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['money'] = abs((int) $_POST['money']);
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((int) $_POST['money'])
{
if($_POST['money'] > $ir['money'])
{
print "Die j00 abuser.";
}
else
{
mysql_query("UPDATE users SET money=money-{$_POST['money']} WHERE userid=$userid",$c);
mysql_query("UPDATE users SET money=money+{$_POST['money']} WHERE userid={$_GET['ID']}",$c);
print "You sent \${$_POST['money']} to ID {$_GET['ID']}.";
event_add($_GET['ID'],"You received \${$_POST['money']} 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 cashxferlogs VALUES('',$userid,{$_GET['userid']},{$_POST['money']},unix_timestamp(), '{$ir['lastip']}', '{$er['lastip']}')",$c);
}
}
else
{
print "<h3> Sending Money</h3>
You are sending money to ID: [b]{$_GET['ID']}[/b].
<form action='sendcash.php?ID={$_GET['ID']}' method='post'>
Amnt: <input type='text' name='money' />

<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=mysql_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",$c) or die(mysql_error()."
"."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=mysql_fetch_array($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>";
Posted

Re: v1 cash logs

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

add

or die(mysql_error()); on the end

so it looks like

mysql_query("INSERT INTO cashxferlogs VALUES('',$userid,{$_GET['userid']},{$_POST['money']},unix_timestamp(), '{$ir['lastip']}', '{$er['lastip']}')",$c) or die(mysql_error());

then post back here with the error it says

Posted

Re: v1 cash logs

Yep and error:

you sent $1 to ID 2.You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1,unix_timestamp(), '86.140.113.220', '86.154.251.230')' at line 1

Posted

Re: v1 cash logs

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

u need ' around each side of the form posts

Posted

Re: v1 cash logs

Things to check

1) Everything is spelt correctly

2) The database table exists

3) There is the same number of fields as the data you are trying to insert.

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

CREATE TABLE `cashxferlogs` (

`cxID` int(11) NOT NULL auto_increment,

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

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

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

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

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

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

PRIMARY KEY (`cxID`)

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

your cashxferlogs shud have a simular structure to that, if not the same

Posted

Re: v1 cash logs

cxID cxFROM cxTO cxAMOUNT cxTIME cxFROMIP cxTOIP cxCONTENT

 

I have this in the table i guess ill take a look tomorrow rather than mess it up now when i'm tired.

Posted

Re: v1 cash logs

content is a message, if u havent got a message set up add this to the query...

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

the above query shud hav u fixed then :)

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...