Jump to content

Hiding a files name


VoodooJai

Recommended Posts

I am trying to hide a files name so that the source cannot be identified by others.

 

So far I have this which disguises the filename but wont show the image.

 

<?php
$secret = "asdflyu345iu2y35ui345";
$fileName = "picture.png";
$hash = md5($fileName . "|" . $secret);
$url = "images/adverts/$hash";

echo "Filename: ".$fileName."<br/>";
echo "The FileName hash: ".$hash."<br/><br/>";

echo "The URL: ".$url."<br/>";
echo "Hashed image shown here! <img src=".$url." width=\"99\" height=\"64\" \/>";
echo " and image should be this! <img src=\"images\/adverts\/picture.png\" width=\"99\" height=\"64\">";
?>

 

There is some debug code in there as well.

 

Many thanks in advance

 

VoodooJai

Link to comment
https://forums.phpfreaks.com/topic/201946-hiding-a-files-name/
Share on other sites

Having changed the extension to a valid one and found a few errors that were corrected the code now looks like this

 

<?php
$secret = "asdflyu345iu2y35ui345"; //choose your own
$fileName = "stock.jpg";
$hash = md5($fileName . "|" . $secret);
$url = "$hash";

echo "Filename: ".$fileName."<br/>";
echo "The FileName hash: ".$hash."<br/><br/>";

echo "The URL: ".$url."<br/>";
echo "Hashed image shown here!   <img src=\"Stockists/".$url." \" width=\"99\" height=\"64\">";
echo " and image should be this! <img src=\"Stockists/stock.jpg\" width=\"99\" height=\"64\">";
?>

 

the hidden filenames image does not still display.

 

VoodooJai

Link to comment
https://forums.phpfreaks.com/topic/201946-hiding-a-files-name/#findComment-1059141
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.