Author Topic: bank Interest and Cron job  (Read 7214 times)

Offline Licorne

bank Interest and Cron job
« on: March 22, 2007, 08:38:44 am »
I enabled the bank interest and set up the cron job exactly as the instructions said. Then I noticed that the interest wasn't working. So I looked at the interest_log.htm file vi my browser and this is what I got:

Quote
Fatal error: Cannot redeclare ssi_recentkarma() (previously declared in /home/winglica/public_html/forum/SSI.php:1644) in /home/winglica/public_html/forum/SSI.php on line 1799

How do I fix this? Thank you.

Offline feeble

Re: bank Interest and Cron job
« Reply #1 on: March 22, 2007, 12:20:03 pm »
can you post the php code in the dointerest file that you have a cron job set to please

Offline Licorne

Re: bank Interest and Cron job
« Reply #2 on: March 22, 2007, 12:32:01 pm »
<?php
/**********************************************\
| SMFSHOP (Shop MOD for Simple Machines Forum) |
|         (c) 2005 DanSoft Australia           |
|      http://www.dansoftaustralia.com/        |
\**********************************************/

//File: dointerest.php
//      The file to add interest to member's bank

//VERSION: 1.31 (Build 7)
//DATE: 10th December 2005
// $Id: dointerest.php 4 2006-07-08 10:09:08Z daniel15 $

if(!isset($_SERVER["HTTP_HOST"])) {

   include("../../SSI.php");
   
   $interest_rate = $modSettings['shopInterest'] / 100;
   db_query("UPDATE {$db_prefix}members
           SET moneyBank = moneyBank + (moneyBank*{$interest_rate})", __FILE__, __LINE__);
   
   echo "Interest added at ".date("d/m/Y h:i:s A");
}
?>

Offline polis

Re: bank Interest and Cron job
« Reply #3 on: March 22, 2007, 12:58:10 pm »
maybe you should give permission 777 to interest_log.htm, but I'm not quite sure.

Offline Licorne

Re: bank Interest and Cron job
« Reply #4 on: March 23, 2007, 12:05:55 pm »
Thanks, I got it working now. It was the ssi file that was causing the trouble.

Offline Daniel15

Re: bank Interest and Cron job
« Reply #5 on: March 24, 2007, 11:16:56 am »
Quote
It was the ssi file that was causing the trouble.
Yeah, it looks like a karma mod of some kind was causing the error.

Ouch

  • Guest
Re: bank Interest and Cron job
« Reply #6 on: May 20, 2007, 10:28:30 pm »
(Email from Cron) (No errors in the server error log)
Warning: main(../../SSI.php): failed to open stream: No such file or directory in /home/tryfree/public_html/smf1/Sources/shop/dointerest.php on line 17

Warning: main(../../SSI.php): failed to open stream: No such file or directory in /home/tryfree/public_html/smf1/Sources/shop/dointerest.php on line 17

Warning: main(): Failed opening '../../SSI.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/tryfree/public_html/smf1/Sources/shop/dointerest.php on line 17

Fatal error: Call to undefined function:  db_query() in /home/tryfree/public_html/smf1/Sources/shop/dointerest.php on line 20

This is the error message i get from the crontab, no errors in the server log. ^^^^^

<?php
/**********************************************\
| SMFSHOP (Shop MOD for Simple Machines Forum) |
|         (c) 2005 DanSoft Australia           |
|      http://www.dansoftaustralia.com/        |
\**********************************************/

//File: dointerest.php
//      The file to add interest to member's bank

//VERSION: 1.31 (Build 7)
//DATE: 10th December 2005
// $Id: dointerest.php 4 2006-07-08 10:09:08Z daniel15 $

if(!isset($_SERVER["HTTP_HOST"])) {

   include("../../SSI.php");
   
   $interest_rate = $modSettings['shopInterest'] / 100;
   db_query("UPDATE {$db_prefix}members
           SET moneyBank = moneyBank + (moneyBank*{$interest_rate})", __FILE__, __LINE__);
   
   echo "Interest added at ".date("d/m/Y h:i:s A");
}
?>

This is dointerest.php ^^^^^

Any idea on how to fix the ssi problem? And the db query problem?


From,
Ouch
« Last Edit: May 20, 2007, 10:32:47 pm by Ouch »

Offline feeble

Re: bank Interest and Cron job
« Reply #7 on: May 21, 2007, 09:55:50 am »
change

Code: [Select]
   include("../../SSI.php");
to

Code: [Select]
   include("/home/tryfree/public_html/smf1/SSI.php");

Ouch

  • Guest
Re: bank Interest and Cron job
« Reply #8 on: May 22, 2007, 03:16:44 am »
ssi.php does not exist in the smf1 folder, so it simply does nothing. No error messages, but also no interest.

Offline feeble

Re: bank Interest and Cron job
« Reply #9 on: May 22, 2007, 10:52:44 am »
so point it to where it does exist.

..if its not given if you errors, then it must exist. or am i mistaken?

Ouch

  • Guest
Re: bank Interest and Cron job
« Reply #10 on: May 22, 2007, 09:16:41 pm »
It does exist, just overlooked it. My host had to correct the path for the cron job (I didn't know the absolute path.) I'm going to use the same root path for the SSI.php and see if that solves the problem.

To find out if i had the path correct in the crontab, my host put in a script called Test.php and set it to run once daily. It's output is "test", sent to my email account. (it's not really a script, just a php file with the word 'test' in it, too see if the crontab is working.)

From,
Ouch
« Last Edit: May 22, 2007, 09:18:25 pm by Ouch »

Ouch

  • Guest
Re: bank Interest and Cron job
« Reply #11 on: May 22, 2007, 11:34:30 pm »
nevermind lol. I'll install Shop after about, 2 years, or whenever i finally know how to write php lol, Still getting an error from line seventeen, even after aiming dointerest.php to it. Maybe I'll learn enough to re-write the dointerest.php so that it can work without everyone asking millions of questions about the interest.

Daniel, I bet you wish you never wrote the shop mod lol

Peace out,

Offline Daniel15

Re: bank Interest and Cron job
« Reply #12 on: May 26, 2007, 10:09:50 am »
Quote
ssi.php does not exist in the smf1 folder, so it simply does nothing. No error messages, but also no interest.
:o
That's the problem, SSI.php is a core part of SMF. Does going to ssi_examples.php in your SMF directory work? If not, you'll need to reupload the SSI.php file.