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 13 Oct 2004 07:08:50 -0000 Issue 3050

php-general-digest-helplists.php.net
Date: Wed Oct 13 2004 - 02:08:50 CDT


php-general Digest 13 Oct 2004 07:08:50 -0000 Issue 3050

Topics (messages 199268 through 199341):

Re: creating a folder in php
        199268 by: Jay Blanchard
        199269 by: John Nichel
        199270 by: Ben Ramsey
        199271 by: Dan Joseph
        199272 by: Jay Blanchard
        199273 by: Matthew Sims
        199274 by: Greg Donald
        199275 by: Pablo Gosse
        199276 by: Adil
        199277 by: Ben Ramsey
        199279 by: PHP Junkie
        199284 by: ApexEleven
        199286 by: Jason Wong
        199287 by: Matthew Sims
        199290 by: Greg Donald
        199291 by: Ben Ramsey

Re: [PHP-DB] folder creation in php
        199278 by: Gryffyn, Trevor
        199280 by: Ben Ramsey
        199292 by: Gryffyn, Trevor

Are server classes possible?
        199281 by: Jed R. Brubaker
        199288 by: Adrian Madrid
        199321 by: Manuel Lemos

PEAR status on PHP5?
        199282 by: Adrian Madrid
        199283 by: Greg Beaver

Re: Remote grabbed images are blank
        199285 by: Jason Wong
        199294 by: Rick Fletcher
        199307 by: Mag

Re: php and print
        199289 by: Harlequin
        199296 by: Jason Wong
        199297 by: Greg Donald

general organization question
        199293 by: lists
        199299 by: Robert Cummings
        199301 by: Greg Donald
        199306 by: lists
        199310 by: Greg Donald
        199314 by: Robert Cummings
        199323 by: Michal Migurski
        199330 by: Matthew Weier O'Phinney
        199331 by: Matthew Weier O'Phinney
        199332 by: lists
        199333 by: lists

Tutorials for Maintenance of State
        199295 by: GH
        199298 by: Chris Shiflett
        199300 by: Jay Blanchard
        199302 by: Greg Donald
        199336 by: GH

Exporting HTML to Excel
        199303 by: Philip Thompson
        199304 by: M. Sokolewicz
        199308 by: Graham Cossey
        199309 by: Vail, Warren

Re: fpassthru failure with mozilla
        199305 by: Jordi Canals
        199311 by: Marek Kilimajer
        199313 by: Jordi Canals
        199318 by: Jason Wong

PHP_SELF & SCRIPT_NAME differences
        199312 by: Jordi Canals
        199315 by: John Holmes
        199317 by: Curt Zirzow

Re: How to implement mass emailing?
        199316 by: Marco Tabini
        199320 by: Manuel Lemos

How do I do italics on a text string in an image?
        199319 by: Brent Clements
        199324 by: Jason Wong
        199327 by: Brent Clements

Subdomains pointing to index.php?Page=Contacts
        199322 by: M Saleh EG
        199326 by: Jason Wong

Sessions and Mozilla (Firefox)
        199325 by: Pablo Gosse
        199328 by: Matthew Weier O'Phinney
        199329 by: Robby Russell
        199338 by: Chris Shiflett

php4 objects
        199334 by: Robby Russell
        199335 by: Chris

Unsubscribe.
        199337 by: The Snake from Hell!

PHP Class
        199339 by: Mulley, Nikhil
        199340 by: Brent Clements

Help Me Understand PHP5, register_globals=off, $HTTP_POST_VARS, and $_POST
        199341 by: Francis Chang

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:


[snip]
Here's what i'm trying to do in php and using a mySQL database:

I want a button on a page that if clicked it launches the browser's or
OS's
"Save As" window, allowing me to specify where to save my file and/or
create
a new folder. This needs to work on Mac and PC.
[/snip]

I want an IDE that will let me speak code into it. Anyone else want
anything?

Seriously, a little Googling here would help. Start here
http://www.php.net/header

attached mail follows:


Jay Blanchard wrote:
> [snip]
> Here's what i'm trying to do in php and using a mySQL database:
>
> I want a button on a page that if clicked it launches the browser's or
> OS's
> "Save As" window, allowing me to specify where to save my file and/or
> create
> a new folder. This needs to work on Mac and PC.
> [/snip]
>
> I want an IDE that will let me speak code into it. Anyone else want
> anything?

I have a plastic cup that you can speak into...will that work? Reverse
the polarity of the number 4 and number 6 wires on your ethernet
connection, and I'll cpt (cup transfer protocol) it to you.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


Adil wrote:
> I want a button on a page that if clicked it launches the browser's or OS's
> "Save As" window, allowing me to specify where to save my file and/or create
> a new folder. This needs to work on Mac and PC.

Take a look at the header() function: http://us2.php.net/header
Specifically, read the part about the Content-Disposition header.

--
Regards,
Ben Ramsey
http://benramsey.com

attached mail follows:


> > I want an IDE that will let me speak code into it. Anyone else want
> > anything?
>
> I have a plastic cup that you can speak into...will that work? Reverse
> the polarity of the number 4 and number 6 wires on your ethernet
> connection, and I'll cpt (cup transfer protocol) it to you.

Does it have a good debugger?

-Dan Joseph

attached mail follows:


[snip]
I have a plastic cup that you can speak into...will that work? Reverse
the polarity of the number 4 and number 6 wires on your ethernet
connection, and I'll cpt (cup transfer protocol) it to you.
[/snip]

Is that with or without ice?

attached mail follows:


> Here's what i'm trying to do in php and using a mySQL database:
>
> I want a button on a page that if clicked it launches the browser's or
> OS's
> "Save As" window, allowing me to specify where to save my file and/or
> create
> a new folder. This needs to work on Mac and PC.
>
> thx in advance
> Adil..
>

What's wrong with:

<form method="post" action="thispage.php">
<input type="file" name="filename_whatever">
<input type="submit" name="submitFile" value="Submit">
</form>

This isn't even PHP.

--
--Matthew Sims
--<http://killermookie.org>

attached mail follows:


On Tue, 12 Oct 2004 13:35:13 -0500, Jay Blanchard
<jay.blanchardniicommunications.com> wrote:
> I want an IDE that will let me speak code into it. Anyone else want
> anything?

I'd like a clone of myself to do my 9-5 x 5 for me.

Oh yeah, and a bag of cheetos. Thanks.

--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

attached mail follows:


Jay Blanchard wrote:
[snip]
> I want an IDE that will let me speak code into it. Anyone else want
> anything?
[/snip]

Laetitia Casta?

Email me off list to get delivery instructions.

Thanks,
Pablo

attached mail follows:


man, you guys are harsh. I didn't want a code sample or anything. Just a
pointer in the right direction, hehe. I've done a lot of looking into this
and couldn't come up with the right results. I can easily specify a folder
and submit it and have a php script do whatever but what I'm looking for is
really to force any browser to display the save as dialog box or another
example would be a "create folder" button that when clicked is able to
launch a dialog box where you can traverse through the directory structure
and create a folder.

I'll look into the content-disposition item in the "header" and see if that
helps.

thx again
Adil.

"Jay Blanchard" <jay.blanchardniicommunications.com> wrote in message
news:C8F323573C030A448F3E5A2B6FE2070B03522B58nemesis...
[snip]
Here's what i'm trying to do in php and using a mySQL database:

I want a button on a page that if clicked it launches the browser's or
OS's
"Save As" window, allowing me to specify where to save my file and/or
create
a new folder. This needs to work on Mac and PC.
[/snip]

I want an IDE that will let me speak code into it. Anyone else want
anything?

Seriously, a little Googling here would help. Start here
http://www.php.net/header

attached mail follows:


