L
L
lompas232018-03-24 23:51:41
PHP
lompas23, 2018-03-24 23:51:41

How to solve the problem with cron?

PHP Warning: include(/inc/db-conf.php): failed to open stream: No such file or directory in /home/admin/web/throwthedice.net/public_html/content/cron/check_deposits.php on line 11
PHP Warning: include(): Failed opening '/inc/db-conf.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/admin/web/throwthedice .net/public_html/content/cron/check_deposits.php on line 11
PHP Warning: include(/inc/wallet_driver.php): failed to open stream: No such file or directory in /home/admin/web/throwthedice.net/ public_html/content/cron/check_deposits.php on line 12
PHP Warning: include(): Failed opening '/inc/wallet_driver.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear ') in /home/admin/web/throwthedice.net/public_html/content/cron/check_deposits.php line 12
PHP Fatal error: Class 'jsonRPCClient' not found in /home/admin/web/throwthedice.net/public_html/content/cron/check_deposits.php on line 13
Cron file itself

<?php
/*
 *  © Lompas
 * Lompas
 *  Please do not copy or redistribute.
 *  More licences we sell, more products we develop in the future.  
*/

// 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);
      if ($delExed==true) {
        if (mysql_num_rows(mysql_query("SELECT `id` FROM `transactions` WHERE `txid`='$dp[txid]' AND `txid`!='[unknown]' LIMIT 1"))!=0) continue;
        mysql_query("UPDATE `players` SET `balance`=TRUNCATE(ROUND((`balance`+$received),9),8) 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");

?>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Skobkin, 2018-03-24
@skobkin

include '/inc/db-conf.php';
include '/inc/wallet_driver.php';

The slash at the beginning of the path denotes the root of the file system, in case you're not in the know. The text of the errors hints at this very thickly:
No such file or directory

P
pantsarny, 2018-03-25
@pantsarny

__DIR__ add at the beginning of the paths, it will be repelled from the script folder.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question