HEX
Server: Apache
System: Linux msm5694.mjhst.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: camjab_ssh (1000)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: /home/httpd/html/baretube.com.new/admin/functions.hashing.php
<?php

/*
NGINX CONFIGURATION
-------------------
Goes into server {...} for appropriate vhost after server_name. Please make sure to change YOURSECRETKEYGOESHERE. Restart Nginx.
 
location ~* .(mp4)$ {
    secure_link $arg_md5,$arg_expires;
    secure_link_md5 "$secure_link_expires YOURSECRETKEYGOESHERE";
    if ($secure_link = "") {  return 403; }
    if ($secure_link = "0") { return 410; }
}
*/



/**
 *  nginxSecureLink - Generates secure link for nginx
 *  
 *  @param [in] $array array with content data
 *  @return string
 *  
 */
function nginxSecureLink($array) {
	global $hashKey;
	global $hashTime; 
	if(!$hashTime) { $hashTime = 1800; }
	$rrow = $array[0];    
	$filename = $array[1];
	if($rrow[server]) { 
		$server = dbQuery("SELECT * FROM servers WHERE record_num = $rrow[server]");
		$server = $server[0];
		$video_url = $server['url_path'];
	} else { 
		$server['hash_key'] = $hashKey; 
	}
    $subdir = $rrow[filename][0] . '/' . $rrow[filename][1] . '/' . $rrow[filename][2] . '/' . $rrow[filename][3] . '/' . $rrow[filename][4] . '/';
    $output = $video_url . '/' . $subdir . $rrow[$filename];
    $expires = time()+1800;
    $md5hash = trim(shell_exec("echo -n '".$expires.$_SERVER['REMOTE_ADDR']." $server[hash_key]' | openssl md5 -binary | openssl base64 | tr +/ -_ | tr -d ="));
    return $output."?md5=$md5hash&expires=$expires";
}