BillingFox Documentation

Learn about BillingFox


USERS:

---------------------[ INSTALATION ]---------------------

1. Open your website.
2. Press 'Continue', read and accept terms and conditions.
3. Press 'Continue'.
4. Fill your admin data.
5. Fill your database data and select your CronJob status.
If the CronJob checkbox is checked you must create a cronjob that is running every minute with the command: /usr/bin/php /home/username/website_folder/install/
cronjob.php >/dev/null 2>&1
If the CronJob checkbox is not checked BillingFox will check product expiration every time when a visitor enters on page (We recommend this ONLY if you have CronTab
disabled, it can cause performance issues).
If you have already a BillingFox instalation found, press 'Clear database'.
After that you can press 'Continue'.

Now you can start managing your website.

---------------------[ HOW TO USE? ]---------------------

If you are not using automation addons, you can easely place products and activate orders via admin area.

You can login with your admin informations by opening Dashboard menu tab in your home page (login: YourWebsite.com/panel) You can easely manage BillingFox by opening admin area, ( YourWebsite.com/client_area?admin_area=1 )
At down of page you have your website stats.
Menu buttons:

Manage users: Here you will se your user stats and 2 menu tabs ("Choose user from users list" and "Manage specific user" ).
Choose user from users list: Here you will see users list and her status,if you need to manage user or more informations about a specific user,click on "Manage" button in the right of client,here your can modify her account money,ban user,give a rank (
Operator,partner,admin or user).
Manage specific user: Here you can manage a specific user just by inserting the email,if you need to manage user or more informations about a specific user,click on "Manage" button in the right of client,here your can modify her account money,ban
user,give a rank (Operator,partner,admin or user).
BillingFox settings: Here you can see your license stats,manage website name,announcements,currency,favicon and principal logo.
Manage announcements: Here you can create announcements and manage others.
Addons: Here you can manage your addons.
deactivate: Deactivate an addon.
Activate: Activate an addon.
Install: This will you see when you have an addon in your 'content/addons/',but is not installed,is not made a database table for it,click install and the addon will be installed.
Products: Here you can see your list of products,create them,manage and create categories for your products.
Create product: Here you can create a new custom product.
Manage categories: Here you can see your categories list or manage them.
Domains: Here you can see your list of domains are you selling,,manage them,or create new ones
Create domain: Here you can create a new custom domain.
Coupons: Here you can see your list of coupons,create new ones and manage them
Create coupon: Here you can create a new coupon.
Orders: Here you can see your list of pending and active orders ,manage them,manage a specific order and create new ones
Pending orders: Here you see and manage orders that are not activated yet.
Pending orders: Here you see and manage orders that are active.
Manage specific order: Here you can insert the ID of an order and manage it.
Create order: Here you can create orders (products/domains) for users.
Tickets: Here you can see your list of tickets,manage them or manage departments of tickets
Departments: Here you see and manage departments of tickets.
Create department: Here you can create other departments.
Deposits: Here you can see pending deposit requests
Additional buttons (addon buttons): these buttons are created by some addons to manage them

At bottom of page you have BillingFox announcements.






DEVELOPERS:

---------------------[ THEMES ]---------------------

Themes are used by BillingFox to create a design for principal pages.

NOTE: All pages in theme must have '.php' extension.

How to install a theme?
Upload it on your 'content/themes/' directory.
Enter on admin area > Themes > Theme section | and choose your new added theme (regularly is directory name)

How to integrate a template with BillingFox (as theme)?

1. Replace all
src="(path to css/js file)"
with:
src="content/themes/Your Theme Directory/(path to css/js file)"

and all
href="(path to css/js file)"
with:
href="content/themes/Your Theme Directory/(path to css/js file)"

*NOTE: href=" and src=" can in some cases be href=' and src='*

*You can use replace function (CTRL + H) to replace all content in file*

2. Use functions:

<?php getElement('top'); ?> // in top of script
<?php getElement('header'); ?> // before </head> tag
<?php getElement('footer'); ?> // before </body> tag

You can use BillingFox functions to customize your theme [check Advanced Functions section]


---------------------[ CLIENT AREAS ]---------------------

Client areas are used by BillingFox to create a design for user panel pages.

NOTE: All pages in client areas must have '.php' extension.

How to install a client area?
Upload it on your 'content/client_areas/' directory.
Enter on admin area > Themes > Client area section | and choose your new added client area (regularly is directory name)

How to integrate a template with BillingFox (as client area)?

1. Replace all
src="(path to css/js file)"
with:
src="content/client_areas/Your Client Area Directory/(path to css/js file)"

