OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 21 Feb 2004 13:41:53 -0000 Issue 2603

php-general-digest-helplists.php.net
Date: Sat Feb 21 2004 - 07:41:53 CST


php-general Digest 21 Feb 2004 13:41:53 -0000 Issue 2603

Topics (messages 178419 through 178441):

CMS and images, how?
        178419 by: Toby Irmer

Re: Self Submitting Form
        178420 by: Toby Irmer
        178432 by: Sam Masiello
        178433 by: Tom Rogers
        178434 by: Toby Irmer

Upload and database
        178421 by: Will
        178425 by: electroteque

HELP PLEASE!
        178422 by: 3mip1s4la/Nath/Pisanty
        178430 by: Nitin Mehta

Error
        178423 by: Tim Trimble
        178424 by: John Nichel
        178427 by: John Nichel
        178428 by: Nitin Mehta
        178437 by: Jason Wong

HTML email problem: IMAP
        178426 by: Ryan A
        178429 by: Manuel Lemos

Slight cleaning of code needed in str_replace command.
        178431 by: Dave G
        178438 by: Jason Wong

Re: [PEAR] Re: PEAR DB 1.6.0 has been released
        178435 by: Lukas Smith

Re: undelivery mails
        178436 by: Jason Wong

delete a function
        178439 by: Sztankó Demeter

PHP Session question. Please help!
        178440 by: Bon

Simple example of expiring download pages?
        178441 by: Brian Dunning

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Hi there,

I am presently coding a little CMS. I want to give users the
possibility to add images to articles as easily and flexibly as
possible.

Does anyone have a recommendation on how to do it? So far, you can
upload an image which then is checked for its dimensions. If
necessary, the user is redirected to a flash tool that enables you to
resize the image (imagemagick), a given aspect ratio is kept. A thumb is created and those two files
are written to the database.

I also write the alignment to the database as chosen during upload. And I have a template
system that replaces tags like #img1# in a template with a table
to nicely display the images from the db.

The only problem is: how do I allow users to insert those images in
the text? If I work with a fixed template, the number of images in an
article is limited... I have thought about using buttons that you
could press while editing the text that would then capture the cursor
position in the textarea. But that would only work in IE and is not a
very nice solution...

Thank you for your suggestions...

toby

attached mail follows:


Hi Sam,

I am not sure I know what you want to do...

I tried to recreate your problem:

test.html

<form name="myform1" method="get" action="">
  <input type="hidden" name="myvar1" value="testing">
    <script>
                window.open("test2.html", "test");
    </script>
</form>

test2.html

<BODY onLoad="document.forms[0].submit();">
<form name="myform1" method="get" action="test3.html">
  <INPUT TYPE="hidden" NAME="do_preview" VALUE="1">
    <script>
      document.write('<INPUT TYPE="hidden" NAME="itworks" VALUE="'+opener.myform1.myvar1.value+'">');
    </script>
</FORM>
</BODY>

test3.html

<script language="Javascript">
        function parseQueryString (str)
        {
                str = str ? str : location.search;
                var query = str.charAt(0) == '?' ? str.substring(1) : str;
                var args = new Object();
                if (query)
                {
                var fields = query.split('&');
                        for (var f = 0; f < fields.length; f++)
                        {
                        var field = fields[f].split('=');
                        args[unescape(field[0].replace(/\+/g, ' '))] = unescape(field[1].replace(/\+/g, ' '));
                }
                }
                 return args;
        }

        var args = parseQueryString ();
        for (var arg in args)
        {
          document.write(arg + ': ' + args[arg] + '<BR>');
        }
</script>

And the output is:

do_preview: 1
itworks: testing

As should be expected...

Pls try to specify your problem.

toby

attached mail follows:


 
Hi Toby!
 
Thank you for your suggestion, but unfortunately you are using GET in your test2.html file. I specifically stated in my initial email that due to the fact that I am using textareas in my original form (your test1.html) that I did not want to use GET for it might run the risk of overstepping the bounds of how many characters the browser will accept in the GET string.
 
Any other suggestions that anyone else has would be most appreciated as I am still pretty stuck on this.
 
As always, thanks in advance!
 
--Sam
 
 

________________________________

