URL sign

Example of the script for signed URL generation

<?php
# link end of life , 3600 - lifetime in seconds                                                                                                             
$expire = time() + 3600;        

# file in CDN
$file = "1/2/3.mp4";
$url = ",end=$expire/$file";

# You can change speed and buffer setting in the URL,  by default settings are taken from account`s settings,
# or from domain`s settings
# http://wiki.ahcdn.com/doku.php?id=en:feature_default_settings
#$url = ",end=$expire/speed=300K/buffer=5.0/$file";

$domain = 'cdn.domain.com';    

$secret = 'qwerty'; # ask  CDN support about it 
$key = substr(base64_encode(md5("$secret$url", true)), 0, 22);
$key = str_replace('/', '-', $key); 
$fullurl = 'http://' . $domain . '/key=' . $key . $url;

# You will get link like 
# $fullurl == "http://cdn.domain.com/key=9CVHszhqqsA,end=1374068216/1/2/3.mp4" 
?>

You can specify list of IPs which will not be checked for URL sign ( 'keycheck_whitelist' setting ). Can be set via CDN support .