and all
href="(path to css/js file)"
with:
href="content/client_areas/Your Client Area Directory/(path to css/js file)"

*NOTE: href=" and src=" can in some cases be href=' and src='*

*You can use replace function (CTRL + H) to replace all content in file*

2. Use functions:
<?php getElement("top_client_area"); ?> // in top of script <?php getElement("header_client_area"); ?> // before </head> tag <?php getElement("before_body_client_area"); ?> // before </body> tag
3. replace <html lang="en"> (or any language that is found here) with <html lang="<?php echo $_LANG['locale']; ?>">

4. Replace all strings with language variable from content/LANG/english.php with their translation, for example, we will take this line from translations:

$_LANG['client_area']['admin_panel'] = 'Admin panel';

and we will go to out client area files and replace 'Admin panel' or 'Admin dashboard' or something like that to <?php echo $_LANG['client_area']['admin_panel']; ?> , use this for all strings.
5. in your menu, to get custom menu items you must use:

<?php $menu = getMenuItems();
if(is_array($menu)) {
foreach ( $menu as $item )
{ ?>
<div class="icon menu-item"><?php echo $item['icon']; ?></div>
<div class="text menu-item"><?php echo $item['item_display'];?></div>
<?php<
}
} ?>

Replace classes and div elements with your integrated client area classes and elements.

You can use BillingFox functions to customize your client area [check Advanced Functions section]

---------------------[ ADDONS ]---------------------

Addons are used by BillingFox to extent it's functions.

How to install a client area?
Upload it on your 'content/client_areas/' directory.
Enter on admin area > Addons section | and click on install of your desired addon (regularly is directory name)


- Development (create an addon)

Create the following default addon directory structure:

-> YourAddonName (dir)
-> run.php (file)

run.php's default content:

<?php
    $query_addon = "SELECT addon_name FROM BF_addons WHERE addon_name='YourAddonName'";
 // selecting this addon from db
        $addon_result = mysqli_query($db, $query_addon);
        if(mysqli_num_rows($addon_result) == 1 && addon_activated('YourAddonName'))
 // check if addon is on db and activated
        {
            // IF THE ADDON IS ACTIVATED - (you can use $_GET[] to check the page)
        }
    else
    {
      // INSTALATION OF ADDON
            $install_db1 = "INSERT INTO BF_addons (`addon_status`, `addon_name`, `addon_description`, `custom_var`, `custom_var_name`) VALUES ('1', 'YourAddonName', 'Some description', 'Self Database,edit on addon menu', 'CustomVariable');";
 // Inserting addon on addons table
            $install_db2 = "CREATE TABLE IF NOT EXISTS `BF_YourAddonName` (field text NOT NULL);";
 // Creating table for data of addon
             $install_db3 = "INSERT INTO BF_YourAddonName (`field`) VALUES ('This is a default field.');";
      mysqli_query($db, $install_db1)
      or die ("SQL error(YourAddonName - addon(install1)): " .mysqli_error($db));
      mysqli_query($db, $install_db2)
      or die ("SQL error(YourAddonName - addon(install2)): " .mysqli_error($db));
      mysqli_query($db, $install_db3)
      or die ("SQL error(YourAddonName - addon(install3)): " .mysqli_error($db));
      // INSTALTION OF ADDON
      // WHAT TO DO AFTER INSTALATION (like, setting a session variable to make an install wizard and more)
            }
?>

Edit addon as much do you want
IMPORTANT: AN ADDON IS USED WHEN $_GET['addon_use'] is 'YourAddonName' (used on addon checking)
$_GET['something'] is your url variable like https://YourWebsite/index?variable1=test1&variable2=test2&variable3=test3
Here are 3 GET variables:

$_GET['variable1'] have value test1
$_GET['variable2'] have value test2
$_GET['variable3'] have value test3

ADDON PAGES ARE WORKING ONLY ON CLIENT AREA AND LOGIN/REGISTER (panel) PAGE FOR SECURITY REASONS:
IMPORTANT: THE ADDON PRINCIPAL FILE IS 'run.php'.

Things to know about addons:
The principal file of an addon is named 'run.php' (without quotes)
uninstall process of addon is located on (addon directory)/uninstall.php (deleting tables of addon and addon row in BF_addons table)
run.php and uninstall.php are mandatory for addon functionality
- AddonDirectory/functions/menu.php is a tiny file used to generate menu items, example:
$menu_item[] = BF_add_menu_item('client_area?addon_use=MarketPlace', '<img src="content/addons/MarketPlace/icons/BillingFox-gray-mini.png" style="width: 15px; height: 15px;" alt="BillingFox Icon">', 'BillingFox MarketPlace');

