Skip to content

Instantly share code, notes, and snippets.

@MasterEx
Created October 9, 2011 00:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save MasterEx/1273109 to your computer and use it in GitHub Desktop.
Save MasterEx/1273109 to your computer and use it in GitHub Desktop.
PHP - insert unique identifier to file - steganography
<?php
function sendfile($file,$identifier,$id_length) {
if (file_exists($file)) {
$filesize = filesize($file)+$id_length;
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . $filesize);
ob_clean();
flush();
readfile($file);
echo $identifier;
exit;
}
else {
echo "FILE NOT FOUND! :(";
}
}
sendfile("somefile","8digitid",8);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment