PHP Classes

File: exampleGenerateLink.php

Recommend this page to a friend!
  Classes of Andrey Lebedev   PHP Secure Link   exampleGenerateLink.php   Download  
File: exampleGenerateLink.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Secure Link
Generate and validate links with signed parameters
Author: By
Last change:
Date: 6 years ago
Size: 373 bytes
 

Contents

Class file image Download
<?php
require "SecureLink.php";
require
"exampleCommon.php";

$slink = new SecureLink(LINK_TEMPLATE, SIGN_TEMPLATE, SECRET, 3600);


$SERVER['REMOTE_ADDR'] = '127.0.1.8';

if (!
$slink->generate('/pm/20170320/1489995043_465442_371700.flv.mp4', $SERVER['REMOTE_ADDR'], MASK)) {
    echo
"Error: ".$slink->err()."\n";
    exit();
}
echo
"http://foobar.com".$slink->getLink()."\n";