Matthew Sims wrote:
>>Here's what i'm trying to do in php and using a mySQL database:
>>
>>I want a button on a page that if clicked it launches the browser's or
>>OS's
>>"Save As" window, allowing me to specify where to save my file and/or
>>create
>>a new folder. This needs to work on Mac and PC.
>>
>>thx in advance
>>Adil..
>>
>
>
> What's wrong with:
>
> <form method="post" action="thispage.php">
> <input type="file" name="filename_whatever">
> <input type="submit" name="submitFile" value="Submit">
> </form>
>
> This isn't even PHP.
>

Because the OP is asking for how to have it prompt the user where to
save a (assumingly downloaded) file--not how to choose a file to upload.

--
Regards,
Ben Ramsey
http://benramsey.com

attached mail follows:


>> I want an IDE that will let me speak code into it. Anyone else want
>> anything?

Oh.. I'd like a flat-screen monitor that would interpret the program that I
have in my mind, generate the code for it on screen, save it and run the
program everytime I say "KaBoom".

I'd like a side-order of that IDE that will let me speak code into it as
well..

And a bag of Spicier Doritos!! Can't get enough of those.

Thanks,
Junkie

On 10/12/04 2:48 PM, "Greg Donald" <destineygmail.com> wrote:

> On Tue, 12 Oct 2004 13:35:13 -0500, Jay Blanchard
> <jay.blanchardniicommunications.com> wrote:
>> I want an IDE that will let me speak code into it. Anyone else want
>> anything?
>
> I'd like a clone of myself to do my 9-5 x 5 for me.
>
> Oh yeah, and a bag of cheetos. Thanks.
>

attached mail follows:


ok dudes, we understand, as much fun as I have downloading and reading
your awsome requests, lets just stop beating the horse, it's bee dead
for quite a while now...

On Tue, 12 Oct 2004 15:02:19 -0400, PHP Junkie <phpjunkiemjimm.com> wrote:
>
> >> I want an IDE that will let me speak code into it. Anyone else want
> >> anything?
>
> Oh.. I'd like a flat-screen monitor that would interpret the program that I
> have in my mind, generate the code for it on screen, save it and run the
> program everytime I say "KaBoom".
>
> I'd like a side-order of that IDE that will let me speak code into it as
> well..
>
> And a bag of Spicier Doritos!! Can't get enough of those.
>
> Thanks,
> Junkie
>
>
>
>
> On 10/12/04 2:48 PM, "Greg Donald" <destineygmail.com> wrote:
>
> > On Tue, 12 Oct 2004 13:35:13 -0500, Jay Blanchard
> > <jay.blanchardniicommunications.com> wrote:
> >> I want an IDE that will let me speak code into it. Anyone else want
> >> anything?
> >
> > I'd like a clone of myself to do my 9-5 x 5 for me.
> >
> > Oh yeah, and a bag of cheetos. Thanks.
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
<<--------------------------------------------------------
Jasper Howard - Database Administration
ApexEleven.com
530 559 0107
------------------------------------------------------->>

attached mail follows:


On Wednesday 13 October 2004 03:00, Adil wrote:
> man, you guys are harsh. I didn't want a code sample or anything. Just a
> pointer in the right direction, hehe. I've done a lot of looking into this
> and couldn't come up with the right results. I can easily specify a folder
> and submit it and have a php script do whatever but what I'm looking for is
> really to force any browser to display the save as dialog box

Search archives for "force file download" or something.

> or another
> example would be a "create folder" button that when clicked is able to
> launch a dialog box where you can traverse through the directory structure
> and create a folder.

Can't be done. Well it can be (it depends on browser and OS), but it's more
trouble than it's worth. You can have the button iniatite a 'dummy file
download', then when the "save file as ..." dialog comes up the user is
usually given a chance to browse and create new directories, after which they
can cancel the "save file" operation. What's wrong with the user creating
whatever folder they want, wherever they want, using whatever tool they want,
outside of the browser?

--
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
------------------------------------------
/*
To give happiness is to deserve happiness.
*/

attached mail follows:


> Matthew Sims wrote:
>>>Here's what i'm trying to do in php and using a mySQL database:
>>>
>>>I want a button on a page that if clicked it launches the browser's or
>>>OS's
>>>"Save As" window, allowing me to specify where to save my file and/or
>>>create
>>>a new folder. This needs to work on Mac and PC.
>>>
>>>thx in advance
>>>Adil..
>>>
>>
>>
>> What's wrong with:
>>
>> <form method="post" action="thispage.php">
>> <input type="file" name="filename_whatever">
>> <input type="submit" name="submitFile" value="Submit">
>> </form>
>>
>> This isn't even PHP.
>>
>
> Because the OP is asking for how to have it prompt the user where to
> save a (assumingly downloaded) file--not how to choose a file to upload.
>
> --
> Regards,
> Ben Ramsey

Yup, I did read it incorrectly.

--
--Matthew Sims
--<http://killermookie.org>

attached mail follows:


On Tue, 12 Oct 2004 12:27:07 -0700, ApexEleven <blackliquidgmail.com> wrote:
> ok dudes, we understand, as much fun as I have downloading and reading
> your awsome requests, lets just stop beating the horse, it's bee dead
> for quite a while now...

The can is open, the worms are everywhere.

--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

attached mail follows:


Greg Donald wrote:
> On Tue, 12 Oct 2004 12:27:07 -0700, ApexEleven <blackliquidgmail.com> wrote:
>
>>ok dudes, we understand, as much fun as I have downloading and reading
>>your awsome requests, lets just stop beating the horse, it's bee dead
>>for quite a while now...
>
>
> The can is open, the worms are everywhere.
>
>

So, let's go fishing!

--
Regards,
Ben Ramsey
http://benramsey.com

attached mail follows:


It's worth noting that if you're just generating HTML that creates just
a regular old HREF pointing to a regular old file, that the web server
will handle sending out the proper headers.

For example:

<a href="filename.zip">Your Download</a>

You don't need to do anything special with PHP to make this send
correctly and PROBABLY (assuming the web server is configured properly
for that filetype) trigger your web browser to do the whole Save As...
Thing (again, assuming that your BROWSER is configured to ask what you
want to do.. Firefox, for example, will automatically download to your
desktop on a windows box by default).

If, for example, you generated html like this though:

<a href="datasendscript.php?id=1234">Your Download</a>

Then your "datasendscript.php" would have to generate the proper
headers.

-TG

> -----Original Message-----
> From: Dylan Barber [mailto:dylan.barberearthlink.net]
> Sent: Tuesday, October 12, 2004 2:52 PM
> To: Gryffyn, Trevor
> Subject: RE: [PHP-DB] folder creation in php
>
>
>
> you need to send headers to tell the os what the page is like
> mime type etc. look on the PHP documentation
> -----Original Message-----
> From: "Gryffyn, Trevor" <TGryffynair-cargo-inc.com>
> Sent: Oct 12, 2004 1:34 PM
> To: php-dblists.php.net
> Cc: Adil <aasheerdraftnet.com>
> Subject: RE: [PHP-DB] folder creation in php
>
> The browser will automatically do this when you click on a link to a
> file that the web browser knows as a file that you download
> versus HTML
> or text being sent to the browser where it's just displayed instead of
> triggering the download prompt.
>
> Maybe that doesn't make much sense.. My head's a bit foggy right now.
> But the deal is, you just need to create a link that when clicked on,
> sends the browser something other than HTML or text or a known picture
> format (you might have to send headers declaring the MIME type too...
> Most likely do).
>
> The link itself is something that's just done in HTML. What happens
> when you click the link might be PHP driven, but in general
> this isn't a
> PHP or DB question unless there's something with the link that you're
> having trouble creating.
>
> -TG
>
> > -----Original Message-----
> > From: Adil [mailto:aasheerdraftnet.com]
> > Sent: Tuesday, October 12, 2004 2:28 PM
> > To: php-dblists.php.net
> > Subject: [PHP-DB] folder creation in php
> >
> >
> > Here's what i'm trying to do in php and a mySQL database:
> >
> > I want a button on a page that if clicked it launches the
> > browser's or OS's
> > "Save As" window, allowing me to specify where to save my
> > file and/or create
> > a new folder
> >
> > thx in advance
> > Adil..
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> <a href="mailto:dylan.barberearthlink.net">Dylan Barber</a>
> Webmaster / Web Developer / Programing
> <a href="http://codegalaxy.com">-codegalaxy.com-</a>
> <a href="http://summer-swim.com">-summer-swim.com-</a>
> <a href="http://clipurl.com">-clipurl.com-</a>
>
>

