Jump to content

JoshTutt

New Members
  • Posts

    3
  • Joined

  • Last visited

JoshTutt's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Okay so this is the problem I have been suffering with for the past 2 weeks: Notice: Undefined index: category in C:\xampp\htdocs\content\cron\check_deposits.php on line 18 $deposits=mysql_query("SELECT * FROM `deposits`"); while ($dp=mysql_fetch_array($deposits)) { $received=0; $txid=''; $txs=$wallet->listtransactions('',2000); $txss=array_reverse($txs, true); foreach ($txss as $tx) { if ($tx['category']!='receive') continue; if ($tx['confirmations']<1) continue; if ($tx['address']!=$dp['address']) continue; $received=$tx['amount']; $txid=$tx['txid']; break; } The output array using: <? echo('<pre>'.print_r($txs,1).'</pre>'); ?> is: Array ( [lastblock] => 00000000000000000e453b7ab34fa8209f838e56f1205ac289d9e071b79351d0 [transactions] => Array ( [0] => Array ( [amount] => 8.131E-5 [blockhash] => 00000000000000001bb164ff85fe78f5f54bde00d4462d8bef19f96421334673 [address] => 1HJqsE5CoPnVSPvQVKU4oPCVku47eu39kr [fee] => 0.0001 [txid] => 75c9ad12fdbe957ad3c98edfc02fa212dde0ca8e941373c82df5c545599936ce [label] => [time] => 1415703105 [category] => receive [confirmations] => -381 [blockindex] => 490989 [account] => ) [1] => Array ( [amount] => 1.5E-5 [blockhash] => 000000000000000001fd1bc6e7add41bbca9e4d77a43ccd430a144c70c08d985 [address] => 16GttENVpxmq1oZjnP5TkLWDrwi3HBa1iu [fee] => 0.0001 [txid] => 29420d9a380df6546920a7cd5da5f9750219ef8e1102f2194547a38323e6dfd7 [label] => [time] => 1415453123 [category] => receive [confirmations] => -802 [blockindex] => 489453 [account] => ) So if I use: <? $list = $tx['0']; echo('<pre>'.print_r($list,1).'</pre>'); ?> I get the output: Array. So what I have come to is that because they are listed [0], [1] is causing the problem. How should I go about extracting the value of what is in the array [0] [1] and so on?
  2. This is the output I get when I use: echo('<pre>'.print_r($txs,1).'</pre>');. Output: Array ( [transactions] => Array ( [0] => Array ( [amount] => 8.131E-5 [blockhash] => 00000000000000001bb164ff85fe78f5f54bde00d4462d8bef19f96421334673 [address] => 1HJqsE5CoPnVSPvQVKU4oPCVku47eu39kr [fee] => 0.0001 [txid] => 75c9ad12fdbe957ad3c98edfc02fa212dde0ca8e941373c82df5c545599936ce [label] => [time] => 1415703105 [category] => receive [confirmations] => -212 [blockindex] => 490989 [account] => ) [1] => Array ( [amount] => 1.5E-5 [blockhash] => 000000000000000001fd1bc6e7add41bbca9e4d77a43ccd430a144c70c08d985 [address] => 16GttENVpxmq1oZjnP5TkLWDrwi3HBa1iu [fee] => 0.0001 [txid] => 29420d9a380df6546920a7cd5da5f9750219ef8e1102f2194547a38323e6dfd7 [label] => [time] => 1415453123 [category] => receive [confirmations] => -633 [blockindex] => 489453 [account] => ) [2] => Array ( [amount] => -5.7E-5 [blockhash] => 000000000000000001fd1bc6e7add41bbca9e4d77a43ccd430a144c70c08d985 [address] => 13ViX8aGoMMnA3JXnP8vL4P3RLFWPVP4Zw [fee] => 0.0001 [txid] => 29420d9a380df6546920a7cd5da5f9750219ef8e1102f2194547a38323e6dfd7 [label] => [time] => 1415453123 [category] => send [confirmations] => -633 [blockindex] => 489453 [account] => ) [3] => Array ( [amount] => -6.0E-5 [blockhash] => 000000000000000001fd1bc6e7add41bbca9e4d77a43ccd430a144c70c08d985 [address] => 16GttENVpxmq1oZjnP5TkLWDrwi3HBa1iu [fee] => 0.0001 [txid] => 29420d9a380df6546920a7cd5da5f9750219ef8e1102f2194547a38323e6dfd7 [label] => [time] => 1415453123 [category] => send [confirmations] => -633 [blockindex] => 489453 [account] => ) [4] => Array ( [amount] => -5.5E-5 [blockhash] => 000000000000000001fd1bc6e7add41bbca9e4d77a43ccd430a144c70c08d985 [address] => 14DxVjNkuEWruF9bQpY9xym7Vs4GuoYe13 [fee] => 0.0001 [txid] => 29420d9a380df6546920a7cd5da5f9750219ef8e1102f2194547a38323e6dfd7 [label] => [time] => 1415453123 [category] => send [confirmations] => -633 [blockindex] => 489453 [account] => ) [5] => Array ( [amount] => 5.5E-5 [blockhash] => 00000000000000000cfa9ee58b91b27629dd8607ff838cb1880e871745f6fda7 [address] => 14DxVjNkuEWruF9bQpY9xym7Vs4GuoYe13 [fee] => 0.0001 [txid] => 03fcddb0bbd3adf5dae20f6f67840e3b9acf8305bd446e31a2690e3ae7d71def [label] => [time] => 1415431105 [category] => receive [confirmations] => -674 [blockindex] => 486258 [account] => ) [6] => Array ( [amount] => 6.0E-5 [blockhash] => 000000000000000010b72e16dc753ccd2d9cfc5d03846748685d9374abd03c89 [address] => 16GttENVpxmq1oZjnP5TkLWDrwi3HBa1iu [fee] => 0.0001 [txid] => 296dea431d71e23a4015f2a9e2e91abd9a500fbbef266de5de8d5020af6dd566 [label] => [time] => 1415246423 [category] => receive [confirmations] => -1003 [blockindex] => 489250 [account] => ) [7] => Array ( [amount] => 5.7E-5 [blockhash] => 0000000000000000001436c6d5f9118a6a2f00087629dbf6fac3e5cd9672f0b6 [address] => 13ViX8aGoMMnA3JXnP8vL4P3RLFWPVP4Zw [fee] => 0.0001 [txid] => b4c517c2b82468f8484a8bac47aeb88d7386c3d43acfe8b592cbf367cb9c0d3c [label] => [time] => 1415177200 [category] => receive [confirmations] => -1092 [blockindex] => 486057 [account] => ) ) [lastblock] => 00000000000000000db5d7c653732396fa7345bb4f97cbab73720e29d9c0b7bd )
  3. Notice: Undefined index: category in C:\xampp\htdocs\content\cron\check_deposits.php on line 18 Notice: Undefined index: confirmations in C:\xampp\htdocs\content\cron\check_deposits.php on line 19 Notice: Undefined index: address in C:\xampp\htdocs\content\cron\check_deposits.php on line 20 Notice: Undefined index: amount in C:\xampp\htdocs\content\cron\check_deposits.php on line 21 Notice: Undefined index: txid in C:\xampp\htdocs\content\cron\check_deposits.php on line 22 <?php // CRON must be running every minute! $included=true; include '../../inc/db-conf.php'; include '../../inc/wallet_driver.php'; $wallet=new jsonRPCClient($driver_login); include '../../inc/functions.php'; $deposits=mysql_query("SELECT * FROM `deposits`"); while ($dp=mysql_fetch_array($deposits)) { $received=0; $txid=''; $txs=$wallet->listtransactions('',2000); $txs=array_reverse($txs); foreach ($txs as $tx) { if ($tx['category']!='receive') continue; if ($tx['confirmations']<1) continue; if ($tx['address']!=$dp['address']) continue; $received=$tx['amount']; $txid=$tx['txid']; break; } if ($received<0.00000001) continue; $txid=($txid=='')?'[unknown]':$txid; if ($dp['received']==1) { mysql_query("UPDATE `deposits` SET `confirmations`=`confirmations`+1 WHERE `id`=$dp[id] LIMIT 1"); if (++$dp['confirmations']>=6) { $delExed=false; do { $delExed=mysql_query("DELETE FROM `deposits` WHERE `id`=$dp[id] LIMIT 1"); } while ($delExed==false); mysql_query("UPDATE `players` SET `balance`=TRUNCATE(ROUND((`balance`+$received),9), WHERE `id`=$dp[player_id] LIMIT 1"); mysql_query("INSERT INTO `transactions` (`player_id`,`amount`,`txid`) VALUES ($dp[player_id],$dp[amount],'$dp[txid]')"); } continue; } mysql_query("UPDATE `deposits` SET `received`=1,`amount`=$received,`txid`='$txid' WHERE `id`=$dp[id] LIMIT 1"); } mysql_query("DELETE FROM `deposits` WHERE `time_generated`<NOW()-INTERVAL 7 DAY"); ?> For some reason I am getting all these errors, and I cannot figure out why? Is there anyone out there that thinks they know what is wrong with it? check_deposits.php
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.