From: Toby Irmer [mailto:phpirmer.com]
Sent: Fri 2/20/2004 6:07 PM
To: Sam Masiello
Cc: php-generallists.php.net
Subject: Re: [PHP] Self Submitting Form

Hi Sam,

I am not sure I know what you want to do...

I tried to recreate your problem:

test.html

<form name="myform1" method="get" action="">
  <input type="hidden" name="myvar1" value="testing">
    <script>
                window.open("test2.html", "test");
    </script>
</form>

test2.html

<BODY onLoad="document.forms[0].submit();">
<form name="myform1" method="get" action="test3.html">
  <INPUT TYPE="hidden" NAME="do_preview" VALUE="1">
    <script>
      document.write('<INPUT TYPE="hidden" NAME="itworks" VALUE="'+opener.myform1.myvar1.value+'">');
    </script>
</FORM>
</BODY>

test3.html

<script language="Javascript">
        function parseQueryString (str)
        {
                str = str ? str : location.search;
                var query = str.charAt(0) == '?' ? str.substring(1) : str;
                var args = new Object();
                if (query)
                {
                var fields = query.split('&');
                        for (var f = 0; f < fields.length; f++)
                        {
                        var field = fields[f].split('=');
                        args[unescape(field[0].replace(/\+/g, ' '))] = unescape(field[1].replace(/\+/g, ' '));
                }
                }
                 return args;
        }

        var args = parseQueryString ();
        for (var arg in args)
        {
          document.write(arg + ': ' + args[arg] + '<BR>');
        }
</script>

And the output is:

do_preview: 1
itworks: testing

As should be expected...

Pls try to specify your problem.

toby

attached mail follows:


Hi,

Saturday, February 21, 2004, 8:00:43 AM, you wrote:

SM> My apologies if this post is somewhat OT. I am having some trouble
SM> figuring something out, and I am hoping you can help.

SM> I have a PHP web form on which a user can enter a number of different
SM> things
SM> into both text and textarea fields. At the bottom of the form is a
SM> preview button which opens another browser window.
 
SM> I know I can use the GET string to pass these form fields from one
SM> PHP page to another, but with
SM> textareas involved and the possibly large amounts of text being
SM> passed, I didn't want to run the possibility of overrunning the limit
SM> on a GET string. So I figured using a form POST would be more
SM> appropriate.

