hi all, sorry if this is a little of topic but I hope some out there can give some help.

I have configured kannel for sending wap messages and works fine, but now I have another problem and would like to know if some one could give me a tip or hint for solving the following issue:

I am using WAP for sending jpg images, the images are stored out of the DocumentRoot and based on a php session and using the following code I send the image:

I send this to the phones: http://mysite.com/content.php? sid=12345678912345678912345678911100

where sid is the session_id generated when the phone request a content, and there on the session is stored the path of the image

Then content.php has something like this:

<?php
 session_id($_GET['sid']);
 session_start();

  $cache = $_SESSION['file'];
  $imginfo = getimagesize($cache);
  $content_length = filesize($cache);
  $mime = $imginfo['mime'];

  header('Content-Length: '.$content_length);
  header("Content-Type: $mime");
  header('Content-Disposition: attachment; filename="'.$cache.'"');
  readfile($cache);

?>

this code works when the images are lower than 10k but I started to notice that when the images are 10k the phone just can not download the image what I do in does cases, is to move the images to the DocumenRoot and use the following code:

<?php
 session_id($_GET['sid']);
 session_start();

$file_path = $_SESSION['file'];
header("Location: http://mysite.com/storage/images/$file";);

?>

This code just redirects the phone to the path where the content is inside the Documentroot , and the jpg image can now be downloaded with out any problem, but any other user can now later just copy the URL and fetch the content and that is what i want to avoid.


I would like to know if some one can give me an idea of how to secure the content and how could I send images larger than 10k using php functions maybe like readfile for geting the content that is out of the Documentroot.

Right now i am trying to figure how to use WML and php readfile(), hoping this could help me.


Regards.




Reply via email to