29th May 2015

Two Useful php Functions

Two Useful php Functions

Ensure that the user has access to a page with a query string.

The code below ensures that the user has a specific query string, this can be useful especially if you want to prevent robots crawling your site and potentially triggering a task page (e.g. an import).

The example below works on the assumption that the URL is similar to:

$keya = "369D1131-05F040E089B259E9A9CA7B64";
$keyb = $_GET["k"];

if ($keya == $keyb)

// your code which you want to run


// non valid users – redirect to the homepage header("Location: http://your-website/"); die();


Convert .NET ticks to php ticks

$tempTicks = $netTicks - 621355968000000000;
$phpTicks = $tempTicks / 10000000;
Fill in this quick form and discover your digital future
Choose your interests:

Where to find us

We'd love to welcome you into our office! We're only 20 miles north of Peterborough, conveniently just off the A16.

Carver House
Apex Court, Elsoms Way
PE11 3UL