Jump to content

<img src> small question


robert_gsfame

Recommended Posts

I wouldnt consider it dangerous unless you dont want people to hotlink your images.

 

but you can stop hotlinking with:

 

<img src="image.php?myfile=image1.jpg">

 

 

<?php
session_start();
$ticket = "accepted";
session_register($_SESSION["ticket"]);

$path="./myuploadfolder/"; // Path to protected directory
$mimetype ="image/jpeg"; // Mime type of the file

// Check to see if the visitor has the right ticket
if ( $_SESSION["ticket"] == "accepted" ) {
Header("Content-type: ");
readfile ( $path . $myfile );
}

?>


 

 

Link to comment
https://forums.phpfreaks.com/topic/233272-small-question/#findComment-1199675
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.