SM> My thought was to create a self submitting form in the child window, but
SM> I am having
SM> trouble getting it to work (or maybe I should try a different method
SM> entirely to do this...any suggestion welcome!). My code for the
SM> preview window (which contains the self submitting form is as
SM> follows:

SM> <?
SM> if ($do_preview) {
SM> echo $myvar; exit;
SM> }
?>>
 
SM> <HTML>
SM> <HEAD>
SM> <TITLE></TITLE>
SM> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">

SM> </HEAD>
SM> <BODY onLoad="document.preview_form.submit()" BGCOLOR="#FFFFFF"
SM> TEXT="#000000" LINK="#000000"> <FORM NAME="preview_form" METHOD="post"
SM> ACTION="<? echo $PHP_SELF ?>">
SM> <INPUT TYPE="hidden" NAME="do_preview" VALUE="1">
SM> <script>
SM> document.write('<INPUT TYPE="hidden"
SM> NAME="myvar"VALUE="'+opener.myform1.myvar1.value+'">');
SM> </script>
SM> </FORM>
SM> </BODY>
SM> </HTML>

SM> (I also tried doing an eval within the VALUE attribute, but all that did
SM> was set myvar to the text that I had between the quotes :) )

SM> When I click the preview button on the parent window, I would like to
SM> see the value of the myvar1 variable when the form self
SM> submits...unfortunately, I get nothing. I know it is getting into my
SM> $do_preview block at the top, and I am accessing the variable
SM> correctly because if I do an alert(opener.myform1.myvar1.value), I
SM> get the proper value.

SM> Any thoughts would be greatly appreciated!
 
SM> --Sam

SM> --
SM> PHP General Mailing List (http://www.php.net/)
SM> To unsubscribe, visit: http://www.php.net/unsub.php

You need to use sessions to store the data between pages

--
regards,
Tom

attached mail follows:


Hi Sam,

I did that only because I was too lazy to upload and did the testing
locally so I could grab the value in Javascript.

Of course it works with post as well...

test.html

<form name="myform1" method="get" action="">
  <input type="hidden" name="myvar1" value="testing">
    <script>
                window.open("test2.html", "test");
    </script>
</form>

test2.html

<BODY onLoad="document.forms[0].submit();">
<form name="myform1" method="post" action="test.php">
  <INPUT TYPE="hidden" NAME="do_preview" VALUE="1">
    <script>
      document.write('<INPUT TYPE="hidden" NAME="itworks" VALUE="'+opener.myform1.myvar1.value+'">');
    </script>
</FORM>
</BODY>

test.php

<?
print_r($_POST);
?>

Outputs:

Array ( [do_preview] => 1 [itworks] => testing )

attached mail follows:


Hello all,
I tried to search the archives and PHP.NET and did not find anything or
I missed it

Anyway here is my question:
I want to upload 2 files to the database. Perferribly the whole image
into the data base (blob). I cannot figure it out.

When I check the database it is empty!! :(

Thanks in advance.

attached mail follows:


Make it easier on yourself just store the filename dude

-----Original Message-----
From: Will [mailto:scriptsreptilians.org]
Sent: Saturday, February 21, 2004 12:13 PM
To: PHP General
Subject: [PHP] Upload and database

Hello all,
I tried to search the archives and PHP.NET and did not find anything or
I missed it

Anyway here is my question:
I want to upload 2 files to the database. Perferribly the whole image
into the data base (blob). I cannot figure it out.

When I check the database it is empty!! :(

Thanks in advance.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


this is my first post, so please bear with me.

I'm developing a Mayan Oracle based on PHP and MySQL. the program and
database work perfectly, and do all I want them to. however, the thing
has a graphical interface that I built using Macromedia Fireworks and
Dreamweaver, with some images chaning along with other things, and
this is the part that's faulty.

the program checks whether a form has been filled. if not, it displays
the form. if it has, it then validates, and on a false shows the form
again. on a true, it does lots of processing and MySQL checking, and
then shows the output page.

both form pages along with the output page are included as different
files to facilitate graphical edition. all the snippets of actual
human language are included in another external file, to facilitate
addition of languages.

the form pages are both one page, form.php, which distinguishes
between first and second filling in case of invalid data. the output
page is called canvas.php, and right now I have canvas.php as
completely static, and canvas2.php with all the coding needed to
display properly. the main program, 01.php, does not send the client
any code in itself (just the included files in their entirety, alone).

THE PROBLEM: when I load the canvas.php page independently in
Firefox/Mozilla/Netscape and Explorer it displays perfectly. the
problem comes when I load this file through 01.php, and then it gets
rumbled up. I've seen this on most computers with
Firefox/Mozilla/netscape, and not on Explorer. what the hell? any hel
would be welcome.

I have http://200.39.201.43/hideout/project/final/01.php pointing to
the static canvas.php and
http://200.39.201.43/hideout/project/final/02.php pointing to the
dynamic canvas2.php

if you can sort this out I'll be eternally grateful. I'll post the
programs on request - they're quite large for mailing.

thanks in advance,

    3mip1s4la

The Official Dream Theater Site - http://www.dreamtheater.net/
___________________________________________________________
Get your own Web-based E-mail Service at http://www.zzn.com

attached mail follows:


look at the html code, this is no problem related to php, but the HTML.

Hope that helps
Nitin

----- Original Message -----
From: "3mip1s4la/Nath/Pisanty" <3mip1s4ladreamtheater.zzn.com>
To: <php-generallists.php.net>
Sent: Saturday, February 21, 2004 7:24 AM
Subject: [PHP] HELP PLEASE!

> this is my first post, so please bear with me.
>
> I'm developing a Mayan Oracle based on PHP and MySQL. the program and
> database work perfectly, and do all I want them to. however, the thing
> has a graphical interface that I built using Macromedia Fireworks and
> Dreamweaver, with some images chaning along with other things, and
> this is the part that's faulty.
>
> the program checks whether a form has been filled. if not, it displays
> the form. if it has, it then validates, and on a false shows the form
> again. on a true, it does lots of processing and MySQL checking, and
> then shows the output page.
>
> both form pages along with the output page are included as different
> files to facilitate graphical edition. all the snippets of actual
> human language are included in another external file, to facilitate
> addition of languages.
>
> the form pages are both one page, form.php, which distinguishes
> between first and second filling in case of invalid data. the output
> page is called canvas.php, and right now I have canvas.php as
> completely static, and canvas2.php with all the coding needed to
> display properly. the main program, 01.php, does not send the client
> any code in itself (just the included files in their entirety, alone).
>
> THE PROBLEM: when I load the canvas.php page independently in
> Firefox/Mozilla/Netscape and Explorer it displays perfectly. the
> problem comes when I load this file through 01.php, and then it gets
> rumbled up. I've seen this on most computers with
> Firefox/Mozilla/netscape, and not on Explorer. what the hell? any hel
> would be welcome.
>
> I have http://200.39.201.43/hideout/project/final/01.php pointing to
> the static canvas.php and
> http://200.39.201.43/hideout/project/final/02.php pointing to the
> dynamic canvas2.php
>
> if you can sort this out I'll be eternally grateful. I'll post the
> programs on request - they're quite large for mailing.
>
> thanks in advance,
>
> 3mip1s4la
>
> The Official Dream Theater Site - http://www.dreamtheater.net/
> ___________________________________________________________
> Get your own Web-based E-mail Service at http://www.zzn.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


     I'm stuck. I'm running a default copy of Redhat 7.2. with PHP - 4.0.6-7 and Mysql - 3.23.41-1 running on Apache - 1.3020-16. When I try to load a php page I get this error.

 Warning: Failed opening '/var/www/html/phpadmin/index.php' for inclusion (include_path='.:/php/include :/usr/share/php') in Unknown on line 0
 
 Can you direct me to a fix for this...
 
                                 Thanks...Tim Trimble

attached mail follows:


Tim Trimble wrote:

> I'm stuck. I'm running a default copy of Redhat 7.2. with PHP - 4.0.6-7 and Mysql - 3.23.41-1 running on Apache - 1.3020-16. When I try to load a php page I get this error.
>
>
> Warning: Failed opening '/var/www/html/phpadmin/index.php' for inclusion (include_path='.:/php/include :/usr/share/php') in Unknown on line 0
>
> Can you direct me to a fix for this...
>
> Thanks...Tim Trimble
>

Post some code as to what you're trying to open.

Does your webserver have read permission on the directory / file that
you're trying to open?

Please wrap your lines.

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

attached mail follows:


Please don't reply directly to me (or other members of the list) unless
asked to do so. When you reply off-list, the messages do not get
archived, and will not be searchable to those who may encounter the same
problem. Also, please don't post HTML formatted / multi-part messages.
  Plain text is better for everyone.

Tim Trimble wrote:
<snip>
> This is the page I want to open, it is the admin program for php. Right
> now it is set to
> low security "config"
> http://web.dsde.net/phpadmin/index.php

It does us no good to see the output of this. We need to see the code
which is causing the error. Post the code contained within 'index.php'

> The directory it's in is under the apache doc directory
> '/var/www/html/phpadmin/index.php'

What are the permissions on the directory and the file? Can your
webserver (which is probably running as nobody/nobody) read both the
directory and the file?

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

attached mail follows:


May be the cause is, that you've specified some include file with
include('somefile');

but the file doesn't exist in /usr/share/php dir, which is the default path
for include (.inc) files to be saved.

Hope that helps
Nitin

----- Original Message -----
From: "John Nichel" <jnichelby-tor.com>
To: "PHP List" <php-generallists.php.net>
Sent: Saturday, February 21, 2004 10:54 AM
Subject: Re: [PHP] Error

> Please don't reply directly to me (or other members of the list) unless
> asked to do so. When you reply off-list, the messages do not get
> archived, and will not be searchable to those who may encounter the same
> problem. Also, please don't post HTML formatted / multi-part messages.
> Plain text is better for everyone.
>
> Tim Trimble wrote:
> <snip>
> > This is the page I want to open, it is the admin program for php. Right
> > now it is set to
> > low security "config"
> > http://web.dsde.net/phpadmin/index.php
>
> It does us no good to see the output of this. We need to see the code
> which is causing the error. Post the code contained within 'index.php'
>
> > The directory it's in is under the apache doc directory
> > '/var/www/html/phpadmin/index.php'
>
> What are the permissions on the directory and the file? Can your
> webserver (which is probably running as nobody/nobody) read both the
> directory and the file?
>
> --
> By-Tor.com
> It's all about the Rush
> http://www.by-tor.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


On Saturday 21 February 2004 10:02, Tim Trimble wrote:

> Warning: Failed opening '/var/www/html/phpadmin/index.php' for inclusion
> (include_path='.:/php/include :/usr/share/php') in Unknown on line 0
>
> Can you direct me to a fix for this...

Look at php.ini and check the settings for the auto_prepend_file. If it is
set, check that the file exists.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Woman's advice has little value, but he who won't take it is a fool.
                -- Cervantes
*/

attached mail follows:


Hi,
I downloaded a class from php classes called "clssendmail", the class was
working on a different server
but now I get this error when I try to use it:
"Call to undefined function: imap_8bit() in............."

The class is basically to send an email in 2 parts, plain text and HTML...if
the person has html off or cannot view html email then the plain text one
will display else the HTML part will display.

After googleing I see that sometimes PHP is not compiled with Imap_8bit
which causes this problem...:-(

This is the troublesome part:

///////
 function addHtmlBodyPart($html) {
  $this->bodyParts["text/html"]="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML
4.0 Transitional//EN\">\n<html><head><meta http-equiv=Content-Type
content=\"text/html; charset=iso-8859-1\"><META content=\"MSHTML
6.00.2800.1276\"
name=GENERATOR></head><body>".imap_8bit($html)."</body></html>";
}
/////

Any work around to this problem or any idea of another class that does what
this is supposed to do and will work
on all servers? I also downloaded manuel lemos collection of mime classes
but thats toooo damn powerful for my
little task..couldnt understand half of what was in there.

Any help appreciated.

Cheers.
-Ryan

attached mail follows:


Hello,

On 02/21/2004 01:39 AM, Ryan A wrote:
> I downloaded a class from php classes called "clssendmail", the class was
> working on a different server
> but now I get this error when I try to use it:
> "Call to undefined function: imap_8bit() in............."
>
> The class is basically to send an email in 2 parts, plain text and HTML...if
> the person has html off or cannot view html email then the plain text one
> will display else the HTML part will display.
>
> After googleing I see that sometimes PHP is not compiled with Imap_8bit
> which causes this problem...:-(

Yes, IMAP extension is optional but fortunately it is not necessary for
what you want.

Just try this other class that comes with an example to do exactly what
you want. Check the HTML message example as it explains how to compose
and send a message with an HTML part and an alternative text part. It
may also embed any images or attachment files if you want:

http://www.phpclasses.org/mimemessage

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

attached mail follows:


PHP listers,
        I recently got some help here to fix a str_replace() command.
The string works, and the output from the browser looks right. However,
I would like to further tweak the code so that the HTML source is also a
little cleaner than it is now.
        The code in question is this:
$charInfoCss = "<p class=\"content\">" . str_replace("\n", "</p>\n<p
class=\"content\">", $charInfo[introE]) . "</p>";
echo $charInfoCss . "\n";

        The way this outputs to the HTML source is like this:
<p class="content">blah blah blah blah
</p>
<p class="content">blah blah blah blah
</p>
<p class="content">blah blah blah blah
</p>

        Shouldn't the syntax that I have place the new line *after* the
</p> tag? I'm trying to get it to look like this:
<p class="content">blah blah blah blah</p>
<p class="content">blah blah blah blah</p>
<p class="content">blah blah blah blah</p>

Any advice would be most welcome.

--
Yoroshiku!
Dave G
mlautotelic.com

attached mail follows:


On Saturday 21 February 2004 14:39, Dave G wrote:

> Any advice would be most welcome.

Well, you asked for it. The usage of str_replace() is not exactly rocket
science, since the output is not what you expected just juggle your search &
replacement strings until it does what you want.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
At the end of your life there'll be a good rest, and no further activities
are scheduled.
*/

attached mail follows:


Justin Patrin wrote:

> I think you're confusing the issue. PEAR DB does support many databases,
> but it only loads the code for the ones that you are currently using. So
> if you're using one database it is effectively a one database API.
>
> Jakes wrote:
>
>> What is performance like using this class? I've gone through the class
>> and
>> it just seams to be over kill, for a DB API (13 databases).
>>
>> Are there any time stats showing the different time in using a single
>> DB API
>> class to the PEAR class.

Yes things are really not that bad. However expect to give up somewhere
a fairly significant amount of performance. If you are using an
abstraction layer you have to do it with a good reason (you need to
support multiple databases mainly :-) ).

Here is a benchmark John Lim came up with:
http://phplens.com/lens/adodb/

It only tests MySQL though and it implements a very unrealistic
scenario. The reason that ADODB scores so high can be read here:
http://marc.theaimsgroup.com/?l=pear-dev&m=100793507904834&w=2

regards,
Lukas Smith
smithbackendmedia.com
_______________________________
   BackendMedia
   www.backendmedia.com
   berlinbackendmedia.com

   Linn Zwoch Smith GbR
   Pariser Str. 44
   D-10707 Berlin

   Tel +49 30 83 22 50 00
   Fax +49 30 83 22 50 07

attached mail follows:


On Saturday 21 February 2004 01:41, Ryan A wrote:

> If you are sending out html mails you can learn a lesson from the low life
> bastard spammers, but in
> your case for a good cause (i hope),
> Write a script so that each email has a unique identifier as spedified in
> the database and from the email
> your script is called...(eg: via a img (src) tag )...after maybe 5 days of
> the person not viewing your email
> take them out of the db...this can be run via a cron.

This will only work if the mail client does not have an option to turn off
external downloads/links when viewing html mail. So the above method will
unsubscribe all your smart users leaving behind the dumb ones!

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Do you think that illiterate people get the full effect of alphabet soup?
*/

attached mail follows:


Hello!

Is there any way to delete (unset) a function?

I want to write some function with one constantyl defined name, then call a
function_manager function, that will gice this function an unique name, than
delete the original function, so I can start the process from the beginning.

I will call this function through a wrapper, which will find the function I
need.

Thanks
Dimi.

attached mail follows:


Hi, I've got a session problem that I don't understand.

Here's the setup. There are 2 frames, frame1 and frame2 (within frame1).

Frame1 is simply a static html page like the following:

<frameset rows="0,*" frameborder="NO" border="0" framespacing="0">
  <frame src="http://mysite.ca/blank.html" name="topFrame" scrolling="NO"
noresize >
  <frame src="http://mysite.ca/getPage.php?siteid=33&page=homepage"
name="mainFrame">
</frameset>

Frame 2 is the php file, namely getPage.php. In this php file, it starts
the session and does some initialization to set the session variables. The
php code is executed before any HTML code is outputted. So the session
variables have been all set. It looks something like this:

<frameset rows="0,*" frameborder="NO" border="0" framespacing="0">
  <frame src="blank.html" name="topFrame" scrolling="NO" noresize >
  <frame src="<?=$mypage;?>?mode=view" name="mainFrame">
</frameset>

so $mypage is actually a dynamic string to another PHP page.

The problem is, this $mypage that frame2 opens depends on the session
variables that I've set at the beginning of frame2. And I realized that the
session id of $mypage is not the same as that of frame2. So the variables
will not load. So if i call up frame1 on the browser, $mypage will not get
the session variables of frame2.

The funny thing is that if i simply load up the url
http://mysite.ca/getPage.php?siteid=33&page=homepage, i.e. the URL of
frame2, $mypage actually DOES get those variables and have the same session
id.

Although I've solved the problem using a hacked method (passing the session
id to $mypage using GET), I'm wondering if there's anything wrong with the
setup that causes the diverse outcomes.

Thanks for any kind of response.

Chris

attached mail follows:


Hi, I'm building a very simple online store and I need expiring
download pages for people to download the items they purchased.
Surprisingly, I couldn't find an example of this code online.

I know how to do it in Lasso, and it's quite easy. You just search the
database against download attempts or expiration time/date, and if it
succeeds, return this (it's Lasso code but you get the idea):

[Output_None]
[Var: 'file' = (Include_Raw: 'pathname/sourcefile.zip')]
[Var: 'filename' = 'product.pdf']
[Var: 'content_type' = 'application/pdf']
[Header]
   HTTP/1.0 200 OK
   Server: Lasso/6.0
   Content-Type: [$content_type]
   Content-Length: [$file->Length]
   Content-Disposition: attachment; filename="[$filename]"
[/Header]
[/Output_None][$file]

Can anyone suggest the PHP code for this?