Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 420
0 Users 5 Guests Online

Bank Interest

Pre-Requirements

  • Private Message System[/*]
  • A Point System[/*]
  • A Brain[/*]


First off you will want to make a file in:
/home/YOURUSERNAME/
This is so NO BODY can access the file and run it multiple times and what not.
You will want to name this file: bankcron.php.

In this file type something like the following.
PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
require("public_html/config.php"); //get config
function pti($points){ //define the functions
if(($points >= '1') && ($points <= '49')){ //if the points is greater than 1 but less than 49
$inf '5'//inflation or interest is 5%
$new '0.05'//or decimal form is 0.05
//end 5% interest
if(($points  >= '50') && ($points <= '99')){ //or if points are 50 or more but less that 99
$inf '4'//interest is 4%
$new '0.04'//decimal is 0.03
//end 4%
if(($points >= '100') && ($points <= '149')){ //100 but less than 149 is 3%
$inf '3'//the third interest rating..
$new '0.03'//decimal of 0.03
//end 3%
if(($points >= '150') && ($points <= '199')){ //more than 150 but still less than 199
$inf '2'//is 2% interest..
$new '0.02'//which is 0.02 in decimal form
//end 2%
if(($points >= '200')){ //person has more than 200+ points in bank
$inf '1'//or 1% interest
$new '0.01'//or 0.01 in decimal form
//end it
if(($points == 0)){ //hehe if they dont have any yet they have a bank account
$inf '0'//0% inflation for this user :O
//end
$m1 = ($points $new); //do some math to calculate new points
$m1e floor($m1); //round down
$m2 = ($m1e $points); //total up the points..
return $m2//return the new points
//end the function
$getall mysql_query("SELECT * FROM `bank` ORDER BY `id`"); //get all users from bank
while($gt mysql_fetch_array($getall)){ //loop the results
$npts pti($gt[points]); //new points the points in bank
$updatepts mysql_query("UPDATE `bank` SET `points` = '$npts' WHERE `username` = '$gt[username]';") or die(mysql_error()); //update the users points or die with an error
$msg "Hello $gt[username]
This is just a message to tell you that your bank interest has been added to your bank account.
<b>Old Balance</b>: 
$gt[points]
<b>New Balance</b>: 
$npts"//message to be sent to the users
$date date("l jS F Y h:i A"); //the date format
$newpm mysql_query("INSERT INTO `privates` (`to`,`from`,`date`,`subject`,`content`) VALUES ('$gt[username]','BOT-Interest','$date','Bank Interest','$msg');"); //Private Message the users
//end the loop
?>


Then go into Cpanel > Cron Jobs and hit 'Simple'

Enter in the following:
TutorialNinja Image

that will be set at 4PM server time Every Thursday. Change it if you want :P
ShadowMage
Author:
Views:
2600
Rating:
Posted on Monday 22nd September 2008 at 10:58 AM
ShadowMage
ShadowMage
http://rmb-scripting.com/tutorials.php?tutorial&tid=186
Posted on Sunday 21st September 2008 at 08:45 PM
jambomb
jambomb
?
Posted on Sunday 7th September 2008 at 06:01 PM
jambomb
jambomb
Doesnt work i get this


<br />
<b>Warning</b>: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>/home/******/BANKcron.php</b> on line <b>20</b><br />
Posted on Saturday 12th April 2008 at 02:01 PM
cyruswu
cyruswu
It sends a message to them about any changes in there bank accont.
Posted on Wednesday 9th April 2008 at 06:04 PM
Dalez
Dalez
So why do you need the PM system?
Posted on Saturday 29th March 2008 at 02:48 AM
ShadowMage
ShadowMage
i believe theres an alternative hold on i'll go look then send a PM
Posted on Friday 28th March 2008 at 02:46 PM
test
test
what if your hosting doesnt cpanel which doesnt provide cron functions
Posted on Saturday 14th July 2007 at 02:55 PM
ShadowMage
ShadowMage
then their crap out of luck?
Posted on Saturday 14th July 2007 at 01:37 PM
cyruswu
cyruswu
Mod-shadow.

What if someone does not have an brain. And is powered by an computer.
Posted on Friday 13th July 2007 at 10:59 PM
Diablosblizz
Diablosblizz
Right now I have no use for. I don't have a website, just a front page linking to my retro.. which is being STUPID! :@