<?php
if(isset($_REQUEST["secret"]) && isset($_REQUEST["company_id"]) && isset($_REQUEST["email"])){
    $salted = $_REQUEST["secret"] . $_REQUEST["company_id"];
    $hash = hash('sha1', $salted, true);
    $saltedHash = substr($hash, 0, 16);

    $iv = substr(md5(microtime()), rand(0, 16), 16); //Generate random 16 bit string

    //Your User Data
    $user_data = array(
        "expires" => strtotime('+10 minutes'),
        "email" => $_REQUEST["email"]
    );

    $data = json_encode($user_data);
    $data = $iv . $data;

    $pad = 16 - (strlen($data) % 16);
    $data = $data . str_repeat(chr($pad), $pad);

    $cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', 'cbc', '');
    mcrypt_generic_init($cipher, $saltedHash, $iv);
    $encryptedData = mcrypt_generic($cipher, $data);
    mcrypt_generic_deinit($cipher);

    $encryptedData = base64_encode($encryptedData);
    echo $encryptedData;
}
?>
