Expand performance marketing, reach new audiences, and grow your business

Guide 🛡️ Protect your landing pages from direct access (script for Skro tracker)

RollerAds

dood

🚀
Staff Member
Community Leader
Joined
May 2, 2018
Messages
3,404
Last month I created and shared a script that can protect your landing pages from direct access if you use BeMob as a tracker. Since landing page protection is a paid feature in BeMob, I’ve decided to create a script that works with Skro tracker, since they offer that feature in their free plan.
1723451975630-png.54486


Skro also provides PHP and JS code, but I wanted to create a script that works with CloudFlare Pages.

Anyway, the PHP code looks like this:

Code:
     const PROTECTION_TOKEN =  ''; // Your landing protection token
     const KEY_TTL =  '30 minutes'; // How long KEY  should be valid. Valid formats are  explained here: http://php.net/manual/en/datetime.formats.php
     const KEY_GET_PARAM = 'key'; // GET  parameter with Skro landing key.
     $key = isset($_GET[KEY_GET_PARAM]) ?  rawurldecode($_GET[KEY_GET_PARAM]) : exit('Access denied');
     if (!$key = base64_decode($key)) {
          exit('Access denied');
     }
    if (!$key  = json_decode($key, true)) {
         exit('Access  denied');
    }
     if (!isset($key['timestamp']) || !isset($key['hash']))  {
         exit('Access denied');
     }
    $signedHash  = hash_hmac('sha1', $key['timestamp'], PROTECTION_TOKEN);
     if ($signedHash !== $key['hash'] ||  strtotime(KEY_TTL, $key['timestamp']) < time()) {
          exit('Access denied');
    }

You’ll need to create a Protection Token on this page.

Click on the Generate token button and save that token somewhere for later use.

UE7VMbHrmCzIEjnourCMKYLRZMexqbsd0fda-dgOrFd7i4KwdyF41_ChLMeSpkUjLvHpUTBk52Hgcg91HXmKreGfXjbFJ5IqnoE4UDGLpIQApACkoGdyeWbsMjL5ITi7UWFa9JVTnu2UX-WjJk-NqFo


When
 

Attachments

  • index.zip
    69 KB · Views: 106
Last edited:
To view the premium content in our affiliate marketing forum (including this awesome thread), you must first register and upgrade your account. Register today and become a part of our amazing community!
Top