Need Help understanding THis PHP Code and How to use it

Hi, i have some code here to create my own BTC Faucet.
It basically says i need to use its code and create a MySQL Databse for it

  1. I’ve Never done PHP or MySQL Ever

I was wondering if someone could look at the code and tell me what/how to do it, (even create the database for me so i can look and see)
And i am also wondering how i would get this onto the Web, i already have a Ubuntu Server (12.04) and a Domain hooked into the Server (is it Apache i use?)

Have you even bothered to read the readme file?

MyFaucet Set Up Instructions

Version: 0.11. Copyright [email protected]

  1. Create a new account for your faucet.
  2. Upload the scripts to the server.
  3. Follow instructions in config.php

No warranty or support is provided with this software.



// Database Config
// You will need to import the SQL file first and create a MySQL database and user
$sqlHost = “localhost”; //Unless your MySQL server is on another server, leave it at
$sqlUser = “username”; //Your MySQL username with permissions to modify the new database you created
$sqlPassword = “password”; //Your MySQL password
$sqlDatabase = “databasename”; //The MySQL database you created and imported

$mysqli = new mysqli($sqlHost, $sqlUser, $sqlPassword, $sqlDatabase);
echo "SQL error: " . $mysqli->connect_error;

// Site Config
$siteName = “MyFaucet”;
// Array of 8 rewards in satoshis. 100,000,000 satoshis = 1 BTC
// 1 mBTC = 100,000 Satoshis
// 1 μBTC (microbitcoin) = 100 Satoshis
$rewards = [1000, 1500, 2000, 2500, 3000, 3500, 4000, 5000];
$minReward = min($rewards);
$maxReward = max($rewards);

$dispenseTime = 3600; // how long per dispense (in seconds)
$dispenseTimeText = relative_time(time() + $dispenseTime);

$cashout = 20000; //min cashout. must be at least 10,000 satoshi (0.1 mBTC for Inputs)
$cashoutMessage = “Cashout from MyFaucet - thanks for using!”; // note sent with cash out

// Account
// You need to make a NEW account and generate an API key in the security tab
$apiKey = “yourApiKeyHere”;
$apiPin = “PIN”; // Your PIN

// Make sure you have added balance to it!

$referPercent = 25; //referral percentage

// Recaptcha API keys
// You need GET YOUR OWN. Here

$recaptchaPub = " PUBLIC KEY";
$recaptchaPrv = " PRIVATE KEY";

$links = “Adds links to your favorite Bitcoin faucets here
Adds links to your favorite Bitcoin faucets here

// Advertisement Codes
// All ads rotate. There are 3 types: square, text, and banner. Add HTML code to the array

$squareAds = [’’];

$textAds = [‘

CoinChat - get free Bitcoins chatting!

’, ‘

Get your own faucet! MyFaucet PHP script - free!


$bannerAds = [’

Create a database in your hosting account whether it’s CPanel or whatever, create a user and assign it to the database, edit config.php with the database info e.g. whether the host is localhost or an IP, username, password etc, edit any of the other variables you need to in config.php and upload the files.

Create a Database How? And Using what? what info must i put into the database?

You should have a web admin to login via your hosting account. Within that login you’ll have a lot of options such as FTP, users, databases etc. You want to head into your database section and create a new database (this is just a database name) you will then need to create a user (username,password) and assign that user to the database.

Once you have done that, you’ll then have the following information to put into the config.php file:

database name

Then you’ll need to put a host name in, this is usually always localhost but some hosts will have a separate server for databases, in which case you should find this somewhere within your hosting account (usually an IP address).

If you’re still struggling, you will need to contact your hosting provider and ask them how to login to your web admin and create a database.

Sponsor our Newsletter | Privacy Policy | Terms of Service