My Affiliate Account

Balance: $675.93

Reffered Accounts

Account NameLorem ipsum dolor sit amet

Account NameLorem ipsum dolor sit amet

Account NameLorem ipsum dolor sit amet

Account NameLorem ipsum dolor sit amet

Account NameLorem ipsum dolor sit amet

Transactions

Transaction Name05 Nov. 2019

$25000

Transaction Name05 Nov. 2019

$25000

Transaction Name05 Nov. 2019

$25000

Transaction Name05 Nov. 2019

$25000

Transaction Name05 Nov. 2019

$25000

Transaction Name05 Nov. 2019

$25000

Payments

Payment Name05 Nov. 2019

$12500

Payment Name05 Nov. 2019

$12500

Payment Name05 Nov. 2019

$12500

Payment Name05 Nov. 2019

$12500

Payment Name05 Nov. 2019

$12500

Payment Name05 Nov. 2019

$12500

Create accounts from your own website or application using our API.

POST these variables to create a new account:

external // must be set to "helponclick"
type // must be set to "affiliate"
key // your affiliate key, "642e92efb79421734881b53e1e1b18b6"
first_name // customer first name
last_name // customer last name
email // main email address, will be used for administrator login, must be unique
password // main password
website // valid website adderss to be used, format: http://www.example.com
seats // number of seats, values 1-100
lang // (optional) Language, short code. Find accepted values here: https://www.helponclick.com/translate.php
title // (optional) Title text. Could be used for branding as company name. Example: "Operator Panel"
theme // (optional) Theme color. possible values: 'blue','green','orange','pink','red','teal','dark_blue',
//'dark_green','dark_orange', 'dark_pink','dark_red','dark_teal','light_blue','light_green','light_grey','light_teal'

URL: http://clients.helponclick.com/post.php return value: "ok" on success, otherwise error message
                    

PHP class

Example of use:

                        
                        <?php
$hoc 
= new hoc();
//////////////////// creating a new account
if($hoc->create_account("John""Smith""john@example.com""12345""http://www.example.com"3"en""My Company""dark_blue"))
  echo 
"success";
else
  echo 
$hoc->error;
?>
                        
                        <?php
/*
Example of use:
$hoc = new hoc();
if($hoc->create_account("John", "Smith", "john@example.com", "12345", "http://www.example.com", 3, "en", "My Company", "dark_blue"))
    echo "success";
else
    echo $hoc->error;
*/
class hoc {
  var 
$key;
  var 
$post_url;
  var 
$type;
  var 
$error "";
  var 
$arr_themes = array('blue','green','orange','pink','red','teal','dark_blue','dark_green','dark_orange','dark_pink','dark_red','dark_teal','light_blue','light_green','light_grey','light_teal');
  function 
hoc($key "642e92efb79421734881b53e1e1b18b6"$post_url "http://clients.helponclick.com/post.php"$type "affiliate")
  {
    
$this->key $key;
    
$this->post_url $post_url;
    
$this->type $type;
  }
  
/**
   * @name create_account
   * @desc create accounts
   * @param string $customer_first_name  customer first name. Required
   * @param string $customer_last_name   customer last name. Required
   * @param string $email                email (unique, used for login). Required
   * @param string $password             password (used for login). Required
   * @param string $website              website address. Required
   * @param integer $seats               number of seats, values 1-100
   * @param string $lang                 Language, short code. Find accepted values here: http://www.helponclick.com/translate.php
   * @param string $title                Title text. Could be used for branding as company name
   * @param string $theme                Theme color. possible values: 'blue','green','orange','pink','red','teal','dark_blue','dark_green','dark_orange','dark_pink','dark_red','dark_teal','light_blue','light_green','light_grey','light_teal'
   * @return true on suucess and false on error
   */
  
function create_account($customer_first_name$customer_last_name$email$password$website$seats=1$lang="en"$title="Operator Panel"$theme="dark_blue")
  {
    if(
$this->_is_empty($customer_first_name) || $this->_is_empty($customer_last_name))
    {
      
$this->error "Customer name is missing";
      return 
false;
    }
    if(!
$this->_is_email($email))
    {
      
$this->error "Invalid email address";
      return 
false;
    }
    if(
$this->_is_empty($password))
    {
      
$this->error "Password is missing";
      return 
false;
    }
    if(!
$this->_is_valid_url($website))
    {
      
$this->error "Invalid website address";
      return 
false;
    }
    if(
intval($seats)==0)
    {
      
$this->error "Invalid Seats";
      return 
false;
    }
    
$theme in_array($theme,$this->arr_themes)?$theme:null;
    
$data = array(
      
'external' => 'helponclick',
      
'type' => $this->type,
      
'key' => $this->key,
      
'first_name' => $customer_first_name,
      
'last_name' => $customer_last_name,
      
'email' => $email,
      
'password' => $password,
      
'website' => $website,
      
'seats' => $seats,
      
'lang' => $lang,
      
'title' => $title,
      
'theme' => $theme
    
);
    
$response $this->_post_curl($this->post_url$data);
    if(
$response=="ok")
    {
      return 
true;
    }
    else
    {
      
$this->error $response;
      return 
false;
    }
  }
  
/**
   * @name get_login_form_html
   * @desc HTML for login form to place on your website
   * @param string $logout_to  where should operators log out to? Optional
   * @param string $email      email address. Optional
   * @param string $password   password. Optional
   * @return string HTML code
   */
  
function get_login_form_html($logout_to=""$email=""$password="")
  {
    
$current_url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
    
$logout_to $logout_to!=""&&$this->_is_valid_url($logout_to)?$logout_to:$current_url;
    
$html =
      
"<form id='hoc_login' name='hoc_login' action='//app.helponclick.com/login' target='_top' method='post'>
            <input type='hidden' name='logout_to' value='
{$logout_to}' />
            Email: <input type='text' name='email' value='
{$email}' /><br />
            Password: <input type='text' name='password' value='
{$password}' /><br />
            <input type='submit' name='submit' value='Login' />
            </form>"
;
    return 
$html;
  }
  private function 
_post_curl($url$arr_fields$port=80)
  {
    
$curl_handle curl_init();
    
curl_setopt($curl_handleCURLOPT_URL$url);
    
curl_setopt($curl_handleCURLOPT_PORT $port);
    
curl_setopt($curl_handleCURLOPT_HEADERfalse);
    
curl_setopt($curl_handleCURLOPT_RETURNTRANSFERtrue);
    
curl_setopt($curl_handleCURLOPT_POSTtrue);
    
curl_setopt($curl_handleCURLOPT_POSTFIELDS$arr_fields);
    
$data curl_exec($curl_handle);
    
curl_close($curl_handle);
    return 
$data;
  }
  private function 
_is_empty($value){
    if(
strlen(trim($value))==|| trim($value)=="")
      return 
true;
    else
      return 
false;
  }
  private function 
_is_email($value)
  {
    if(!
$this->_is_empty($value))
    {
      if(!
preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,}$/i"$value))
        return 
false;
      else
        return 
true;
    }
    elseif(
$this->_is_empty($value))
      return 
false;
  }
  private function 
_is_valid_url($url)
  {
    return 
preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i'$url);
  }
}
?>