attached mail follows:


Trevor Gryffyn wrote:
> It's worth noting that if you're just generating HTML that creates just
> a regular old HREF pointing to a regular old file, that the web server
> will handle sending out the proper headers.

This isn't always the case. If the file is a CSV file and you don't pass
the proper headers (and the proper MIME types are not configured in your
Web server), then it may try to display the file as plain text in the
browser. I could list other examples.

Also, depending on your browser (*ahem* IE), the browser will try to
open many file types in the browser without prompting for download.

Plus, if you use a PHP script to generate content and you want a user to
download it, often times, they will end up downloading a file of the
name "generate-content.php" for every single download.

With the Content-Disposition header, you can avoid these situations and
force the browser to prompt the user to download the file with the
correct filename you specify.

--
Regards,
Ben Ramsey
http://benramsey.com

attached mail follows:


Yeah, I mentioned some of those problems in my email. What I didn't
consider was that the content disposition headers could get around the
browser's configured behavior.

I found this page:
http://forums.devshed.com/t7307/s.html

Which recommends using:
header("Content-Type: application/octet-streamn");

I guess if you give it a MIME type that the browser is almost always
going to try to download instead of telling it (as the person initially
did in this example):

header("Content-Type: application/PDFfile");

Where the browser might want to try to get "clever" and do something
other than download it.

Good things to keep in mind though.

Sounds like all he wants to do really is to open a file dialog, not
necessarily even download a file (??) In which case, the <input
type="file"> would actually work.

I don't know.. Again, head foggy today. Good stuff to think about
though.

-TG

> -----Original Message-----
> From: Ben Ramsey [mailto:listsbenramsey.com]
> Sent: Tuesday, October 12, 2004 3:10 PM
> To: php-generallists.php.net
> Subject: [PHP] Re: [PHP-DB] folder creation in php
>
>
> Trevor Gryffyn wrote:
> > It's worth noting that if you're just generating HTML that
> creates just
> > a regular old HREF pointing to a regular old file, that the
> web server
> > will handle sending out the proper headers.
>
> This isn't always the case. If the file is a CSV file and you
> don't pass
> the proper headers (and the proper MIME types are not
> configured in your
> Web server), then it may try to display the file as plain text in the
> browser. I could list other examples.
>
> Also, depending on your browser (*ahem* IE), the browser will try to
> open many file types in the browser without prompting for download.
>
> Plus, if you use a PHP script to generate content and you
> want a user to
> download it, often times, they will end up downloading a file of the
> name "generate-content.php" for every single download.
>
> With the Content-Disposition header, you can avoid these
> situations and
> force the browser to prompt the user to download the file with the
> correct filename you specify.
>
> --
> Regards,
> Ben Ramsey
> http://benramsey.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


I am thinking like JavaBeans. Here is what I have going on:

I have a series of rather database intensive queries that I would like some
class to cache and provide access for page loads. I don't care how the
information is stored, but I am trying to minimize the database call down to
only once an hour at the most.

The trick is that I just want the data - like a quazi-db table in memory...

Is there something like that I should look at? Somewhere in PEAR?

Thank you in advance!

attached mail follows:


I have used Turck MMCache in the past to store results in shared memory
with an specific TTL. Also you could use Cache_Lite in PEAR.

Hope it helps,

Adrian Madrid

Jed R. Brubaker wrote:

>I am thinking like JavaBeans. Here is what I have going on:
>
>I have a series of rather database intensive queries that I would like some
>class to cache and provide access for page loads. I don't care how the
>information is stored, but I am trying to minimize the database call down to
>only once an hour at the most.
>
>The trick is that I just want the data - like a quazi-db table in memory...
>
>Is there something like that I should look at? Somewhere in PEAR?
>
>Thank you in advance!
>
>
>

--
Adrian Madrid
HyperX Inc.
Mobile: 801.815.1870
Office: 801.566.0670
aemadridhyperxmedia.com
www.hyperxmedia.com

9000 S. 45 W.
Sandy, UT 84070

attached mail follows:


Hello,

On 10/12/2004 04:18 PM, Jed R. Brubaker wrote:
> I am thinking like JavaBeans. Here is what I have going on:
>
> I have a series of rather database intensive queries that I would like some
> class to cache and provide access for page loads. I don't care how the
> information is stored, but I am trying to minimize the database call down to
> only once an hour at the most.
>
> The trick is that I just want the data - like a quazi-db table in memory...
>
> Is there something like that I should look at? Somewhere in PEAR?

You may want to try this generic data caching class. I use precisely for
what you want, cache the contents of pages that are built with data from
databases that does not change frequently and would consume too much
database resources to retrieve all the time.

It caches the data in files and uses readers and writers locking to
assure robustness and integrity of data caches preventing that
simultaneous accesses corrupt the stored data.

If you need to cache data for many pages or eventually different data
for the same pages but for different users like I have, caching all data
in memory is not wise. The problem is that allocating too much memory
may compromise the stability and performance of your system during
moments when memory a lot of real memory is needed.

Caching a lot of pages or generic in disk is a good compromise because
the modern operating systems use the free real memory for buffers that
are relased on demand as your system requires it.

http://www.phpclasses.org/filecache

--

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:


Is PEAR stable on PHP5? I'm trying a new project on PHP5 and keep
getting different kinds of errors (deprecated, etc.) on DB.php,
PEAR.php, etc. Looks like so far there has been no show stoppers but it
would be nice if it wouldn't give errors. What's the status on this? Has
anybody used PEAR and PHP5 on a production environment succesfully yet?

Thanks in advance,

--
Adrian Madrid
HyperX Inc.
Mobile: 801.815.1870
Office: 801.566.0670
aemadridhyperxmedia.com
www.hyperxmedia.com

9000 S. 45 W.
Sandy, UT 84070

attached mail follows:


Adrian Madrid wrote:
> Is PEAR stable on PHP5? I'm trying a new project on PHP5 and keep
> getting different kinds of errors (deprecated, etc.) on DB.php,
> PEAR.php, etc. Looks like so far there has been no show stoppers but it
> would be nice if it wouldn't give errors. What's the status on this? Has
> anybody used PEAR and PHP5 on a production environment succesfully yet?

You need to set error_reporting to E_ALL, instead of E_ALL | E_STRICT.
All errors will disappear.

Greg

attached mail follows:


On Wednesday 13 October 2004 02:22, Mag wrote:

> I got a pretty good code snippet from Zend to grap a
> remote image and save it to disk, the problem is, when
> it saves to my disk i am unable to open the
> images...they are blank and the file matches the
> remote images filesize...
>
>
> Heres the code I got from Zend:
> ############ Start code ##############
> <?php

[snip]

