Bitcoin Forum
November 18, 2024, 04:11:20 AM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Looking for a php developer to help with a error in an altcoin faucet.  (Read 649 times)
Starin (OP)
Sr. Member
****
Offline Offline

Activity: 266
Merit: 250


Infected Mushroom


View Profile WWW
June 15, 2015, 10:54:45 AM
 #1

Hey there, I was trying to setup a faucet for an altcoin. I tried using https://github.com/ChristianGrieger/Cryptocurrency-faucet-script

I setup a deamon on a VPS and put the correct settings in the config file. However I am getting this error in the page:

Code:
Cannot seem to connect at the moment, please come back later!

This code in the template section, like this:

Code:
    <?php
break;
            case 
SF_STATUS_RPC_CONNECTION_FAILED:
            case 
SF_STATUS_MYSQL_CONNECTION_FAILED:
?>

    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">Status</h3>
        </div>
        <div class="panel-body">
            Cannot seem to connect at the moment, please come back later!
        </div>
    </div>

I tried removing

Code:
case SF_STATUS_MYSQL_CONNECTION_FAILED:

to see if it was a database error and bum, the error code dissappeared. So it seems like my rpc settings are alright and it connects to my wallet, however, even though I am %100 sure every database config is true, it somehow fails to connect to my database. Perhaps this is because the mysql or even php version.

If you are able to solve this problem / error please whisper me with an reasonable offer. The aim of the faucet is not to get profits from adds as you will see I put none on the interface.

Thanks.

GWGoods
Newbie
*
Offline Offline

Activity: 14
Merit: 0


View Profile
June 15, 2015, 11:20:27 AM
 #2

Have you created the db? Edited the settings in config.php to match? imported faucet.sql?
Starin (OP)
Sr. Member
****
Offline Offline

Activity: 266
Merit: 250


Infected Mushroom


View Profile WWW
June 15, 2015, 11:30:59 AM
 #3

Have you created the db? Edited the settings in config.php to match? imported faucet.sql?

Yeah, everything looks fine. I triple checked, even created 2 more users with same previleges.

I am guessing it's not because of the cron job I failed to create.

I haven't edited simple_facuet.php located at /lib. I don't know if I have to since there is no indication for it at Install steps.

Starin (OP)
Sr. Member
****
Offline Offline

Activity: 266
Merit: 250


Infected Mushroom


View Profile WWW
June 15, 2015, 12:49:10 PM
 #4

So I created a simple php calling the same database and there were no connection errors.
I changed the database config to false dbname etc. The site renewed in 2 secs, when the credentials were true, it took like 15 seconds to load. So I am guessing it tries to connect to database but something prevents it.


Franciem
Sr. Member
****
Offline Offline

Activity: 322
Merit: 250


Real power doesnt hit hard,but right to the target


View Profile
June 15, 2015, 05:09:49 PM
 #5

Man i hope you will resolve this.
Free altcoin faucet script sounds wonderfull. If it will work, i will probably make one too.

NLNico
Legendary
*
hacker
Offline Offline

Activity: 1876
Merit: 1295


DiceSites.com owner


View Profile WWW
June 15, 2015, 05:27:16 PM
 #6

It seems the RPC settings are wrong. Both mysql and rpc check are in same IF statement and return same mysql error. Makes sense its slower w real DB info cuz only then it tries to connect to wallet.

Can also debug "getbalance" RPC command further in simplefaucet file. On phone so cannot say exact lines.

Starin (OP)
Sr. Member
****
Offline Offline

Activity: 266
Merit: 250


Infected Mushroom


View Profile WWW
June 15, 2015, 06:45:22 PM
 #7

It seems the RPC settings are wrong. Both mysql and rpc check are in same IF statement and return same mysql error. Makes sense its slower w real DB info cuz only then it tries to connect to wallet.

Can also debug "getbalance" RPC command further in simplefaucet file. On phone so cannot say exact lines.

Thanks for your answer man.

I also believed to be an RPC error. However the coin I intend to use, uses bitcoind rpc so I thought it wouldn't be problem. On the other hand, I am %100 sure the RPC settings I entered are true.
I wanted to see if the DB connection is the problem. So I removed

Code:
case SF_STATUS_MYSQL_CONNECTION_FAILED:

And boom! The error dissappeared. Since in the template file there are 2 separete IFs for both error, as in:

Code:
   <?php
break;
            case 
SF_STATUS_RPC_CONNECTION_FAILED:
            case 
SF_STATUS_MYSQL_CONNECTION_FAILED:
?>

    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">Status</h3>
        </div>
        <div class="panel-body">
            Cannot seem to connect at the moment, please come back later!
        </div>
    </div>

I thought removing 1 would show me where the problem is. So I tried removing:

Code:
            case SF_STATUS_RPC_CONNECTION_FAILED:

And I still had the error message. So it really seems like a database connection error despite all the settings are true and despite I created a simple php to call the database and it worked.

I'd assume something doesn't work with my mySQLi version?


Man i hope you will resolve this.
Free altcoin faucet script sounds wonderfull. If it will work, i will probably make one too.

I'll make sure to share it If I come up with a solution indeed. Smiley

GWGoods
Newbie
*
Offline Offline

Activity: 14
Merit: 0


View Profile
June 15, 2015, 07:48:21 PM
 #8

Sorry had to go out earlier.

Quote
Line 82: simple_faucet.php: if (!mysqli_connect_error() && !is_null($this->balance = $this->rpc("getbalance")))

Else

Quote
Line 190: simple_faucet.php: $this->status = SF_STATUS_MYSQL_CONNECTION_FAILED;

So it basically checks your db settings and rpc getbalance, if one is wrong then return SF_STATUS_MYSQL_CONNECTION_FAILED

That isnt such a 'nice' way to do it.
Starin (OP)
Sr. Member
****
Offline Offline

Activity: 266
Merit: 250


Infected Mushroom


View Profile WWW
June 15, 2015, 09:01:55 PM
 #9

Sorry had to go out earlier.

Quote
Line 82: simple_faucet.php: if (!mysqli_connect_error() && !is_null($this->balance = $this->rpc("getbalance")))

Else

Quote
Line 190: simple_faucet.php: $this->status = SF_STATUS_MYSQL_CONNECTION_FAILED;

So it basically checks your db settings and rpc getbalance, if one is wrong then return SF_STATUS_MYSQL_CONNECTION_FAILED

That isnt such a 'nice' way to do it.

Hmm, I guess I missed that part. Assuming it connects to the DB, I am pretty sure about my rpc config too since we run a profit calculator from that wallet too. Any possibility that the code is outdated to work on newer updates of qts, etc?

Ratnet
Newbie
*
Offline Offline

Activity: 22
Merit: 0


View Profile
June 15, 2015, 10:52:45 PM
 #10

Hello,

I've just installed that script yesterday to test it and I can assure you that is working.

Maybe you can debug the connectiong making a print_R() in one of the queries on simple_faucet.php
StaisyBit
Member
**
Offline Offline

Activity: 84
Merit: 10

memento audere semper


View Profile WWW
June 17, 2015, 12:22:34 AM
 #11

Taking a look at json rpc client.php, it seems that you must pass an array as param along with the rpc call. Hence try to do something like:

$this->rpc("getbalance", array())


Also, as stated above, that If statement is not a nice way to perform a check. Think to change it
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!