Menu item will redirect you to 'your-website.com/client_area?addon_use=MarketPlace', it will create a menu item that have icon '<img src="content/addons/MarketPlace/icons/BillingFox-gray-mini.png" style="width: 15px; height: 15px;" alt="BillingFox
Icon">' (image or fontawesome icon, ANYTHING), and text of menu item will be 'BillingFox MarketPlace'

'AddonDirectory/service_buttons/buttons.php' is used to generate service menu buttons
'AddonDirectory/frontend/frontend.php' is used by addons to make client area pages for normal users, you can acces them with https://yourwebsite.com/client_area?addon_use=Your_Addon
NOTE: directories of addons are loaded automatically by BillingFox, they are optionally so you don't must create them if you don't need.
'AddonDirectory/admin_actions' is a directory used by admin area on use of run.php,so you can edit it's name if you specify that on 'run.php' file.
'AddonDirectory/functions' is a directory used to make functions on top (top of script,running before loading of theme), header (before </head> tag) and footer (running after the whole page is loaded ,after </html> tag) [FOLDER FILES MUST BE NAMED:
'top.php','header.php' and 'footer.php' AND ALL MUST BE IN 'functions' directory of addon], also this directory is handling other actions of BillingFox.
'AddonDirectory/functions/fields.php' is a file that is creating custom fields for product that are using this addon (valid name values of inputs: domain, use_nameservers (boolean, if is set to 1, domain is required), server_ns1_pre, server_ns2_pre,
server_user, server_pass, server_hostname, specifications) , EVERY input from here must have form="addform" in input tag

'AddonDirectory/functions/instant_info.php' is a file that is good to create a product on external API or to offer informations for services with instant activation, variables that you can use here:
$_SESSION['woExpire_on'] - Expiration date of product;
$_SESSION['wo_domain'] - domain of product;
$_SESSION['wo_domainrequired'] - (boolean) domain required status;
$_SESSION['woPrice'] - price of product;
$_SESSION['wo_pass'] - password of product;
$_SESSION['wo_user'] - user of product;
$_SESSION['wo_hostname'] - hostname of product;
$_SESSION['wo_ns1_pre'] - first nameserver prefix of product;
$_SESSION['wo_ns1_pre'] - 2nd nameserver prefix of product;
$_SESSION['wo_token'] - random token of product;
$_SESSION['wo_addon'] - Addon of product;
$_SESSION['item_name'] - product name;
$_SESSION['item_id'] - ID of product;
$_SESSION['wo_specifications'] - Specifications about the order, these are additional informations created by addons seen only by administration (You can set this only).

NOTE: $_SESSION['wo_token'] is usually used to make random unique IDs for products, by using that you can make differences between services in addons.

In this file you MUST set $_SESSION['info'] (informations of service) and you can set also $_SESSION['user'] and $_SESSION['pass'];
'functions/on_expire.php' is a file that is good to suspend a product on external API on service expiration;

'AddonDirectory/functions/on_renew.php' is a file that is good to suspend a product on external API on service expiration, variables that you can use:

$_SESSION['svdo_newExpire'] - new expire date of renewed product;
$_SESSION['svdo_id'] - service id;
$_SESSION['svdo_token'] - service token;

Use include_once('path/to/file.php'); to include pages.

Payment things:
'payment' is a directory that must have payment page and payment methods on it (see Paypal_Gateway addon to observe)
'AddonDirectory/payment/payment_page.php' is the payment page that is using an addon;
'AddonDirectory/payment/funds_payment_page.php' is the page that will create pay-for-deposit page;
'AddonDirectory/payment/payment_methods.php' is the page that will create payment methods on BillingFox cart page (Use checkboxes with name 'payment_option');
'AddonDirectory/payment/payment_options.php' is the page that will create <option value="addon_name">Addon Name</option>, payment options for deposit page
'AddonDirectory/system.php' is the file that contains payment verification and functions after an user buy something;
Admin things:
'AddonDirectory/admin_area_buttons' is the directory that contains files for admin area buttons.
'AddonDirectory/admin_area_buttons/buttons.php' is the file that is used to create custom buttons on admin area.
Login/Register things:
'AddonDirectory/login_area' is the directory that is creating buttons on login system;
'AddonDirectory/register_area' is the directory that is creating buttons on registration system;
YOU CAN DO ANYTHING WITH ADDONS, JUST GET INSPIRATION FROM EXISTING ADDONS AND USE YOUR BRAIN TO CODE.


---------------------[ ADVANCED FUNCTIONS ]---------------------

- $_SESSION['user_id'] is the variable that means current user ID