The code looks fine (but it doesn't handle PNGs nor JPEGs)

Try accessing the saved pictures by using an absolute URL.

--
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
------------------------------------------
/*
System restarting, wait...
*/

attached mail follows:


Mag wrote:
> Hi,
> I got a pretty good code snippet from Zend to grap a
> remote image and save it to disk, the problem is, when
> it saves to my disk i am unable to open the
> images...they are blank and the file matches the
> remote images filesize...

[snip]

> ob_start();
> readfile($url);
> $img = ob_get_contents();
> ob_end_clean();
> $size = strlen($img);
>
> $fp2=fopen($filename, "a");
> fwrite($fp2,$img);
> fclose($fp2);

I'm not sure what the problem is, but simplifying the code will help you
track it down. Rather than messing with output buffering and
fopen/fwrite/fclose, I'd suggest using the copy() function.

This line replaces the 8 lines above:

copy( $url, $filename );

--Rick

attached mail follows:


Hi Rick,
Thanks for replying.

> Mag wrote:
> > Hi,
> > I got a pretty good code snippet from Zend to grap
> a
> > remote image and save it to disk, the problem is,
> when
> > it saves to my disk i am unable to open the
> > images...they are blank and the file matches the
> > remote images filesize...
>
> [snip]
>
> > ob_start();
> > readfile($url);
> > $img = ob_get_contents();
> > ob_end_clean();
> > $size = strlen($img);
> >
> > $fp2=fopen($filename, "a");
> > fwrite($fp2,$img);
> > fclose($fp2);

> I'm not sure what the problem is, but simplifying
> the code will help you
> track it down. Rather than messing with output
> buffering and
> fopen/fwrite/fclose, I'd suggest using the copy()
> function.
>
> This line replaces the 8 lines above:
>
> copy( $url, $filename );
>
> --Rick

One of the problems is that my host has a
anti-leaching .htaccess file setup (which is good
really) so people cant "hot-link"...problem is with
copy() I am getting this error:

HTTP/1.0 403 Forbidden

Is there any way to forge the headers or something to
get through?

Thanks,
Mag

=====
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

                
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail

attached mail follows:


I'm also using Hypertext Mark-up Language and Hypertext Pre-processor but
hey - who cares about the TLAs...?

--
-----------------------------
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-----------------------------
"Raditha Dissanayake" <jabberraditha.com> wrote in message
news:416AB379.5040309raditha.com...
> Harlequin wrote:
>
>>Bruno
>>
>>I'm still rather new to PHP so I use client side Java:
>>
> you are not using java you are using javascript.
>
>>[CODE]
>><!-- Print Page -->
>><p>Click Here To Print This Page: <a href="javascript:window.print()"><img
>>src="../images/Icon_Printer.gif" border="0" alt="Print This Page"></a></p>
>>[/CODE]
>>
>>That may be os use to you...
>>
>>
>
>
> --
> Raditha Dissanayake.
> ------------------------------------------------------------------------
> http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
> Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
> Graphical User Inteface. Just 128 KB | with progress bar.

attached mail follows:


On Wednesday 13 October 2004 03:57, Harlequin wrote:
> I'm also using Hypertext Mark-up Language and Hypertext Pre-processor but
> hey - who cares about the TLAs...?

Java and Javascript are completely different things. You would be fooling
yourself and making a fool of yourself if you think otherwise.

--
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
------------------------------------------
/*
Truth has always been found to promote the best interests of mankind...
- Percy Bysshe Shelley
*/

attached mail follows:


On Tue, 12 Oct 2004 20:57:54 +0100, Harlequin
<michael.masonarraspeople.co.uk> wrote:
> I'm also using Hypertext Mark-up Language and Hypertext Pre-processor but
> hey - who cares about the TLAs...?

No idea what a 'TLA' is in this context, but you're definitely missing
the point.

There is no such thing as 'client side java', it's just Java, whether
it's an applet or a servlet or a cli app. Java is compiled into
bytecode then executed, while Javascript is parsed like (you guessed
it) a scripting language. Furthermore, Java was created by Sun, while
Javascript was created by Netscape. Other than the name collision,
they have very little to do with each other.

--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

attached mail follows:


Hi List,

I"m wondering what factors are at play in deciding to use "require",
"include", "file_get_contents" and such when laying out a site. Like
why use one template, or many - why use different pages rather than
relying on variables. I'm also wondering about how I see "{content}"
type stuff in phpBB and Coppermine Photo Gallery. Does it have to deal
with customization?

Anyone have any recommendations where I can learn more about this, I
guess structural, stuff?

Thanks.
-dg

attached mail follows:


On Tue, 2004-10-12 at 16:19, lists wrote:
> Hi List,
>
> I"m wondering what factors are at play in deciding to use "require",
> "include", "file_get_contents" and such when laying out a site. Like

require() generates a fatal error if the target file doesn't exist. This
means your script will not attempt to continue. On the other hand,
include() only generates a warning and, if you know what you're doing,
might be convenient to choke using the prefix. file_get_contents()
ensures that the content is not parsed as PHP which is good for content
that might have PHP code in it that you DON'T want evaluated.

> why use one template, or many

Many templates allows you to build a site as though you were building a
car. You can have multiple engines, multiple bodies, multiple hub caps,
etc etc. Then using multiple templates allows you to combine them as you
wish with minimal effort.

> why use different pages rather than relying on variables.

Different pages are generally better than a single page which does
internal content switching based on a variable since search engine
crawlers can index them better... unless you're using some fancy URL
rewriting, but then you're just pretending to have separate pages :)

> I'm also wondering about how I see "{content}"
> type stuff in phpBB and Coppermine Photo Gallery. Does it have to deal
> with customization?

That is probably a template tag of some sort. Depending on what
templating system you are using there are many different, many archaic,
ways of telling the template engine what you want and where.

> Anyone have any recommendations where I can learn more about this, I
> guess structural, stuff?

Try google. If that doesn't work, ask google politely how to use google.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


On Tue, 12 Oct 2004 13:19:37 -0700, lists <listsrexruff.pair.com> wrote:
> I"m wondering what factors are at play in deciding to use "require",
> "include",

This dictates the level of error reporting you desire when pulling in
a file. On failure, include() won't stop your script execution, while
require() will. The overhead is probably not all that different.
Feel free to benchmark them both and see for yourself.

> "file_get_contents" and such when laying out a site. Like

As we discussed here the other day, you risk backwards compatibility
when using the newer PHP functions with older PHP installs. If your
server supports it then go for it. People who write scripts and sell
them (like me) can't count on such things and must play it safe and
use the older PHP functions. Or like in my stuff here at work the
other day I found our strict "Debian stable - no deviation" policy
prevented me from using file_get_contents(). It didn't ruin my day or
anything. :)

> why use one template, or many - why use different pages rather than
> relying on variables.

I scoff at template engines like Smarty and frameworks like Mojavi.
But that's just me. I work with both of those technologies everyday
but would never include them in my own projects. For good templating
all you _really_ need is eval() to parse out your variables.
Everything else is overhead.

> I'm also wondering about how I see "{content}"
> type stuff in phpBB and Coppermine Photo Gallery. Does it have to deal
> with customization?

Some of those guys wrap their variables in curly braces for whatever
reason. It's definitely not required by eval().

> Anyone have any recommendations where I can learn more about this, I
> guess structural, stuff?

The php.net manual has great code samples throughout. There are many
good php related sites out there too. phpbuilder.com is a good one.

--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

attached mail follows:


This is helpful, thanks. But I understand most of the pieces. I'm
interested in efficient and organizational factors to consider in using
them. But after sending this, I thought, maybe my question is more of
a general structural web design question rather than PHP.

I've checked google, (I'm a google researcher actually), as well as
O'Reilly's Safari Books online. Most PHP books and resources I've
found all have so many different variations of organization, I was
trying to get more at the thought behind this.

Maybe I just need to study it case by case.

