Hi there,
I have a problem. I am trying to use a simple php script to display a JPEG
from a "protected" catalog (the image files are out of the web tree). It's
called from an IMG tag, like this:
--- main file ---
<?php
session_start();
?>
<html>
...
<?php
session_register("imgname");
$HTTP_SESSION_VARS[imgname] = "something.jpg";
print "<img src=\"viewer.php?".session_name()."=".session_id()."\">";
?>
---
In viewer.php I use session_start() to resume the current session. However
this doesn't work at all. Is there any restriction for sessions when you
call the script like I'm doing?:
--- viewer.php --
<?php
session_start();
function LoadJPEG($imgname1) {
$im = @ImageCreateFromJPEG ($imgname1);
if (!$im) {
$im = ImageCreate (150, 30);
$bgc = ImageColorAllocate ($im, 255, 255, 255);
$tc = ImageColorAllocate ($im, 0, 0, 0);
ImageFilledRectangle ($im, 0, 0, 150, 30, $bgc);
ImageString($im, 1, 5, 5, "Error loading $imgname1", $tc);
}
return $im;
}
Header("Content-type: image/jpeg");
// here $HTTP_SESSION_VARS[imgname] is empty... :(
$im = LoadJPEG("/cat/$HTTP_SESSION_VARS[imgname]");
ImageJPEG($im);
ImageDestroy($im);
?>
---
Any help is appreciated.
Regards.
Rodolfo.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]