Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

generate_resource_access_key()

Parameters

ColumnTypeDefaultDescription
$resource
$userref
$access
$expires
$email
$group ""
$sharepwd ""

Location

include/resource_functions.php lines 5535 to 5549

Definition

 
function generate_resource_access_key($resource,$userref,$access,$expires,$email,$group="",$sharepwd="")
        {
        if(
checkperm("noex"))
            {
            
// Shouldn't ever happen, but catch in case not already checked
            
return false;
            }
                
        global 
$userref,$usergroup$scramble_key;
        if (
$group=="" || !checkperm("x")) {$group=$usergroup;} # Default to sharing with the permission of the current usergroup if not specified OR no access to alternative group selection.
        
$k=substr(md5(time()),0,10);
        
sql_query("insert into external_access_keys(resource,access_key,user,access,expires,email,date,usergroup,password_hash) values ('$resource','$k','$userref','$access'," . (($expires=="")?"null":"'" $expires "'"). ",'" escape_check($email) . "',now(),'$group'," . (($sharepwd != "" && $sharepwd != "(unchanged)") ? "'" hash('sha256'$k $sharepwd $scramble_key) . "'""null") . ");");
        
hook("generate_resource_access_key","",array($resource,$k,$userref,$email,$access,$expires,$group));
        return 
$k;
        }

This article was last updated 14th July 2020 04:35 Europe/London time based on the source file dated 13th July 2020 14:40 Europe/London time.