01-17-2001, 05:57 AM
Hello,
I recently found out that people could use my server as a file server for their custom avatars. I wnated to add a refferer to it so that the pic.php script would only output the correct image if it was called from my site...if not I want it to post a broken image to save on bandwidth.
I can't use the mod_rewrite thing that Eva2000 suggested on this because the custom avatars are stored in the database.
I have over 10,000 members and I know for a fact that many of them do this.
Can someone please help me to write the refferer code into the pic.php code below:
<?php
require("global.php");
if (isset($id) && $id != "")
{
$temp = $id;
settype($temp,"integer");
if (strval($temp) == $id)
{
$image = $DB_site->query_first("SELECT filename,bin_data,filetype from custom_avatar where userid = $id");
}
}
if($image)
{
$filename = $image[filename];
$data = $image[bin_data];
$type = $image[filetype];
Header ( "Content-disposition: filename=".$filename);
Header("Content-type: $type");
echo $data;
}
?>
Here is the output of http://forums.paintballcity.net/pic.php?id=8077
http://forums.paintballcity.net/pic.php?id=8077
Thanks. :)
I recently found out that people could use my server as a file server for their custom avatars. I wnated to add a refferer to it so that the pic.php script would only output the correct image if it was called from my site...if not I want it to post a broken image to save on bandwidth.
I can't use the mod_rewrite thing that Eva2000 suggested on this because the custom avatars are stored in the database.
I have over 10,000 members and I know for a fact that many of them do this.
Can someone please help me to write the refferer code into the pic.php code below:
<?php
require("global.php");
if (isset($id) && $id != "")
{
$temp = $id;
settype($temp,"integer");
if (strval($temp) == $id)
{
$image = $DB_site->query_first("SELECT filename,bin_data,filetype from custom_avatar where userid = $id");
}
}
if($image)
{
$filename = $image[filename];
$data = $image[bin_data];
$type = $image[filetype];
Header ( "Content-disposition: filename=".$filename);
Header("Content-type: $type");
echo $data;
}
?>
Here is the output of http://forums.paintballcity.net/pic.php?id=8077
http://forums.paintballcity.net/pic.php?id=8077
Thanks. :)