Bitcoin Forum
May 10, 2024, 08:37:22 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: A little help (regarding a faucet) ?  (Read 619 times)
superiorus (OP)
Legendary
*
Offline Offline

Activity: 1358
Merit: 1000

Bitcoiner since start, and continue to love it!


View Profile WWW
April 06, 2015, 08:37:02 AM
 #1

Hi

Someone can tell me if we can set a percent of the rewards ?
(I mean  to offer  1000 satoshi = 50% , 2000 satoshi = 30%, 3000 satoshi= 10%, 4000 satoshi= 9%, 5000 satoshi = 1%) it is just a example.


Now I have :

Quote
// Array of 8 rewards in satoshis. 100,000,000 satoshis = 1 BTC

// 1 mBTC = 100,000 Satoshis

// 1 ?BTC (microbitcoin) = 100 Satoshis

$rewards = array(1000, 2000, 3000, 4000, 5000);

$minReward = min($rewards);

$maxReward = max($rewards);]

The source code for the faucet : https://gitorious.org/elbandi/minifaucet

The file where the rewards are set is : config.php

Thank you

1715373442
Hero Member
*
Offline Offline

Posts: 1715373442

View Profile Personal Message (Offline)

Ignore
1715373442
Reply with quote  #2

1715373442
Report to moderator
1715373442
Hero Member
*
Offline Offline

Posts: 1715373442

View Profile Personal Message (Offline)

Ignore
1715373442
Reply with quote  #2

1715373442
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715373442
Hero Member
*
Offline Offline

Posts: 1715373442

View Profile Personal Message (Offline)

Ignore
1715373442
Reply with quote  #2

1715373442
Report to moderator
1715373442
Hero Member
*
Offline Offline

Posts: 1715373442

View Profile Personal Message (Offline)

Ignore
1715373442
Reply with quote  #2

1715373442
Report to moderator
superiorus (OP)
Legendary
*
Offline Offline

Activity: 1358
Merit: 1000

Bitcoiner since start, and continue to love it!


View Profile WWW
April 06, 2015, 11:24:23 AM
 #2

could this be a solution ?

Quote
// Each reward entry is in the follwing format: array_fill(0,WEIGHT,REWARD) where WEIGHT is how frequently you want the REWARD to occur.
$rewards = array_merge(array_fill(0,1,500),
                       array_fill(0,10,200),
                       array_fill(0,100,150),
                       array_fill(0,100,100),
                       array_fill(0,50,75),
                       array_fill(0,50,50),
                       array_fill(0,25,25),
                       array_fill(0,20,10)
);

niktitan132
Legendary
*
Offline Offline

Activity: 1036
Merit: 1000



View Profile
April 06, 2015, 11:39:07 AM
 #3

could this be a solution ?

Quote
// Each reward entry is in the follwing format: array_fill(0,WEIGHT,REWARD) where WEIGHT is how frequently you want the REWARD to occur.
$rewards = array_merge(array_fill(0,1,500),
                       array_fill(0,10,200),
                       array_fill(0,100,150),
                       array_fill(0,100,100),
                       array_fill(0,50,75),
                       array_fill(0,50,50),
                       array_fill(0,25,25),
                       array_fill(0,20,10)
);

Yes, this is the solution.Replace in the first code  $rewards = array(1000, 2000, 3000, 4000, 5000); with that other $rewards = .... code.It should work.
superiorus (OP)
Legendary
*
Offline Offline

Activity: 1358
Merit: 1000

Bitcoiner since start, and continue to love it!


View Profile WWW
April 06, 2015, 11:47:00 AM
 #4

could this be a solution ?

Quote
// Each reward entry is in the follwing format: array_fill(0,WEIGHT,REWARD) where WEIGHT is how frequently you want the REWARD to occur.
$rewards = array_merge(array_fill(0,1,500),
                       array_fill(0,10,200),
                       array_fill(0,100,150),
                       array_fill(0,100,100),
                       array_fill(0,50,75),
                       array_fill(0,50,50),
                       array_fill(0,25,25),
                       array_fill(0,20,10)
);

Yes, this is the solution.Replace in the first code  $rewards = array(1000, 2000, 3000, 4000, 5000); with that other $rewards = .... code.It should work.

Thank you @niktitan132

A dumb question maybe ... what is "0" in this case ?

emrebey
Sr. Member
****
Offline Offline

Activity: 476
Merit: 250


View Profile
April 06, 2015, 12:11:10 PM
 #5

A dumb question maybe ... what is "0" in this case ?

http://php.net/array_fill

zero is the start index.
superiorus (OP)
Legendary
*
Offline Offline

Activity: 1358
Merit: 1000

Bitcoiner since start, and continue to love it!


View Profile WWW
April 06, 2015, 01:21:53 PM
 #6

One more question :

the max. value for "WEIGHT"  must be 100 ?

or could be 500 for example ?

emrebey
Sr. Member
****
Offline Offline

Activity: 476
Merit: 250


View Profile
April 06, 2015, 06:56:52 PM
 #7

One more question :

the max. value for "WEIGHT"  must be 100 ?

or could be 500 for example ?

there is no max. you can set whatever you want but beware more value means that the possibility of related reward will raise too.
superiorus (OP)
Legendary
*
Offline Offline

Activity: 1358
Merit: 1000

Bitcoiner since start, and continue to love it!


View Profile WWW
April 07, 2015, 08:09:50 AM
 #8

I see a error when I click "Update server balance" from admin panel : Balance is not updated or balance is empty

But I have enough btc in my blockchain wallet.

superiorus (OP)
Legendary
*
Offline Offline

Activity: 1358
Merit: 1000

Bitcoiner since start, and continue to love it!


View Profile WWW
April 07, 2015, 12:23:25 PM
 #9

UPDATE :

somebody can help me to fix this issue ?
i offer a nice bounty for a solution.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!