Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.