Hi guys,
I need your help with my php script. On my script, I'm currently working with image where I can hot-link them from another website while it is on protected. when you click right-mouse button on firefox, you could see something like "view page source" which is disabled. when you click on "save page as", you can save the image as "image.php". when you open them, you would not be able to read due to the image but you can find the real image link in image.php where i want to protect them. 🙁
here's the currently code:
<?php
session_start();
define('DB_HOST', 'localhost');
define('DB_USER', 'myusername');
define('DB_PASSWORD', 'mypassword');
define('DB_DATABASE', 'mydbname');
$id = (int)$_GET['id'];
$errmsg_arr = array();
$errflag = false;
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
die('Failed to connect to server: ' . mysql_error());
}
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
die("Unable to select database");
}
function clean($var)
{
return mysql_real_escape_string(strip_tags($var));
}
$qrytable1="SELECT images FROM image_list WHERE id=$id";
$result1=mysql_query($qrytable1) or die('Error:<br />' . $qry . '<br />' . mysql_error());
while ($row = mysql_fetch_array($result1)) {
$image = $row['images'];
$details = getimagesize($image);
header ('Content-Type: ' . image_type_to_mime_type($details[2]));
echo readfile($image), "<p id='images'>", $row['images'] . "</p>";
}
?>
I guess that there must be a way to protected the url in the php script where i can hide them. It should be easy to modify but I am not sure what line I need to adjust to make it protected.
Can you please help me in what line I need to modify in order to protected the hot-linking in my php?