Integrating our Offerwall in Faucet Scripts is easy .
public function flukelabs()
{
$secret = "secret";
$userId = isset($_GET['userId']) ? $this->db->escape_str($_GET['userId']) : null;
$transactionId = isset($_GET['txId']) ? $this->db->escape_str($_GET['txId']) : null;
$userAmount = isset($_GET['userAmount']) ? $this->db->escape_str($_GET['userAmount']) : null;
$type = isset($_GET['type']) ? $this->db->escape_str($_GET['type']) : null;
$userIp = isset($_GET['ip']) ? $this->db->escape_str($_GET['ip']) : "0.0.0.0";
$offerType = isset($_GET['offerType']) ? $this->db->escape_str($_GET['offerType']) : null;
$signature = isset($_GET['hash']) ? $this->db->escape_str($_GET['hash']) : null;
if (hash('sha256', $userId . $secret . $transactionId) != $signature) {
echo "signature error";
return;
die();
}
$reward = $userAmount * $this->data['settings']['currency_rate'];
$trans = $this->m_offerwall->getTransaction($transactionId, 'Flukelabs');
if ($type == 'chargeback') {
$this->m_offerwall->reduceUserBalance($userId, abs($reward));
$this->m_offerwall->insertTransaction($userId, 'Flukelabs', $userIp, $reward, $transactionId, 1, time());
echo "OK";
} else {
if (!$trans) {
$hold = 0;
$rewardHold = 0.5; //Hold reward threshold
if ($reward > $rewardHold) {
$hold = 3; // UPDATE HOLD DAYS
}
if ($hold == 0) {
$offerId = $this->m_offerwall->insertTransaction($userId, 'Flukelabs', $userIp, $reward, $transactionId, 2, time());
$this->m_offerwall->updateUserBalance($userId, $reward);
$this->m_core->addNotification($userId, currencyDisplay($reward, $this->data['settings']) . " from Flukelabs " . $offerType . " #" . $offerId . " was credited to your balance.", 1);
$user = $this->m_core->getUserFromId($userId);
$this->m_core->addExp($user['id'], $this->data['settings']['offerwall_exp_reward']);
if (($user['exp'] + $this->data['settings']['offerwall_exp_reward']) >= ($user['level'] + 1) * 100) {
$this->m_core->levelUp($user['id']);
}
} else {
$availableAt = time() + $hold * 86400;
$offerId = $this->m_offerwall->insertTransaction($userId, 'Flukelabs', $userIp, $reward, $transactionId, 0, $availableAt);
$this->m_core->addNotification($userId, "Your Flukelabs Offer #" . $offerId . " is pending approval.", 0);
}
echo "OK";
} else {
echo "duplicate";
}
}
public function flukelabs()
{
$this->data['page'] = 'Flukelabs Offerwall';
$this->data['iframe'] = '<iframe src="https://flukelabs.com/offerwallHome?partner={partnerName}&user_id=' . $this->data['user']['id'] . '" width="100%" style="min-height:500px"></iframe>';
$this->data['wait'] = 3;
$this->render('offerwall', $this->data);
}