- getUserCount() [return registered users number (int)]
- getUserVar('User ID') [returns an associative array with variables of an user (array)]
Array example:

$userstats = getUserVar($_SESSION['user_id']);

echo $userstats['username'];

Output:

[current user's username]

variables of this associative array:

*password is hashed*
id
account_money
user_services
user_banned
user_domains
user_invoices
username
user_ip
email
password
user_type
age
city
country
state
phone_number
company
user_tickets

- getProductVar('Product ID') [returns an associative array with variables of a product (array)]
Array example:

$pstats = getProductVar(1);

echo $pstats['product_name'];

Output:

[current product name of product with id 1]

variables of this associative array:

product_id
product_topic
product_type
product_name
product_specifications
product_price
product_tax
product_atax
product_instant
product_hot
product_on_sale
product_stock
product_sales
product_sale_price
product_timeline
product_timenumber
product_addon
product_date

- getDomainVar('Domain ID') [returns an associative array with variables of a domain (array)]
Array example:

$pstats = getDomainVar(1);

echo $pstats['domain_name'];

Output:

[current domain name of domain with id 1]

variables of this associative array:

domain_id
domain_name
domain_specifications
domain_price
domain_transfer_price
domain_transfer_sale_price
domain_transfer_on_sale
domain_tax
domain_atax
domain_instant
domain_hot
domain_on_sale
domain_stock
domain_sales
domain_sale_price
domain_timeline
domain_timenumber
domain_addon
domain_date

- getDepositVar('Deposit ID') [returns an associative array with variables of a deposit (array)]
Array example:

$pstats = getDepositVar(1);

echo $pstats['funds'];

Output:

[current funds of deposit with id 1]

variables of this associative array:

f_id
user
payment_method
specifications
funds
approved
date

- getServiceVar('Service ID') [returns an associative array with variables of a service (array)]
Array example:

$pstats = getServiceVar(1);

echo $pstats['svdo_name'];

Output:

[current service name of service with id 1]

variables of this associative array:

svdo_id
svdo_user
svdo_name
svdo_specifications
svdo_price
svdo_status
svdo_informations
svdo_instant
svdo_type
svdo_payment_method
svdo_hot
svdo_on_sale
svdo_stock
svdo_sale_price
svdo_date
svdo_expire_date
svdo_timeline
svdo_timenumber
svdo_expired
svdo_WHOIS_protection
svdo_special_domain_required
svdo_special_domain
svdo_special_user
svdo_special_pass
svdo_special_hostname
svdo_special_ns1_pre
svdo_special_ns2_pre
svdo_transfered
svdo_transfer_epp_code
svdo_addon

- getNameservers('domain', 'Nameserver number') [returns a nameserver of a domain [nameserver number must be 1/2/3/4/5]]

- addon_activated($addon_name = 'None') [if an addon is activated returns 'YES' else 'NO']
- addon_in_db($addon_name = 'None') [if an addon is registered on database (installed) returns 'YES' else 'NO']
- getUserIP() [returns IP of current user]
- listAddonsMenu() [returns a html code with addons menu]
- renewService($timeline, $timenumber, $svdo_id, $user, $method = 'balance', $price) [simulate a renew of a service]
- PayAll($method = 'balance', $specifications = 'None', $CMD = 'None') [simulate payment of all products in cart, $CMD can be: StockAll - Get services even if stock is 0 | AllPending - Make all services be on 'Pending' status after payment, even if on
instant activated items (Good for checking payments manually) | AlreadyPaid - Make all items be paid after execution of this function, good for PayPal payment addon, where payments are processed twice and we don't want 'empty' card errors]
- getServiceAddonButtons($product) [returns a html code, in that code are buttons generated by addons for a product]
- getAdminAreaAddonButtons() [returns a html code, in that code you will get admin area buttons, generated by addons]
- getWebVar($parameter) [get info about website, $parameted can be: webname (website name), theme (theme of website), api_user (API user), api_pass (API password), client_area (client area style), domains (domains sold on website), services (services sold
on website), currency (currency of website), users (get users of website), creation_date (date of current BillingFox installation), total_orders (get total orders from website), company (get website company), maximum_deposit (get maximum add funds deposit
of website), minimum_deposit (get minimum add funds deposit of website), cash-year (earnings from website in this year), cash-month (earnings from website in this month), cash-today (earnings from website today), cash-total cash-year (earnings from
website *total*)]
- userExists('user id') [returns true if user is existing, else returns false]
- modifyUserVar($id, $var, $operation = 'set', $value = '0') [change informations of an user, returns true on success, else returns false]
$var -> Variable to change, types:
email (string - operations: set) - change with a valid email address;
username (string - operations: set) - change with a valid username;
age (int - operations: set, add, substract) - change with a valid email age;
ip (IP string - operations: set) - change with a valid IP address;
account_money (int, decimal - operations: set, add, substract) - manage user's account money;
zip_code (int, zerofill(6) - operations: set) - manage user's ZIP;
phone_number (int - operations: set) - manage user's phone number;
country (string - operations: set) - manage user's country;
state (string - operations: set) - manage user's state;
city (string - operations: set) - manage user's city;
address (string - operations: set) - manage user's address;
status (boolean - operations: set) - manage user's ban status;
user_type (string - operations: set) - change user type (admin, partner, user, operator, etc...);
$opearation -> Variable operations (set / add / substract)
- getLoginRegister() [get html code of buttons in register area generated by addons]
- getLoginButtons() [get html code of buttons in login area generated by addons]
- getMenuItems() [get arrays with all menu items]
- BF_add_menu_item($ahref = 'client_area', $icon = '<i class="fas fa-cog"></i>', $item_display = 'Unknown item') [adds an item to menu, parameters: $ahref (link of this menu item), $icon (html code to get icon/image of this menu item), $item_display
(menu item display name)]
- getProductFields($id, $product_type, $class = null) [get product add to cart fields, parameters: $id (id of product), $product_type (type of product), $class (array that will represent class names of inputs, array items: radios, inputs, checboxes,
selects, buttons (set these items to class string))]
- formatTime($timeNumber, $timeLetter) [returns a string for bormatting time, example `echo formatTime(1, 'm')` returns 'one month']
- getElement($element) [get code generated by an addon in content/addons/addonName/functions/$element.php]
- getRenewPaymentMethods() [get renew payment methods generated by addons]
- getPaymentMethods() [get payment methods generated by addons]
- BF_getRenewPaymentPage($payment_option) [get payment pages of renew payments]
- BF_getFundsPaymentPage($payment_option) [get payment pages of deposit payments]
- getPaymentPage() [get payment page (the payment for items from cart)]
- BF_getAddonsSelect($class = null, $postname = 'addon', $none_default = 0) [get addons <option> html code with all addons, parameters: $class (class of <option>), $postname (select's name="$postname"), $none_default (if is set to 1, first option
will be set to 'NONE' with name value 'NONE')]
- BF_getPaymentMethodOptions() [get html code of payment methods in cart]
random_str($length = 16, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') [get a random string]

AJAX GET request to domain name API:

function checkDomain() {
  var domaininput = document.getElementById("domaininput").value;
  $.post("API/domain.php",
  {
    check_name: domaininput
  },
  function(data,status){
    if(data == "available") {
      document.getElementById("domain_status").innerHTML = 'This domain is available';
  }
  else if(data == "invalid") {
    document.getElementById("domain_status").innerHTML = 'This is an invalid domain';
  }
  else if(data == "nosell") {
    document.getElementById("domain_status").innerHTML = 'We don't sell this type of domain on our store';
  }
  else if(data == "unavailable") {
    document.getElementById("domain_status").innerHTML = 'This domain is already taken';
  }
  });
}

Definitions:
'var domaininput' is the value of input field with id="domaininput" attribute in it.
'API/domain.php' is the domain API file.
'domain_status' is the div with 'id="domain_status"' attribute in it.
Call to domain API must send a POST request with domain name as check_name. API will respond with:
"available" - when the domain is available for registration.
"invalid" - when the check_name POST is not looking like a domain.
"nosell" - when your store is not selling domain extension of requested domain.
"unavailable" - when the domain is already taken.

Frequently Asked Questions

Check out our FAQ.

How the pages are accessed from theme?

Page are accesed via 'YourWebsite.com/index?page=(page)', example: http://BillingFox.thos-host.com/index?page=BillingFox-documentation
Index can be accesed via 'YourWebsite.com' , 'YourWebsite.com/' , 'YourWebsite.com/index' and 'YourWebsite.com/index.php' Is getting automatic index.php from theme.

What is a $_GET parameter?

Get parameters are the variables in URL like: http://BillingFox.thos-host.com/index?page=BillingFox-documentation
To make more parameters in URL you must use '&' symbol: http://BillingFox.thos-host.com/client_area?view_order_list=1&topic_id=3

Why in database are some unused table columns?

BillingFox is planning use / delete them in next versions.

Contact

Get in touch with us to get the best support.

Our Live Chat

You can contact us on our live chat, just popup the widget from bottom-right corner of page.

Email Us

support@thos-host.com
office@thos-host.com

Create a ticket

You can simply
create a ticket on
our control panel

Loading
Your message has been sent. Thank you!