Author Topic: Personal Interest Rates Item Available.  (Read 9517 times)

Offline sc2

Re: Personal Interest Rates Item Available.
« Reply #15 on: July 19, 2007, 01:40:12 pm »
I am testing it now and will get back to you! Thanks!!!

Offline sc2

Re: Personal Interest Rates Item Available.
« Reply #16 on: July 19, 2007, 02:31:07 pm »
Yep, that did it, thanks again!!glad it is finally working :D

Offline JRSofty

Re: Personal Interest Rates Item Available.
« Reply #17 on: July 19, 2007, 04:37:03 pm »
Honestly I was seeing some strange interest issues on my forum as well. I just didn't know it was this causing it ;) and didn't have time to really look for it as I have tons of other projects under way as well.

Offline inkstains

Re: Personal Interest Rates Item Available.
« Reply #18 on: July 31, 2007, 06:30:43 pm »
excellent stuff love ya work

one question though, when the interest rate becomes negative does that mean what ever that negative percentage is, is deducted from the members bank?

Offline JRSofty

Re: Personal Interest Rates Item Available.
« Reply #19 on: July 31, 2007, 06:49:14 pm »
Love the avatar ;)

Actually that is what should happen in theory but honestly I've not tested it.

Offline inkstains

Re: Personal Interest Rates Item Available.
« Reply #20 on: July 31, 2007, 09:12:47 pm »
cool i'll check it tommorow after the cronjob has run

one thing i noticed

when a user uses the add XXX to interest rate item the message they recieve is

Successfully added XXX to post count!

looks like this part here wasn't changed in AddToInterest.php

Code: [Select]
$result = db_query("UPDATE {$db_prefix}members
                            SET bankInterest = bankInterest + {$item_info[1]}
                            WHERE ID_MEMBER = {$ID_MEMBER}",
                            __FILE__, __LINE__);
        return "Successfully added {$item_info[1]} to post count!";
       
        //echo $item_info[1];
        die("dead");

Offline JRSofty

Re: Personal Interest Rates Item Available.
« Reply #21 on: July 31, 2007, 09:19:51 pm »
 ::) I thought I caught all that.

thanks for the info I'll get it fixed with the rest of the bugs for that project  O0

BTW

Is anyone having problems with the script and CRONJOB?

I'm just wondering because my host says it's my code and not their CRONTAB (what they call Cronjobs) service that is the problem.

Their excuse is that if I can call the script via the browser and it works but they call it from shell and it doesn't then it is my script's fault. Although the script was running just fine until they upgraded us from PHP4 to PHP5.
« Last Edit: July 31, 2007, 09:21:38 pm by JRSofty »

Offline feildmaster

Re: Personal Interest Rates Item Available.
« Reply #22 on: August 01, 2007, 12:57:09 am »
The script works fine... In fact... so well I use your basic idea for some other things as well in crons... ^^

PHP5 does have some strange errors... Thats why I stayed with php4.

Offline JRSofty

Re: Personal Interest Rates Item Available.
« Reply #23 on: August 01, 2007, 05:08:06 pm »
I had no choice my host upgraded the servers and I don't get to say anything :(

Oh well PHP4 is ending soon anyway.

I've been thinking of creating a CRON mod for SMF for people who don't know how or can't use cronjobs.

Still working out the planning for it but it might help lots of people especially those that use SMFShop.

Offline inkstains

Re: Personal Interest Rates Item Available.
« Reply #24 on: August 01, 2007, 05:32:33 pm »
it appears i have a boo boo every member is now "rich bitch" (chapelle kicks the llamas arse) with a bank balance of "4294967295" maybe i've missed something but i haven't had a chance to have a look anyone else had a similar problem?

i'm guessing it's something in the cronjob file that's stuffed up

Offline JRSofty

Re: Personal Interest Rates Item Available.
« Reply #25 on: August 01, 2007, 05:39:35 pm »
You fell victim to this bug

http://www.daniel15.com/forum/index.php/topic,732.msg5848.html#msg5848

Just follow the replacement changes there and you will see that problem go away.

I have not yet updated the files to fix this in the actual download yet :blush: sorry been real busy with life right now.

Offline inkstains

Re: Personal Interest Rates Item Available.
« Reply #26 on: August 01, 2007, 09:25:55 pm »
You fell victim to this bug

http://www.daniel15.com/forum/index.php/topic,732.msg5848.html#msg5848

Just follow the replacement changes there and you will see that problem go away.

I have not yet updated the files to fix this in the actual download yet :blush: sorry been real busy with life right now.

that's cool cheers i shoulda read the thread, next question is can i reverse the changes and get everyone back to their original credit values? i imagine i can change the script to do a negative of the interest added? would that be right? cheers for the help man i'm still a little green when it comes to php and the sort
« Last Edit: August 01, 2007, 09:30:44 pm by inkstains »

Offline JRSofty

Re: Personal Interest Rates Item Available.
« Reply #27 on: August 01, 2007, 09:54:03 pm »
You just have to be careful for three items:

1. Any new members joined since the script has run will change the outcome by removing an extra % per user extra.

2. If a member has added money to their account would have extra money removed.

3. Honestly since the increase was a % of a lower number and the now starting numbers will be higher then more money would be removed. For example if someone had 500 credits and after the script ran they now have 1000 credits. 1% of 1000  > 1% of 500.

So you would need to find some way to split up the % to remove versus the number of times the original script ran (or the total number of members at the time of the cronjob).

OR

If all this math is too much for you (it almost is for me) I would suggest that you find who has the most money. Do a rule of thumb and remove that % from everyone. Some may end up with more than they originally had and some may end up with less but at least it would be a bit fair.