-dg
On Oct 12, 2004, at 2:16 PM, Robert Cummings wrote:

> On Tue, 2004-10-12 at 16:19, lists wrote:
>> Hi List,
>>
>> I"m wondering what factors are at play in deciding to use "require",
>> "include", "file_get_contents" and such when laying out a site. Like
>
> require() generates a fatal error if the target file doesn't exist.
> This
> means your script will not attempt to continue. On the other hand,
> include() only generates a warning and, if you know what you're doing,
> might be convenient to choke using the prefix. file_get_contents()
> ensures that the content is not parsed as PHP which is good for content
> that might have PHP code in it that you DON'T want evaluated.
>
>> why use one template, or many
>
> Many templates allows you to build a site as though you were building a
> car. You can have multiple engines, multiple bodies, multiple hub caps,
> etc etc. Then using multiple templates allows you to combine them as
> you
> wish with minimal effort.
>
>> why use different pages rather than relying on variables.
>
> Different pages are generally better than a single page which does
> internal content switching based on a variable since search engine
> crawlers can index them better... unless you're using some fancy URL
> rewriting, but then you're just pretending to have separate pages :)
>
>> I'm also wondering about how I see "{content}"
>> type stuff in phpBB and Coppermine Photo Gallery. Does it have to
>> deal
>> with customization?
>
> That is probably a template tag of some sort. Depending on what
> templating system you are using there are many different, many archaic,
> ways of telling the template engine what you want and where.
>
>> Anyone have any recommendations where I can learn more about this, I
>> guess structural, stuff?
>
> Try google. If that doesn't work, ask google politely how to use
> google.
>
> Cheers,
> Rob.
> --
> .------------------------------------------------------------.
> | InterJinn Application Framework - http://www.interjinn.com |
> :------------------------------------------------------------:
> | An application and templating framework for PHP. Boasting |
> | a powerful, scalable system for accessing system services |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for |
> | creating re-usable components quickly and easily. |
> `------------------------------------------------------------'
>

attached mail follows:


On Tue, 12 Oct 2004 14:38:21 -0700, lists <listsrexruff.pair.com> wrote:
> This is helpful, thanks. But I understand most of the pieces. I'm
> interested in efficient and organizational factors to consider in using
> them. But after sending this, I thought, maybe my question is more of
> a general structural web design question rather than PHP.
>
> I've checked google, (I'm a google researcher actually), as well as
> O'Reilly's Safari Books online. Most PHP books and resources I've
> found all have so many different variations of organization, I was
> trying to get more at the thought behind this.
>
> Maybe I just need to study it case by case.

Well, as I stated previously, I'm not a huge fan of frameworks. But..

We use Mojavi, and it works very well:

http://mojavi.org
http://www.peterrobins.co.uk/it/mojavi/tutorial.htm

It's way more than just templates, it's display and logic seperation,
modularization, filter chains, the works. In fact we use Smarty as
the template rendering engine for Mojavi:
http://smarty.php.net

It'll make a small project seem huge in no time flat, but that's the
price you pay for 'organization' and stuff.

--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

attached mail follows:


On Tue, 2004-10-12 at 18:18, Greg Donald wrote:
> We use Mojavi, and it works very well:
>
> http://mojavi.org
> http://www.peterrobins.co.uk/it/mojavi/tutorial.htm
>
> It's way more than just templates, it's display and logic seperation,
> modularization, filter chains, the works. In fact we use Smarty as
> the template rendering engine for Mojavi:
> http://smarty.php.net
>
> It'll make a small project seem huge in no time flat, but that's the
> price you pay for 'organization' and stuff.

But frameworks can also make a huge project seem medium which is the
advantage of organization. Also, it's quite often the case that a small
project grows and slowly becomes a big project. At which time the payoff
can be realized :)

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


>> It'll make a small project seem huge in no time flat, but that's the
>> price you pay for 'organization' and stuff.
>
> But frameworks can also make a huge project seem medium which is the
> advantage of organization. Also, it's quite often the case that a small
> project grows and slowly becomes a big project. At which time the
> payoff
> can be realized :)

Da, this is true. It's what separates the good developer from the
merely mediocre: experience teaches how to code a small project
quickly, but keep it organized and flexible to adapt to the inevitable
growth and refactoring. A framework that reflects this flexibility is a
help, one that doesn't is a hindrance.

------------------------------------------------------
michal migurski- contact info, blog, and pgp key:
sf/ca http://mike.teczno.com/contact.html

attached mail follows:


* Lists <listsrexruff.pair.com>:
> This is helpful, thanks. But I understand most of the pieces. I'm
> interested in efficient and organizational factors to consider in using
> them. But after sending this, I thought, maybe my question is more of
> a general structural web design question rather than PHP.
>
> I've checked google, (I'm a google researcher actually), as well as
> O'Reilly's Safari Books online. Most PHP books and resources I've
> found all have so many different variations of organization, I was
> trying to get more at the thought behind this.

I haven't had much luck with PHP books when it comes to efficient coding
techniques and site/application architecture. It's a niche that needs to
be filled.

The best book I've read so far about the subject is The Pragmatic
Programmer, which, while not PHP or web centric (pretty far from it),
gave me some great ideas about how to develop php web applications. The
bottom line is keeping code modular and flexible (and keeping it modular
generally results in keeping it flexible). This means making your
applications abstract, so that you can use metadata (config files) to
create customized applications. (This is where Rob hit it right on the
money -- more can be better, when you think of having many building
blocks -- templates -- to create an application.)

Another thing you might want to research is the MVC pattern
(Model-View-Controller) -- it has great uses in the web world, and when
I've applied it to PHP (which is pretty much all the time now), it's
greatly simplified my efforts and increased productivity.

My advice is: look into books on general programming organization; I
think you'll find a wealth of knowledge you can apply to PHP.

> On Oct 12, 2004, at 2:16 PM, Robert Cummings wrote:
>
>> On Tue, 2004-10-12 at 16:19, lists wrote:
>>> I"m wondering what factors are at play in deciding to use "require",
>>> "include", "file_get_contents" and such when laying out a site. Like
> >
>> require() generates a fatal error if the target file doesn't exist.
>> This
>> means your script will not attempt to continue. On the other hand,
>> include() only generates a warning and, if you know what you're doing,
>> might be convenient to choke using the prefix. file_get_contents()
>> ensures that the content is not parsed as PHP which is good for content
>> that might have PHP code in it that you DON'T want evaluated.
> >
>>> why use one template, or many
> >
>> Many templates allows you to build a site as though you were building a
>> car. You can have multiple engines, multiple bodies, multiple hub caps,
>> etc etc. Then using multiple templates allows you to combine them as
>> you
>> wish with minimal effort.
> >
>>> why use different pages rather than relying on variables.
> >
>> Different pages are generally better than a single page which does
>> internal content switching based on a variable since search engine
>> crawlers can index them better... unless you're using some fancy URL
>> rewriting, but then you're just pretending to have separate pages :)
> >
>>> I'm also wondering about how I see "{content}"
>>> type stuff in phpBB and Coppermine Photo Gallery. Does it have to
>>> deal
>>> with customization?
> >
>> That is probably a template tag of some sort. Depending on what
>> templating system you are using there are many different, many archaic,
>> ways of telling the template engine what you want and where.
> >
>>> Anyone have any recommendations where I can learn more about this, I
>>> guess structural, stuff?

--
Matthew Weier O'Phinney | mailto:matthewgarden.org
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

attached mail follows:


* Greg Donald <destineygmail.com>:
> > why use one template, or many - why use different pages rather than
> > relying on variables.
>
> I scoff at template engines like Smarty and frameworks like Mojavi.
> But that's just me. I work with both of those technologies everyday
> but would never include them in my own projects. For good templating
> all you _really_ need is eval() to parse out your variables.
> Everything else is overhead.

There's a part of me that totally agrees with you.. and another that
feels such statements are along the lines of 'real men don't need teeth;
they can gum a bear to death'. A framework is a fantastic tool
especially when coding with others -- in such situations, maintaining
code somebody else wrote isn't a jolt when you first open it, but
instantly familiar. And using templates has saved me many more hours
of development time than I've lost in processor cycles.

Besides, didn't Rasmus say something like, "If eval is the answer,
you've probably asked the wrong question"? :-)

> > I'm also wondering about how I see "{content}"
> > type stuff in phpBB and Coppermine Photo Gallery. Does it have to deal
> > with customization?
>
> Some of those guys wrap their variables in curly braces for whatever
> reason. It's definitely not required by eval().

Usually there's a parser doing substitutions in such cases. Wrapping
them makes them easily visible when scanning through HTML, and also
allows validation of the template before content is placed (e.g.,
through the W3C's XHTML, HTML, or CSS validators).

> > Anyone have any recommendations where I can learn more about this, I
> > guess structural, stuff?
>
> The php.net manual has great code samples throughout. There are many
> good php related sites out there too. phpbuilder.com is a good one.

And browse through some PEAR code (http://pear.php.net); it's typically
very high quality.

--
Matthew Weier O'Phinney | mailto:matthewgarden.org
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

attached mail follows:


On Oct 12, 2004, at 3:53 PM, Michal Migurski wrote:

> Do you have experience with writing any PHP-based (or other) web
> applications?

> I guess all I'm saying is that there a million ways to skin this cat,
> none of them strictly superior outside the context of your development
> needs, the people you're working with, the server environment you're
> working on, etc.
>

> One great way to gain a bit of experience is to download and dissect
> some of the many PHP-based open source projects out there - many of
> them are pretty messy, and attempting to plow through someone else's
> tangled code is a great way to learn how problems get solved in the
> real world, which approaches are beneficial, and which solutions are
> flawed.
>

thanks for the reply Michal. I don't have a lot of experience and find
I keep going back over old stuff to polish or totally change even. I
can see that there are many ways to go about it though, so at this
point, in making a site I think will have to grow and adapt, I'm just
kinda scratching my head wondering what would be most efficient.

I have been looking at other code. Brought in a lot of new questions.
I guess it's just the nature of the beast. Fun to keep tinkering
though.

-dg

attached mail follows:


On Oct 12, 2004, at 6:52 PM, Matthew Weier O'Phinney wrote:

> I haven't had much luck with PHP books when it comes to efficient
> coding
> techniques and site/application architecture. It's a niche that needs
> to
> be filled.
>
> Another thing you might want to research is the MVC pattern
> (Model-View-Controller) -- it has great uses in the web world, and when
> I've applied it to PHP (which is pretty much all the time now), it's
> greatly simplified my efforts and increased productivity.
>
> My advice is: look into books on general programming organization; I
> think you'll find a wealth of knowledge you can apply to PHP.

Thanks Matthew. I think this is a good avenue.

-dg

attached mail follows:


I would like to know if someone out there has or knows of a tutorial
on Maintenance of State that allows only users who have logged in to
successfully visit view pages?

attached mail follows:


--- GH <GaryHotkogmail.com> wrote:
> I would like to know if someone out there has or knows of a tutorial
> on Maintenance of State that allows only users who have logged in to
> successfully visit view pages?

You might find this helpful, if I'm interpreting your question correctly:

http://shiflett.org/articles/the-truth-about-sessions

Hope that helps.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming December 2004 http://httphandbook.org/

attached mail follows:


[snip]
I would like to know if someone out there has or knows of a tutorial
on Maintenance of State that allows only users who have logged in to
successfully visit view pages?
[/snip]

PHP, being server side without a persistent connection to the client, is
stateless. You can use things like cookies and sessions to maintain
pseudo-state. http://www.php.net/session

attached mail follows:


On Tue, 12 Oct 2004 16:43:42 -0400, GH <garyhotkogmail.com> wrote:
> I would like to know if someone out there has or knows of a tutorial
> on Maintenance of State that allows only users who have logged in to
> successfully visit view pages?

You can store most anything in a PHP session, variables, objects, etc.

--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

attached mail follows:


I will look into the into all of the items discussed and probably will
be sending in some questions

On Tue, 12 Oct 2004 16:17:37 -0500, Greg Donald <destineygmail.com> wrote:
>
>
> On Tue, 12 Oct 2004 16:43:42 -0400, GH <garyhotkogmail.com> wrote:
> > I would like to know if someone out there has or knows of a tutorial
> > on Maintenance of State that allows only users who have logged in to
> > successfully visit view pages?
>
> You can store most anything in a PHP session, variables, objects, etc.
>
> --
> Greg Donald
> Zend Certified Engineer
> http://gdconsultants.com/
> http://destiney.com/
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Hi all.

This may not be completely a PHP question, but hopefully you will be
able to provide some insight. I have a table in HTML that I want to
export to an excel spreadsheet. Using PHP, I can create an excel
document - however, it's empty/blank. I think I am just doing it
incorrectly. Anybody done this before and/or have any ideas? I would
prefer to NOT use a third-party program.

I've searched the web and php.net, but have been somewhat unsuccessful
in finding anything. Here's what I have so far:

-------------
<?php
header('Content-Type: application/ms-excel');
header('Content-Disposition: attachment; filename="project.xls"');
?>

<table>
        <tr>
                <td>Something</td>
                </td>Something else</td>
        </tr>
</table>
-------------

I just want it to have that content in the spreadsheet. It's actually
more involved than that, but that's the gist of it.

Thanks in advance.
~Philip

attached mail follows:


Philip Thompson wrote:

> Hi all.
>
> This may not be completely a PHP question, but hopefully you will be
> able to provide some insight. I have a table in HTML that I want to
> export to an excel spreadsheet. Using PHP, I can create an excel
> document - however, it's empty/blank. I think I am just doing it
> incorrectly. Anybody done this before and/or have any ideas? I would
> prefer to NOT use a third-party program.
>
> I've searched the web and php.net, but have been somewhat unsuccessful
> in finding anything. Here's what I have so far:
>
> -------------
> <?php
> header('Content-Type: application/ms-excel');
> header('Content-Disposition: attachment; filename="project.xls"');
> ?>
>
> <table>
> <tr>
> <td>Something</td>
> </td>Something else</td>
> </tr>
> </table>
> -------------
>
> I just want it to have that content in the spreadsheet. It's actually
> more involved than that, but that's the gist of it.
>
> Thanks in advance.
> ~Philip
and that doesn't work???

Works for me... (Excel 2000)
"Something" appears in A1
"Something Else" appears in B1.

attached mail follows:


Philip, have you checked the php freaks website? I do recall seeing a script
in their tutorials library that claimed to create Excel files.

http://www.phpfreaks.com

Just had a search and came up with:

<?
header("Content-Type: application/vnd.ms-excel");
                                  ^^^^
echo "<table border=1>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
</tr>
</table>";
?>

HTH
Graham

> -----Original Message-----
> From: Philip Thompson [mailto:prthompuark.edu]
> Sent: 12 October 2004 22:21
> To: php-generallists.php.net
> Subject: [PHP] Exporting HTML to Excel
>
>
> Hi all.
>
> This may not be completely a PHP question, but hopefully you will be
> able to provide some insight. I have a table in HTML that I want to
> export to an excel spreadsheet. Using PHP, I can create an excel
> document - however, it's empty/blank. I think I am just doing it
> incorrectly. Anybody done this before and/or have any ideas? I would
> prefer to NOT use a third-party program.
>
> I've searched the web and php.net, but have been somewhat unsuccessful
> in finding anything. Here's what I have so far:
>
> -------------
> <?php
> header('Content-Type: application/ms-excel');
> header('Content-Disposition: attachment; filename="project.xls"');
> ?>
>
> <table>
> <tr>
> <td>Something</td>
> </td>Something else</td>
> </tr>
> </table>
> -------------
>
> I just want it to have that content in the spreadsheet. It's actually
> more involved than that, but that's the gist of it.
>
> Thanks in advance.
> ~Philip
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Have you tried changing your file name to project.htm but continue issuing
the mime headers for excel?

Warren Vail

-----Original Message-----
From: Philip Thompson [mailto:prthompuark.edu]
Sent: Tuesday, October 12, 2004 2:21 PM
To: php-generallists.php.net
Subject: [PHP] Exporting HTML to Excel

Hi all.

This may not be completely a PHP question, but hopefully you will be
able to provide some insight. I have a table in HTML that I want to
export to an excel spreadsheet. Using PHP, I can create an excel
document - however, it's empty/blank. I think I am just doing it
incorrectly. Anybody done this before and/or have any ideas? I would
prefer to NOT use a third-party program.

I've searched the web and php.net, but have been somewhat unsuccessful
in finding anything. Here's what I have so far:

-------------
<?php
header('Content-Type: application/ms-excel');
header('Content-Disposition: attachment; filename="project.xls"'); ?>

<table>
        <tr>
                <td>Something</td>
                </td>Something else</td>
        </tr>
</table>
-------------

I just want it to have that content in the spreadsheet. It's actually
more involved than that, but that's the gist of it.

Thanks in advance.
~Philip

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

attached mail follows:


On Tue, 12 Oct 2004 09:17:30 -0700, ApexEleven <blackliquidgmail.com> wrote:

> Why use fpassthru? I just use readfile, is there a difference?
>
The main difference is with fpassthru you never show to the user the
exacr location of the file, so must use the script to download it.

In example, you can control hot-links from other sites, php access
control to the file, and so on. Also, you can put the file outside the
apache documents directory, so the file will never be reached in other
way: if you want the file, you have to use the script wich controls
the access to it.

Regards,
Jordi.

attached mail follows:


Jordi Canals wrote:
> On Tue, 12 Oct 2004 09:17:30 -0700, ApexEleven <blackliquidgmail.com> wrote:
>
>
>>Why use fpassthru? I just use readfile, is there a difference?
>>
>
> The main difference is with fpassthru you never show to the user the
> exacr location of the file, so must use the script to download it.
>
> In example, you can control hot-links from other sites, php access
> control to the file, and so on. Also, you can put the file outside the
> apache documents directory, so the file will never be reached in other
> way: if you want the file, you have to use the script wich controls
> the access to it.

I bet Apex11 meant readfile() php function.

attached mail follows:


On Wed, 13 Oct 2004 00:22:40 +0200, Marek Kilimajer <listskilimajer.net> wrote:

>>Why use fpassthru? I just use readfile, is there a difference?
>
> I bet Apex11 meant readfile() php function.
>
Oh, I see. Sorry for the mistake. In this case, I would like to know
also the diference ;)

Regards,
Jordi

attached mail follows:


On Wednesday 13 October 2004 07:17, Jordi Canals wrote:
> On Wed, 13 Oct 2004 00:22:40 +0200, Marek Kilimajer <listskilimajer.net>
wrote:
> >>Why use fpassthru? I just use readfile, is there a difference?
> >
> > I bet Apex11 meant readfile() php function.
>
> Oh, I see. Sorry for the mistake. In this case, I would like to know
> also the diference ;)

The difference is that readfile() is easier to use and more appropriate in
this case. RTFM if you want details.

--
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
------------------------------------------
/*
Beware of the Turing Tar-pit in which everything is possible but nothing of
interest is easy.
*/

attached mail follows:


Hi all,

I'd like to know the difference by using the $_SERVER['PHP_SELF'] and
$_SERVER['SCRIPT_NAME'] variables. After I read the manual, I have not
found the difference betwen the two when used in a Web Script. Also,
in all tests I've done, I get the same result in both variables.

Any comment will be welcome,
Jordi.

attached mail follows:


Jordi Canals wrote:
> I'd like to know the difference by using the $_SERVER['PHP_SELF'] and
> $_SERVER['SCRIPT_NAME'] variables. After I read the manual, I have not
> found the difference betwen the two when used in a Web Script. Also,
> in all tests I've done, I get the same result in both variables.

PHP_SELF seems to be more reliable as SCRIPT_NAME isn't populated on
some OS, in my experiences. But if both are present, they'll have the
same value.

--

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


* Thus wrote John Holmes:
> Jordi Canals wrote:
> >I'd like to know the difference by using the $_SERVER['PHP_SELF'] and
> >$_SERVER['SCRIPT_NAME'] variables. After I read the manual, I have not
> >found the difference betwen the two when used in a Web Script. Also,
> >in all tests I've done, I get the same result in both variables.
>
> PHP_SELF seems to be more reliable as SCRIPT_NAME isn't populated on
> some OS, in my experiences. But if both are present, they'll have the
> same value.

SCRIPT_NAME comes from CGI 1.1 and is required according to the
specifications, iirc, it depends on how well the paticular
webserver impelments the CGI spec when running php as a module.

PHP_SELF will almost always be filled out, it is defined within PHP
itself.

Curt
--
Quoth the Raven, "Nevermore."

attached mail follows:


Manuel Lemos wrote:
> Hello,
>
> On 10/07/2004 09:24 AM, Marco Tabini wrote:
>
>> Finally, you will need a fast mailing mechanism. mail() is not your
>> only option--you can interface directly with any mailer through SMTP
>> or pipes, for example--but in my experience, you don't need to go any
>> further to make things work properly. What you really need, is a fast
>
>
> This is a common misconception. It seems that most people confuse
> queueing with deliverying.
>

Not that I want to start a fight or anything... but where is the
misconception? I simply illustrated several possibilities--one of which
is queuing, while the other is deliverying directly (and there is a
difference, and they can both be performed through PHP, although I
personally wouldn't see the point of bothering with direct delivery).

Mt.

--
Marco Tabini
President and CEO

Marco Tabini & Associates, Inc.
28 Bombay Ave.
Toronto, ON M3H 1B7
Canada

Phone: (416) 630-6202
Fax: (416) 630-5057

attached mail follows:


Hello,

On 10/12/2004 08:42 PM, Marco Tabini wrote:
>> On 10/07/2004 09:24 AM, Marco Tabini wrote:
>>
>>> Finally, you will need a fast mailing mechanism. mail() is not your
>>> only option--you can interface directly with any mailer through SMTP
>>> or pipes, for example--but in my experience, you don't need to go any
>>> further to make things work properly. What you really need, is a fast
>>
>> This is a common misconception. It seems that most people confuse
>> queueing with deliverying.
>
> Not that I want to start a fight or anything... but where is the
> misconception? I simply illustrated several possibilities--one of which
> is queuing, while the other is deliverying directly (and there is a
> difference, and they can both be performed through PHP, although I
> personally wouldn't see the point of bothering with direct delivery).

The misconception is in assuming that when you relay a message to an
SMTP server that is the deliverying the message. Relaying a message to
another server is usually the same as queueing, except that it is much
slower as it make the message go through a TCP (SMTP) connection.

The real delivery only happens afterwards, it may take hours, days or
even never happen due to permanent failures.

Although other MTA work a little different, you may want to review the
Qmail big picture to understand better the difference between local
queueing and SMTP queueing, and message queueing and message delivery.

http://www.nrg4u.com/qmail/the-big-qmail-picture-103-p1.gif

The bottom line is, do not use SMTP for queueing unless you do not have
an alternative for queueing message, like for instance when you are
really obligated to relay messages to a given mail server and this
server is in a separate machine from the one where your PHP applications
are running.

--

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:


I've got the following string:

$text = "football";

How do I put that string in italics using a true type font on an image?

Thanks.

Brent

attached mail follows:


On Wednesday 13 October 2004 08:30, Brent Clements wrote:
> I've got the following string:
>
> $text = "football";
>
> How do I put that string in italics using a true type font on an image?

Use the italic version of the font.

In case you're wondering, the italic/bold that you can select on fonts in, say
Windows, are generated on-the-fly if the italic/bold versions of that font
are not available. Have a look through your fonts directory and you'll see
the font names ending with *n, *i, *b, meaning normal, italic, bold
respectively.

--
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
------------------------------------------
/*
Never test for an error condition you don't know how to handle.
                -- Steinbach
*/

attached mail follows:


Jason, thanks for the reminder, I completely forgot about the italic
version(s).

-Brent

----- Original Message -----
From: "Jason Wong" <php-generalgremlins.biz>
To: <php-generallists.php.net>
Sent: Tuesday, October 12, 2004 8:08 PM
Subject: Re: [PHP] How do I do italics on a text string in an image?

> On Wednesday 13 October 2004 08:30, Brent Clements wrote:
> > I've got the following string:
> >
> > $text = "football";
> >
> > How do I put that string in italics using a true type font on an image?
>
> Use the italic version of the font.
>
> In case you're wondering, the italic/bold that you can select on fonts in,
say
> Windows, are generated on-the-fly if the italic/bold versions of that font
> are not available. Have a look through your fonts directory and you'll see
> the font names ending with *n, *i, *b, meaning normal, italic, bold
> respectively.
>
> --
> 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
> ------------------------------------------
> /*
> Never test for an error condition you don't know how to handle.
> -- Steinbach
> */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


How a subdomain is pointed to a dynamic page section?

If a dynamic url with querystrings gets rewritten somehow to look like
directory based url... then how would I point a subdomain to it?

--
M.Saleh.E.G
97150-4779817

attached mail follows:


On Wednesday 13 October 2004 09:03, M Saleh EG wrote:
> How a subdomain is pointed to a dynamic page section?
>
> If a dynamic url with querystrings gets rewritten somehow to look like
> directory based url... then how would I point a subdomain to it?

Ask on the mailing list/support forum/technical hotline of your webserver?

--
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
------------------------------------------
/*
No good deed goes unpunished.
                -- Clare Booth Luce
*/

attached mail follows:


Hi folks. I've got a quick question about sessions and Mozilla.

I just noticed that if I open up a Mozilla window, log into my CMS, then
open another Mozilla window (not by ctrl-n, but by selecting it from my
programs menu) and bring up the login page in that new window, then it
detects the session from the other window and redirects right to the CMS
control panel.

In IE, this will happen if I ctrl-n a new window, but not if I start a
new instance of the browser from the program list.

Is the correct behavior for sessions in Mozilla?

I've searched the lists but I couldn't find anything which seemed to
answer this.

Cheers and TIA,

Pablo

attached mail follows:


* Pablo Gosse <gossepunbc.ca>:
> I just noticed that if I open up a Mozilla window, log into my CMS, then
> open another Mozilla window (not by ctrl-n, but by selecting it from my
> programs menu) and bring up the login page in that new window, then it
> detects the session from the other window and redirects right to the CMS
> control panel.
>
> In IE, this will happen if I ctrl-n a new window, but not if I start a
> new instance of the browser from the program list.
>
> Is the correct behavior for sessions in Mozilla?
>
> I've searched the lists but I couldn't find anything which seemed to
> answer this.

My understanding is that if you have a session of Mozilla open, if you
run the executable again, it searches for a running session and, if one
is found, uses it to spawn a new window without actually running another
copy.

--
Matthew Weier O'Phinney | mailto:matthewgarden.org
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

attached mail follows:


On Wed, 2004-10-13 at 01:26 +0000, Matthew Weier O'Phinney wrote:
> * Pablo Gosse <gossepunbc.ca>:
> > I just noticed that if I open up a Mozilla window, log into my CMS, then
> > open another Mozilla window (not by ctrl-n, but by selecting it from my
> > programs menu) and bring up the login page in that new window, then it
> > detects the session from the other window and redirects right to the CMS
> > control panel.
> >
> > In IE, this will happen if I ctrl-n a new window, but not if I start a
> > new instance of the browser from the program list.
> >
> > Is the correct behavior for sessions in Mozilla?
> >
> > I've searched the lists but I couldn't find anything which seemed to
> > answer this.
>
> My understanding is that if you have a session of Mozilla open, if you
> run the executable again, it searches for a running session and, if one
> is found, uses it to spawn a new window without actually running another
> copy.
>

The way around this is to use profiles in mozilla.

--
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON | www.planetargon.com
* Portland, OR | robbyplanetargon.com
* 503.351.4730 | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
****************************************/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQBBbIXB0QaQZBaqXgwRAir7AKCMBYcTLrfc2i4W3KwVq/H4L/otkACfaQjm
Mg2QRoGk7pRHV5MIQ4fjIjM=
=DXLQ
-----END PGP SIGNATURE-----

attached mail follows:


--- Pablo Gosse <gossepunbc.ca> wrote:
> I just noticed that if I open up a Mozilla window, log into my
> CMS, then open another Mozilla window (not by ctrl-n, but by
> selecting it from my programs menu) and bring up the login page
> in that new window, then it detects the session from the other
> window and redirects right to the CMS control panel.
>
> In IE, this will happen if I ctrl-n a new window, but not if I
> start a new instance of the browser from the program list.

I bet if you look, Firefox only uses one process, while IE uses two. The
Firefox behavior is pretty standard.

Out of curiosity, why would you want a single user to have two separate
sessions?

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming December 2004 http://httphandbook.org/

attached mail follows:


A friend of mine asked me if I knew if this was possible in PHP4.

class foo
{
    var $bar = NULL;

    function foo()
    {
        $this->bar = new bar();
    }

    function getBar()
    {
        return $this->bar;
    }

}

class bar
{
    var $thing = NULL;

    function bar()
    {
        $this->thing = "Hello World!";
    }

    function getThing()
    {
        return $this->thing;
    }

}

he wants to do something like this:

$obj =& new foo;

print $foo->getBar()->getThing();

is this possible in PHP4?

I know that he can do a:

print $obj->bar->getThing();

..but he wants it to run some stuff in the functions that he is calling
and wants to do it in one command if possible.

-Robby

--
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON | www.planetargon.com
* Portland, OR | robbyplanetargon.com
* 503.351.4730 | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
****************************************/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQBBbJdA0QaQZBaqXgwRAtOxAJ0cii9Ow6sksnO7ix9H/dHuFY+LRgCdF80x
QpOOT3QyH+OYUuV7G7TUFxs=
=MJql
-----END PGP SIGNATURE-----

attached mail follows:


Robby Russell wrote:

>A friend of mine asked me if I knew if this was possible in PHP4.
>
>
>class foo
>{
> var $bar = NULL;
>
> function foo()
> {
> $this->bar = new bar();
> }
>
> function getBar()
> {
> return $this->bar;
> }
>
>}
>
>
>class bar
>{
> var $thing = NULL;
>
> function bar()
> {
> $this->thing = "Hello World!";
> }
>
> function getThing()
> {
> return $this->thing;
> }
>
>}
>
>
>he wants to do something like this:
>
>$obj =& new foo;
>
>print $foo->getBar()->getThing();
>
>is this possible in PHP4?
>
>I know that he can do a:
>
>print $obj->bar->getThing();
>
>..but he wants