php-windows Digest 26 Feb 2002 21:46:20 -0000 Issue 1019
Topics (messages 12292 through 12314):
HTTP_REFERER
12292 by: "Spycha³a, Wojciech"
12298 by: Collins, Robert
PGP, again :(
12293 by: Paul J. Smith
Re: passthru() on Win98 ??
12294 by: Sviss Cobazor
12297 by: Sviss Cobazor
12300 by: Mike Flynn
12302 by: Sviss Cobazor
12306 by: Mike Flynn
12308 by: Sviss Cobazor
12312 by: Mike Flynn
12313 by: Sviss Cobazor
PHP + ODBC
12295 by: Sebastian Timocea
12303 by: Sviss Cobazor
Bad char Output...
12296 by: -HONU-
Help, fsockopen() and binary data
12299 by: Broeker, Lance
Method get for Windows ME and PWS w/PHP-4.1.1
12301 by: Frank Tudor
12310 by: DL Neil
Windows crashes
12304 by: Aleborg
12311 by: DL Neil
Re: CHMOD
12305 by: Svensson, B.A.T. (HKG)
12307 by: Mike Eynon
pathinfo();
12309 by: Ross Fleming
12314 by: Ross Fleming
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
$HTTP_REFERER shows the address of the page which referred the browser to
the current page.
This is set by the user's browser can I set is manualy to cheat a script?
Thanks
Wojtek
--- End Message ---
--- Begin Message ---
Yes its just
<?php
$HTTP_REFERER = "bob";
?>
Robert W. Collins II
Webmaster
New Orleans Regional Transit Authority
Phone : (504) 248-3826
Email : [EMAIL PROTECTED]
-----Original Message-----
From: "Spychala, Wojciech" [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 26, 2002 2:15 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] HTTP_REFERER
$HTTP_REFERER shows the address of the page which referred the browser to
the current page.
This is set by the user's browser can I set is manualy to cheat a script?
Thanks
Wojtek
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Thought I'd solved this one, but it appears not.
Has anyone got PGP to work with PHP (windows)?? All I'm trying to do is
run a shell command to get PGP to sign a text file. I could not shell
at all to 2.6, but upgraded PGP to 6.5 then at least PGP was running,
but it can't find any of the keys when I shell to it over the web using
the php scripts. Run it from the prompt and it's fine.
If anyone is doing this with PGP could they please let me have some
details of how it was accomplished? I'm pulling my hair out here!
Thanks.
This email or attachment(s) may contain confidential or legally privileged information
intended for the sole use of the addressee(s). Any use, redistribution, disclosure, or
reproduction of this message, except as intended, is prohibited. If you received this
email in error, please notify the sender and remove all copies of the message,
including any attachments. Any views or opinions expressed in this email (unless
otherwise stated) may not represent those of Microtech Limited.
This email has been scanned for viruses by MailSafe. For more infomation please visit
http://www.microtech.co.gg/mailSafe
--- End Message ---
--- Begin Message ---
It seemed that it was Putty itself that wouldn't work for me (don't ask me
why).
So I used Telnet and it worked.
After having my advicor (this is a education project) visiting me we found
out why that passthru() function didn't work.
It's very simple really, passthru() doesn't allow spaces in paths so
"C:\program files\etc." becomes "C:\program" => false path.
Removing the application (htmldoc.exe) to "C:\" instead did the job.
For anyone else having same problems this is the correct way to type it (my
example):
<?
function topdf($filename, $options = "") {
header("Content-Type: application/pdf");
flush();
passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage $options
\"$filename\"");
}
?>
This function now works and sends the result pdf directly to the browser.
Thanks for your time Court, I wouldn't have thought of using Telnet myself
:)
~ Sviss
"Court Shrock" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> To explain the 400 bad request, you most likely had a typo when you typed
in
> the HTTP request. The request is case-sensitive and very particular.
Most
> likely, the "Host: localhost" portion of the request messed up somehow.
>
> When you get a "HTTP/1.1 200 OK" response, that means that the webserver
> accepted the request and will process your request. In order to test
> whether or not the passthru function is doing things properly, you are
> verifying what is being sent to the browser by simulating what the browser
> would send to your webserver and then what the browser is getting in
> response. It will all start to make sense when you start seeing your
files
> output--of course, in the request that I had you type, I assumed the file
> that returns the pdf is named "index.php" or whatever file your webserver
> will retrieve when it gets a root "/" request. If this is not the case,
you
> need to replace the "GET / HTTP/1.1" line with "GET /yourfile.php
HTTP/1.1"
> or even "GET /yourfile.php?var1=whatever__yougettheidea HTTP/1.1".
>
> passthru is working properly if you see something like:
> HTTP/1.1 200 OK
> Date: Mon, 25 Feb 2002 23:20:35 GMT
> Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_ssl/2.8.4 OpenSSL/0.9.6
> X-Powered-By: PHP/4.0.6
> Transfer-Encoding: chunked
> Content-Type: application/pdf
>
> [lots of binary data]
>
> it isn't working if you see something like this:
> HTTP/1.1 200 OK
> Date: Mon, 25 Feb 2002 23:20:35 GMT
> Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_ssl/2.8.4 OpenSSL/0.9.6
> X-Powered-By: PHP/4.0.6
> Transfer-Encoding: chunked
> Content-Type: text/html
>
> <html>some stupid html, or nothing at all</html>
>
> in which case, I would try a different method to verify that data is
> properly passing between php and htmldoc.exe.
>
> I hope this has addressed some of the confusion.
> Court
>
> > -----Original Message-----
> > From: Sviss Cobazor [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, February 25, 2002 5:12 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP-WIN] passthru() on Win98 ??
> >
> >
> > I followed your instructions and got:
> >
> > HTTP/1.1 400 bad request
> > > Date: Tue, 26 Feb 2002 01:05:57 GMT
> > > Server: Apache/1.3.20 (Win32)
> > > Connection: close
> > > Content-Type: text/html charset=iso-8859-1
> >
> > ... And then the same in html source ... (in the putty window)
> >
> > So I didn't get what was expected but either way I'm not sure
> > what to do if
> > I did.
--- End Message ---
--- Begin Message ---
However, sigh, IE seems to have a bug so that Acrobat Reader is only loaded
when the URL ends with ".pdf" aka IE doesn't give a rats about the header
sent to it.
Using Telnet I can see that the pdf page is returned correctly but when
using IE I still get a blank page due to the fact that no (pre-generated)
pdf document is sent to it and therefore the URL doesn't contain a
"whatever.pdf" ind the end and therefore doesn't load Acrobat Reader.
Look at this example:
header("Content-Type: application/pdf");
flush();
passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage
\"http://localhost/whatever.html\"");
This works fine with Telnet (where output is nonsense),
but doesn't with IE (where the output would make sense).
Does anyone have a solution to this?
How to get IE to understand that the data sent to it is to be handled as a
pdf document (as in load Acrobat Reader)?
"Sviss Cobazor" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> It seemed that it was Putty itself that wouldn't work for me (don't ask me
> why).
> So I used Telnet and it worked.
> After having my advicor (this is a education project) visiting me we found
> out why that passthru() function didn't work.
> It's very simple really, passthru() doesn't allow spaces in paths so
> "C:\program files\etc." becomes "C:\program" => false path.
> Removing the application (htmldoc.exe) to "C:\" instead did the job.
>
> For anyone else having same problems this is the correct way to type it
(my
> example):
>
> <?
> function topdf($filename, $options = "") {
> header("Content-Type: application/pdf");
> flush();
> passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage
$options
> \"$filename\"");
> }
> ?>
>
> This function now works and sends the result pdf directly to the browser.
>
> Thanks for your time Court, I wouldn't have thought of using Telnet myself
> :)
>
> ~ Sviss
>
> "Court Shrock" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > To explain the 400 bad request, you most likely had a typo when you
typed
> in
> > the HTTP request. The request is case-sensitive and very particular.
> Most
> > likely, the "Host: localhost" portion of the request messed up somehow.
> >
> > When you get a "HTTP/1.1 200 OK" response, that means that the webserver
> > accepted the request and will process your request. In order to test
> > whether or not the passthru function is doing things properly, you are
> > verifying what is being sent to the browser by simulating what the
browser
> > would send to your webserver and then what the browser is getting in
> > response. It will all start to make sense when you start seeing your
> files
> > output--of course, in the request that I had you type, I assumed the
file
> > that returns the pdf is named "index.php" or whatever file your
webserver
> > will retrieve when it gets a root "/" request. If this is not the case,
> you
> > need to replace the "GET / HTTP/1.1" line with "GET /yourfile.php
> HTTP/1.1"
> > or even "GET /yourfile.php?var1=whatever__yougettheidea HTTP/1.1".
> >
> > passthru is working properly if you see something like:
> > HTTP/1.1 200 OK
> > Date: Mon, 25 Feb 2002 23:20:35 GMT
> > Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_ssl/2.8.4 OpenSSL/0.9.6
> > X-Powered-By: PHP/4.0.6
> > Transfer-Encoding: chunked
> > Content-Type: application/pdf
> >
> > [lots of binary data]
> >
> > it isn't working if you see something like this:
> > HTTP/1.1 200 OK
> > Date: Mon, 25 Feb 2002 23:20:35 GMT
> > Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_ssl/2.8.4 OpenSSL/0.9.6
> > X-Powered-By: PHP/4.0.6
> > Transfer-Encoding: chunked
> > Content-Type: text/html
> >
> > <html>some stupid html, or nothing at all</html>
> >
> > in which case, I would try a different method to verify that data is
> > properly passing between php and htmldoc.exe.
> >
> > I hope this has addressed some of the confusion.
> > Court
> >
> > > -----Original Message-----
> > > From: Sviss Cobazor [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, February 25, 2002 5:12 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: [PHP-WIN] passthru() on Win98 ??
> > >
> > >
> > > I followed your instructions and got:
> > >
> > > HTTP/1.1 400 bad request
> > > > Date: Tue, 26 Feb 2002 01:05:57 GMT
> > > > Server: Apache/1.3.20 (Win32)
> > > > Connection: close
> > > > Content-Type: text/html charset=iso-8859-1
> > >
> > > ... And then the same in html source ... (in the putty window)
> > >
> > > So I didn't get what was expected but either way I'm not sure
> > > what to do if
> > > I did.
>
>
--- End Message ---
--- Begin Message ---
Yes, this has been documented extensively on the web. The fix is to put a
pdf extension at the end of the url call to your script that is returning
the pdf file. You can use an arbitrary filename ending in .pdf, or you can
use the actual filename of the .pdf file, which would be preferable so that
if the user tries to save the .pdf file, the default filename is
correct. So what this means is that the script that is linking to your
.pdf-returning script needs to know the filename/that it is a .pdf file,
ahead of time. So you want to do something like this:
<?php
$query = 'SELECT strFileFilename FROM tblFiles ';
$query .= "WHERE intFileID=$id";
$filename = mysql_result(mysql_query($query), 0);
print "<a href=\"/stuff/getfile.php?id=$id/$filename\">Here's the PDF</a>\n";
?>
-Mike
At 03:09 PM 2/26/2002 +0100, Sviss Cobazor wrote:
>However, sigh, IE seems to have a bug so that Acrobat Reader is only loaded
>when the URL ends with ".pdf" aka IE doesn't give a rats about the header
>sent to it.
>Using Telnet I can see that the pdf page is returned correctly but when
>using IE I still get a blank page due to the fact that no (pre-generated)
>pdf document is sent to it and therefore the URL doesn't contain a
>"whatever.pdf" ind the end and therefore doesn't load Acrobat Reader.
>Look at this example:
>
>header("Content-Type: application/pdf");
>flush();
>passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage
>\"http://localhost/whatever.html\"");
>
>This works fine with Telnet (where output is nonsense),
>but doesn't with IE (where the output would make sense).
>
>Does anyone have a solution to this?
>How to get IE to understand that the data sent to it is to be handled as a
>pdf document (as in load Acrobat Reader)?
>
>
>
>"Sviss Cobazor" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > It seemed that it was Putty itself that wouldn't work for me (don't ask me
> > why).
> > So I used Telnet and it worked.
> > After having my advicor (this is a education project) visiting me we found
> > out why that passthru() function didn't work.
> > It's very simple really, passthru() doesn't allow spaces in paths so
> > "C:\program files\etc." becomes "C:\program" => false path.
> > Removing the application (htmldoc.exe) to "C:\" instead did the job.
> >
> > For anyone else having same problems this is the correct way to type it
>(my
> > example):
> >
> > <?
> > function topdf($filename, $options = "") {
> > header("Content-Type: application/pdf");
> > flush();
> > passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage
>$options
> > \"$filename\"");
> > }
> > ?>
> >
> > This function now works and sends the result pdf directly to the browser.
> >
> > Thanks for your time Court, I wouldn't have thought of using Telnet myself
> > :)
> >
> > ~ Sviss
> >
> > "Court Shrock" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > To explain the 400 bad request, you most likely had a typo when you
>typed
> > in
> > > the HTTP request. The request is case-sensitive and very particular.
> > Most
> > > likely, the "Host: localhost" portion of the request messed up somehow.
> > >
> > > When you get a "HTTP/1.1 200 OK" response, that means that the webserver
> > > accepted the request and will process your request. In order to test
> > > whether or not the passthru function is doing things properly, you are
> > > verifying what is being sent to the browser by simulating what the
>browser
> > > would send to your webserver and then what the browser is getting in
> > > response. It will all start to make sense when you start seeing your
> > files
> > > output--of course, in the request that I had you type, I assumed the
>file
> > > that returns the pdf is named "index.php" or whatever file your
>webserver
> > > will retrieve when it gets a root "/" request. If this is not the case,
> > you
> > > need to replace the "GET / HTTP/1.1" line with "GET /yourfile.php
> > HTTP/1.1"
> > > or even "GET /yourfile.php?var1=whatever__yougettheidea HTTP/1.1".
> > >
> > > passthru is working properly if you see something like:
> > > HTTP/1.1 200 OK
> > > Date: Mon, 25 Feb 2002 23:20:35 GMT
> > > Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_ssl/2.8.4 OpenSSL/0.9.6
> > > X-Powered-By: PHP/4.0.6
> > > Transfer-Encoding: chunked
> > > Content-Type: application/pdf
> > >
> > > [lots of binary data]
> > >
> > > it isn't working if you see something like this:
> > > HTTP/1.1 200 OK
> > > Date: Mon, 25 Feb 2002 23:20:35 GMT
> > > Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_ssl/2.8.4 OpenSSL/0.9.6
> > > X-Powered-By: PHP/4.0.6
> > > Transfer-Encoding: chunked
> > > Content-Type: text/html
> > >
> > > <html>some stupid html, or nothing at all</html>
> > >
> > > in which case, I would try a different method to verify that data is
> > > properly passing between php and htmldoc.exe.
> > >
> > > I hope this has addressed some of the confusion.
> > > Court
> > >
> > > > -----Original Message-----
> > > > From: Sviss Cobazor [mailto:[EMAIL PROTECTED]]
> > > > Sent: Monday, February 25, 2002 5:12 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Re: [PHP-WIN] passthru() on Win98 ??
> > > >
> > > >
> > > > I followed your instructions and got:
> > > >
> > > > HTTP/1.1 400 bad request
> > > > > Date: Tue, 26 Feb 2002 01:05:57 GMT
> > > > > Server: Apache/1.3.20 (Win32)
> > > > > Connection: close
> > > > > Content-Type: text/html charset=iso-8859-1
> > > >
> > > > ... And then the same in html source ... (in the putty window)
> > > >
> > > > So I didn't get what was expected but either way I'm not sure
> > > > what to do if
> > > > I did.
> >
> >
>
>
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
-- Mike Flynn - Burlington, VT --
mike @ mikeflynn.net
http://www.mikeflynn.net/
home=>work=>home=>store=>home [adbusters]
--- End Message ---
--- Begin Message ---
Hmm in my case there is no file to link to. The pdf document doesn't exist,
it's generated on-the-fly. Take this example:
test.php contains:
<?
function topdf($file, $options = "") {
header("Content-Type: application/pdf");
flush();
passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage $options
\"$file\"");
}
$url = "http://localhost/whatever.html";
topdf($url);
?>
So the idea was to write the address "http://localhost/test.php" and the
browser would load Acrobat Reader and show the pdf document generated from
"whatever.html".
So how do I get the ".pdf" added?
By typing the address "http://localhost/test.php?.pdf" ? Doesn't seem to
work.
"Mike Flynn" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Yes, this has been documented extensively on the web. The fix is to put a
> pdf extension at the end of the url call to your script that is returning
> the pdf file. You can use an arbitrary filename ending in .pdf, or you
can
> use the actual filename of the .pdf file, which would be preferable so
that
> if the user tries to save the .pdf file, the default filename is
> correct. So what this means is that the script that is linking to your
> .pdf-returning script needs to know the filename/that it is a .pdf file,
> ahead of time. So you want to do something like this:
>
> <?php
> $query = 'SELECT strFileFilename FROM tblFiles ';
> $query .= "WHERE intFileID=$id";
> $filename = mysql_result(mysql_query($query), 0);
> print "<a href=\"/stuff/getfile.php?id=$id/$filename\">Here's the
PDF</a>\n";
> ?>
>
> -Mike
>
> At 03:09 PM 2/26/2002 +0100, Sviss Cobazor wrote:
> >However, sigh, IE seems to have a bug so that Acrobat Reader is only
loaded
> >when the URL ends with ".pdf" aka IE doesn't give a rats about the header
> >sent to it.
> >Using Telnet I can see that the pdf page is returned correctly but when
> >using IE I still get a blank page due to the fact that no (pre-generated)
> >pdf document is sent to it and therefore the URL doesn't contain a
> >"whatever.pdf" ind the end and therefore doesn't load Acrobat Reader.
> >Look at this example:
> >
> >header("Content-Type: application/pdf");
> >flush();
> >passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage
> >\"http://localhost/whatever.html\"");
> >
> >This works fine with Telnet (where output is nonsense),
> >but doesn't with IE (where the output would make sense).
> >
> >Does anyone have a solution to this?
> >How to get IE to understand that the data sent to it is to be handled as
a
> >pdf document (as in load Acrobat Reader)?
> >
> >
> >
> >"Sviss Cobazor" <[EMAIL PROTECTED]> wrote in message
> >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > It seemed that it was Putty itself that wouldn't work for me (don't
ask me
> > > why).
> > > So I used Telnet and it worked.
> > > After having my advicor (this is a education project) visiting me we
found
> > > out why that passthru() function didn't work.
> > > It's very simple really, passthru() doesn't allow spaces in paths so
> > > "C:\program files\etc." becomes "C:\program" => false path.
> > > Removing the application (htmldoc.exe) to "C:\" instead did the job.
> > >
> > > For anyone else having same problems this is the correct way to type
it
> >(my
> > > example):
> > >
> > > <?
> > > function topdf($filename, $options = "") {
> > > header("Content-Type: application/pdf");
> > > flush();
> > > passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage
> >$options
> > > \"$filename\"");
> > > }
> > > ?>
> > >
> > > This function now works and sends the result pdf directly to the
browser.
> > >
> > > Thanks for your time Court, I wouldn't have thought of using Telnet
myself
> > > :)
> > >
> > > ~ Sviss
> > >
> > > "Court Shrock" <[EMAIL PROTECTED]> wrote in message
> > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > To explain the 400 bad request, you most likely had a typo when you
> >typed
> > > in
> > > > the HTTP request. The request is case-sensitive and very
particular.
> > > Most
> > > > likely, the "Host: localhost" portion of the request messed up
somehow.
> > > >
> > > > When you get a "HTTP/1.1 200 OK" response, that means that the
webserver
> > > > accepted the request and will process your request. In order to
test
> > > > whether or not the passthru function is doing things properly, you
are
> > > > verifying what is being sent to the browser by simulating what the
> >browser
> > > > would send to your webserver and then what the browser is getting in
> > > > response. It will all start to make sense when you start seeing
your
> > > files
> > > > output--of course, in the request that I had you type, I assumed the
> >file
> > > > that returns the pdf is named "index.php" or whatever file your
> >webserver
> > > > will retrieve when it gets a root "/" request. If this is not the
case,
> > > you
> > > > need to replace the "GET / HTTP/1.1" line with "GET /yourfile.php
> > > HTTP/1.1"
> > > > or even "GET /yourfile.php?var1=whatever__yougettheidea HTTP/1.1".
> > > >
> > > > passthru is working properly if you see something like:
> > > > HTTP/1.1 200 OK
> > > > Date: Mon, 25 Feb 2002 23:20:35 GMT
> > > > Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_ssl/2.8.4 OpenSSL/0.9.6
> > > > X-Powered-By: PHP/4.0.6
> > > > Transfer-Encoding: chunked
> > > > Content-Type: application/pdf
> > > >
> > > > [lots of binary data]
> > > >
> > > > it isn't working if you see something like this:
> > > > HTTP/1.1 200 OK
> > > > Date: Mon, 25 Feb 2002 23:20:35 GMT
> > > > Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_ssl/2.8.4 OpenSSL/0.9.6
> > > > X-Powered-By: PHP/4.0.6
> > > > Transfer-Encoding: chunked
> > > > Content-Type: text/html
> > > >
> > > > <html>some stupid html, or nothing at all</html>
> > > >
> > > > in which case, I would try a different method to verify that data is
> > > > properly passing between php and htmldoc.exe.
> > > >
> > > > I hope this has addressed some of the confusion.
> > > > Court
> > > >
> > > > > -----Original Message-----
> > > > > From: Sviss Cobazor [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Monday, February 25, 2002 5:12 PM
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: Re: [PHP-WIN] passthru() on Win98 ??
> > > > >
> > > > >
> > > > > I followed your instructions and got:
> > > > >
> > > > > HTTP/1.1 400 bad request
> > > > > > Date: Tue, 26 Feb 2002 01:05:57 GMT
> > > > > > Server: Apache/1.3.20 (Win32)
> > > > > > Connection: close
> > > > > > Content-Type: text/html charset=iso-8859-1
> > > > >
> > > > > ... And then the same in html source ... (in the putty window)
> > > > >
> > > > > So I didn't get what was expected but either way I'm not sure
> > > > > what to do if
> > > > > I did.
> > >
> > >
> >
> >
> >
> >--
> >PHP Windows Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> -- Mike Flynn - Burlington, VT --
> mike @ mikeflynn.net
> http://www.mikeflynn.net/
> home=>work=>home=>store=>home [adbusters]
>
--- End Message ---
--- Begin Message ---
Use a slash and then the filename.pdf. So
http://whatever/stuff.php?options/desired_filename.pdf would do it. It's
ok that you aren't linking to a real file, it doesn't matter. Just the
file that you want the .pdf document to be known as to the user's browser.
At 05:07 PM 2/26/2002 +0100, Sviss Cobazor wrote:
>Hmm in my case there is no file to link to. The pdf document doesn't exist,
>it's generated on-the-fly. Take this example:
>
>test.php contains:
>
><?
>function topdf($file, $options = "") {
> header("Content-Type: application/pdf");
> flush();
> passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage $options
>\"$file\"");
>}
>
>$url = "http://localhost/whatever.html";
>
>topdf($url);
>?>
>
>So the idea was to write the address "http://localhost/test.php" and the
>browser would load Acrobat Reader and show the pdf document generated from
>"whatever.html".
>
>So how do I get the ".pdf" added?
>By typing the address "http://localhost/test.php?.pdf" ? Doesn't seem to
>work.
>
>"Mike Flynn" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Yes, this has been documented extensively on the web. The fix is to put a
> > pdf extension at the end of the url call to your script that is returning
> > the pdf file. You can use an arbitrary filename ending in .pdf, or you
>can
> > use the actual filename of the .pdf file, which would be preferable so
>that
> > if the user tries to save the .pdf file, the default filename is
> > correct. So what this means is that the script that is linking to your
> > .pdf-returning script needs to know the filename/that it is a .pdf file,
> > ahead of time. So you want to do something like this:
> >
> > <?php
> > $query = 'SELECT strFileFilename FROM tblFiles ';
> > $query .= "WHERE intFileID=$id";
> > $filename = mysql_result(mysql_query($query), 0);
> > print "<a href=\"/stuff/getfile.php?id=$id/$filename\">Here's the
>PDF</a>\n";
> > ?>
> >
> > -Mike
> >
> > At 03:09 PM 2/26/2002 +0100, Sviss Cobazor wrote:
> > >However, sigh, IE seems to have a bug so that Acrobat Reader is only
>loaded
> > >when the URL ends with ".pdf" aka IE doesn't give a rats about the header
> > >sent to it.
> > >Using Telnet I can see that the pdf page is returned correctly but when
> > >using IE I still get a blank page due to the fact that no (pre-generated)
> > >pdf document is sent to it and therefore the URL doesn't contain a
> > >"whatever.pdf" ind the end and therefore doesn't load Acrobat Reader.
> > >Look at this example:
> > >
> > >header("Content-Type: application/pdf");
> > >flush();
> > >passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage
> > >\"http://localhost/whatever.html\"");
> > >
> > >This works fine with Telnet (where output is nonsense),
> > >but doesn't with IE (where the output would make sense).
> > >
> > >Does anyone have a solution to this?
> > >How to get IE to understand that the data sent to it is to be handled as
>a
> > >pdf document (as in load Acrobat Reader)?
> > >
> > >
> > >
> > >"Sviss Cobazor" <[EMAIL PROTECTED]> wrote in message
> > >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > It seemed that it was Putty itself that wouldn't work for me (don't
>ask me
> > > > why).
> > > > So I used Telnet and it worked.
> > > > After having my advicor (this is a education project) visiting me we
>found
> > > > out why that passthru() function didn't work.
> > > > It's very simple really, passthru() doesn't allow spaces in paths so
> > > > "C:\program files\etc." becomes "C:\program" => false path.
> > > > Removing the application (htmldoc.exe) to "C:\" instead did the job.
> > > >
> > > > For anyone else having same problems this is the correct way to type
>it
> > >(my
> > > > example):
> > > >
> > > > <?
> > > > function topdf($filename, $options = "") {
> > > > header("Content-Type: application/pdf");
> > > > flush();
> > > > passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage
> > >$options
> > > > \"$filename\"");
> > > > }
> > > > ?>
> > > >
> > > > This function now works and sends the result pdf directly to the
>browser.
> > > >
> > > > Thanks for your time Court, I wouldn't have thought of using Telnet
>myself
> > > > :)
> > > >
> > > > ~ Sviss
> > > >
> > > > "Court Shrock" <[EMAIL PROTECTED]> wrote in message
> > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > > To explain the 400 bad request, you most likely had a typo when you
> > >typed
> > > > in
> > > > > the HTTP request. The request is case-sensitive and very
>particular.
> > > > Most
> > > > > likely, the "Host: localhost" portion of the request messed up
>somehow.
> > > > >
> > > > > When you get a "HTTP/1.1 200 OK" response, that means that the
>webserver
> > > > > accepted the request and will process your request. In order to
>test
> > > > > whether or not the passthru function is doing things properly, you
>are
> > > > > verifying what is being sent to the browser by simulating what the
> > >browser
> > > > > would send to your webserver and then what the browser is getting in
> > > > > response. It will all start to make sense when you start seeing
>your
> > > > files
> > > > > output--of course, in the request that I had you type, I assumed the
> > >file
> > > > > that returns the pdf is named "index.php" or whatever file your
> > >webserver
> > > > > will retrieve when it gets a root "/" request. If this is not the
>case,
> > > > you
> > > > > need to replace the "GET / HTTP/1.1" line with "GET /yourfile.php
> > > > HTTP/1.1"
> > > > > or even "GET /yourfile.php?var1=whatever__yougettheidea HTTP/1.1".
> > > > >
> > > > > passthru is working properly if you see something like:
> > > > > HTTP/1.1 200 OK
> > > > > Date: Mon, 25 Feb 2002 23:20:35 GMT
> > > > > Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_ssl/2.8.4 OpenSSL/0.9.6
> > > > > X-Powered-By: PHP/4.0.6
> > > > > Transfer-Encoding: chunked
> > > > > Content-Type: application/pdf
> > > > >
> > > > > [lots of binary data]
> > > > >
> > > > > it isn't working if you see something like this:
> > > > > HTTP/1.1 200 OK
> > > > > Date: Mon, 25 Feb 2002 23:20:35 GMT
> > > > > Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_ssl/2.8.4 OpenSSL/0.9.6
> > > > > X-Powered-By: PHP/4.0.6
> > > > > Transfer-Encoding: chunked
> > > > > Content-Type: text/html
> > > > >
> > > > > <html>some stupid html, or nothing at all</html>
> > > > >
> > > > > in which case, I would try a different method to verify that data is
> > > > > properly passing between php and htmldoc.exe.
> > > > >
> > > > > I hope this has addressed some of the confusion.
> > > > > Court
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Sviss Cobazor [mailto:[EMAIL PROTECTED]]
> > > > > > Sent: Monday, February 25, 2002 5:12 PM
> > > > > > To: [EMAIL PROTECTED]
> > > > > > Subject: Re: [PHP-WIN] passthru() on Win98 ??
> > > > > >
> > > > > >
> > > > > > I followed your instructions and got:
> > > > > >
> > > > > > HTTP/1.1 400 bad request
> > > > > > > Date: Tue, 26 Feb 2002 01:05:57 GMT
> > > > > > > Server: Apache/1.3.20 (Win32)
> > > > > > > Connection: close
> > > > > > > Content-Type: text/html charset=iso-8859-1
> > > > > >
> > > > > > ... And then the same in html source ... (in the putty window)
> > > > > >
> > > > > > So I didn't get what was expected but either way I'm not sure
> > > > > > what to do if
> > > > > > I did.
> > > >
> > > >
> > >
> > >
> > >
> > >--
> > >PHP Windows Mailing List (http://www.php.net/)
> > >To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> > -- Mike Flynn - Burlington, VT --
> > mike @ mikeflynn.net
> > http://www.mikeflynn.net/
> > home=>work=>home=>store=>home [adbusters]
> >
>
>
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
-- Mike Flynn - Burlington, VT --
mike @ mikeflynn.net
http://www.mikeflynn.net/
home=>work=>home=>store=>home [adbusters]
--- End Message ---
--- Begin Message ---
Is the example below meant to go into a link (<a href=***></a>)?
Or is it meant for the address field on the browser?
If I type "http://localhost/test.php/whatever.pdf" in the address field I
get a server error which I was also expecting to be hornest. I don't see how
that should work.
"Mike Flynn" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Use a slash and then the filename.pdf. So
> http://whatever/stuff.php?options/desired_filename.pdf would do it. It's
> ok that you aren't linking to a real file, it doesn't matter. Just the
> file that you want the .pdf document to be known as to the user's browser.
>
> At 05:07 PM 2/26/2002 +0100, Sviss Cobazor wrote:
> >Hmm in my case there is no file to link to. The pdf document doesn't
exist,
> >it's generated on-the-fly. Take this example:
> >
> >test.php contains:
> >
> ><?
> >function topdf($file, $options = "") {
> > header("Content-Type: application/pdf");
> > flush();
> > passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage $options
> >\"$file\"");
> >}
> >
> >$url = "http://localhost/whatever.html";
> >
> >topdf($url);
> >?>
> >
> >So the idea was to write the address "http://localhost/test.php" and the
> >browser would load Acrobat Reader and show the pdf document generated
from
> >"whatever.html".
> >
> >So how do I get the ".pdf" added?
> >By typing the address "http://localhost/test.php?.pdf" ? Doesn't seem to
> >work.
> >
> >"Mike Flynn" <[EMAIL PROTECTED]> wrote in message
> >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Yes, this has been documented extensively on the web. The fix is to
put a
> > > pdf extension at the end of the url call to your script that is
returning
> > > the pdf file. You can use an arbitrary filename ending in .pdf, or
you
> >can
> > > use the actual filename of the .pdf file, which would be preferable so
> >that
> > > if the user tries to save the .pdf file, the default filename is
> > > correct. So what this means is that the script that is linking to
your
> > > .pdf-returning script needs to know the filename/that it is a .pdf
file,
> > > ahead of time. So you want to do something like this:
> > >
> > > <?php
> > > $query = 'SELECT strFileFilename FROM tblFiles ';
> > > $query .= "WHERE intFileID=$id";
> > > $filename = mysql_result(mysql_query($query), 0);
> > > print "<a href=\"/stuff/getfile.php?id=$id/$filename\">Here's the
> >PDF</a>\n";
> > > ?>
> > >
> > > -Mike
> > >
> > > At 03:09 PM 2/26/2002 +0100, Sviss Cobazor wrote:
> > > >However, sigh, IE seems to have a bug so that Acrobat Reader is only
> >loaded
> > > >when the URL ends with ".pdf" aka IE doesn't give a rats about the
header
> > > >sent to it.
> > > >Using Telnet I can see that the pdf page is returned correctly but
when
> > > >using IE I still get a blank page due to the fact that no
(pre-generated)
> > > >pdf document is sent to it and therefore the URL doesn't contain a
> > > >"whatever.pdf" ind the end and therefore doesn't load Acrobat Reader.
> > > >Look at this example:
> > > >
> > > >header("Content-Type: application/pdf");
> > > >flush();
> > > >passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage
> > > >\"http://localhost/whatever.html\"");
> > > >
> > > >This works fine with Telnet (where output is nonsense),
> > > >but doesn't with IE (where the output would make sense).
> > > >
> > > >Does anyone have a solution to this?
> > > >How to get IE to understand that the data sent to it is to be handled
as
> >a
> > > >pdf document (as in load Acrobat Reader)?
> > > >
> > > >
> > > >
> > > >"Sviss Cobazor" <[EMAIL PROTECTED]> wrote in message
> > > >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > > It seemed that it was Putty itself that wouldn't work for me
(don't
> >ask me
> > > > > why).
> > > > > So I used Telnet and it worked.
> > > > > After having my advicor (this is a education project) visiting me
we
> >found
> > > > > out why that passthru() function didn't work.
> > > > > It's very simple really, passthru() doesn't allow spaces in paths
so
> > > > > "C:\program files\etc." becomes "C:\program" => false path.
> > > > > Removing the application (htmldoc.exe) to "C:\" instead did the
job.
> > > > >
> > > > > For anyone else having same problems this is the correct way to
type
> >it
> > > >(my
> > > > > example):
> > > > >
> > > > > <?
> > > > > function topdf($filename, $options = "") {
> > > > > header("Content-Type: application/pdf");
> > > > > flush();
> > > > > passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage
> > > >$options
> > > > > \"$filename\"");
> > > > > }
> > > > > ?>
> > > > >
> > > > > This function now works and sends the result pdf directly to the
> >browser.
> > > > >
> > > > > Thanks for your time Court, I wouldn't have thought of using
Telnet
> >myself
> > > > > :)
> > > > >
> > > > > ~ Sviss
> > > > >
> > > > > "Court Shrock" <[EMAIL PROTECTED]> wrote in message
> > > > >
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > > > To explain the 400 bad request, you most likely had a typo when
you
> > > >typed
> > > > > in
> > > > > > the HTTP request. The request is case-sensitive and very
> >particular.
> > > > > Most
> > > > > > likely, the "Host: localhost" portion of the request messed up
> >somehow.
> > > > > >
> > > > > > When you get a "HTTP/1.1 200 OK" response, that means that the
> >webserver
> > > > > > accepted the request and will process your request. In order to
> >test
> > > > > > whether or not the passthru function is doing things properly,
you
> >are
> > > > > > verifying what is being sent to the browser by simulating what
the
> > > >browser
> > > > > > would send to your webserver and then what the browser is
getting in
> > > > > > response. It will all start to make sense when you start seeing
> >your
> > > > > files
> > > > > > output--of course, in the request that I had you type, I assumed
the
> > > >file
> > > > > > that returns the pdf is named "index.php" or whatever file your
> > > >webserver
> > > > > > will retrieve when it gets a root "/" request. If this is not
the
> >case,
> > > > > you
> > > > > > need to replace the "GET / HTTP/1.1" line with "GET
/yourfile.php
> > > > > HTTP/1.1"
> > > > > > or even "GET /yourfile.php?var1=whatever__yougettheidea
HTTP/1.1".
> > > > > >
> > > > > > passthru is working properly if you see something like:
> > > > > > HTTP/1.1 200 OK
> > > > > > Date: Mon, 25 Feb 2002 23:20:35 GMT
> > > > > > Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_ssl/2.8.4
OpenSSL/0.9.6
> > > > > > X-Powered-By: PHP/4.0.6
> > > > > > Transfer-Encoding: chunked
> > > > > > Content-Type: application/pdf
> > > > > >
> > > > > > [lots of binary data]
> > > > > >
> > > > > > it isn't working if you see something like this:
> > > > > > HTTP/1.1 200 OK
> > > > > > Date: Mon, 25 Feb 2002 23:20:35 GMT
> > > > > > Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_ssl/2.8.4
OpenSSL/0.9.6
> > > > > > X-Powered-By: PHP/4.0.6
> > > > > > Transfer-Encoding: chunked
> > > > > > Content-Type: text/html
> > > > > >
> > > > > > <html>some stupid html, or nothing at all</html>
> > > > > >
> > > > > > in which case, I would try a different method to verify that
data is
> > > > > > properly passing between php and htmldoc.exe.
> > > > > >
> > > > > > I hope this has addressed some of the confusion.
> > > > > > Court
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Sviss Cobazor [mailto:[EMAIL PROTECTED]]
> > > > > > > Sent: Monday, February 25, 2002 5:12 PM
> > > > > > > To: [EMAIL PROTECTED]
> > > > > > > Subject: Re: [PHP-WIN] passthru() on Win98 ??
> > > > > > >
> > > > > > >
> > > > > > > I followed your instructions and got:
> > > > > > >
> > > > > > > HTTP/1.1 400 bad request
> > > > > > > > Date: Tue, 26 Feb 2002 01:05:57 GMT
> > > > > > > > Server: Apache/1.3.20 (Win32)
> > > > > > > > Connection: close
> > > > > > > > Content-Type: text/html charset=iso-8859-1
> > > > > > >
> > > > > > > ... And then the same in html source ... (in the putty window)
> > > > > > >
> > > > > > > So I didn't get what was expected but either way I'm not sure
> > > > > > > what to do if
> > > > > > > I did.
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >--
> > > >PHP Windows Mailing List (http://www.php.net/)
> > > >To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > > -- Mike Flynn - Burlington, VT --
> > > mike @ mikeflynn.net
> > > http://www.mikeflynn.net/
> > > home=>work=>home=>store=>home [adbusters]
> > >
> >
> >
> >
> >--
> >PHP Windows Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> -- Mike Flynn - Burlington, VT --
> mike @ mikeflynn.net
> http://www.mikeflynn.net/
> home=>work=>home=>store=>home [adbusters]
>
--- End Message ---
--- Begin Message ---
It goes into a link to whatever PHP file you're using to return the
contents of the .PDF. It would work in the address field in the browser,
too. I don't see why you're typing http://localhost/test.php/whatever.pdf
into the address field since that isn't the URL I told you to use. I said:
http://whatever/stuff.php?options/desired_filename.pdf
As you can see, instead of stuff.php put the name of the php file that has
your code to return the binary contents of the .pdf file. You can follow
it with whatever optional parameters you want in the query string (i/e
after the '?' question mark), either way, make sure at the very end of the
address is a slash '/' followed by the desired filename you want to use,
ending in .pdf.
-Mike
At 05:58 PM 2/26/02 +0100, you wrote:
>Is the example below meant to go into a link (<a href=***></a>)?
>Or is it meant for the address field on the browser?
>If I type "http://localhost/test.php/whatever.pdf" in the address field I
>get a server error which I was also expecting to be hornest. I don't see how
>that should work.
>
>
>"Mike Flynn" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Use a slash and then the filename.pdf. So
> > http://whatever/stuff.php?options/desired_filename.pdf would do it. It's
> > ok that you aren't linking to a real file, it doesn't matter. Just the
> > file that you want the .pdf document to be known as to the user's browser.
> >
> > At 05:07 PM 2/26/2002 +0100, Sviss Cobazor wrote:
> > >Hmm in my case there is no file to link to. The pdf document doesn't
>exist,
> > >it's generated on-the-fly. Take this example:
> > >
> > >test.php contains:
> > >
> > ><?
> > >function topdf($file, $options = "") {
> > > header("Content-Type: application/pdf");
> > > flush();
> > > passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage $options
> > >\"$file\"");
> > >}
> > >
> > >$url = "http://localhost/whatever.html";
> > >
> > >topdf($url);
> > >?>
> > >
> > >So the idea was to write the address "http://localhost/test.php" and the
> > >browser would load Acrobat Reader and show the pdf document generated
>from
> > >"whatever.html".
> > >
> > >So how do I get the ".pdf" added?
> > >By typing the address "http://localhost/test.php?.pdf" ? Doesn't seem to
> > >work.
> > >
> > >"Mike Flynn" <[EMAIL PROTECTED]> wrote in message
> > >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > Yes, this has been documented extensively on the web. The fix is to
>put a
> > > > pdf extension at the end of the url call to your script that is
>returning
> > > > the pdf file. You can use an arbitrary filename ending in .pdf, or
>you
> > >can
> > > > use the actual filename of the .pdf file, which would be preferable so
> > >that
> > > > if the user tries to save the .pdf file, the default filename is
> > > > correct. So what this means is that the script that is linking to
>your
> > > > .pdf-returning script needs to know the filename/that it is a .pdf
>file,
> > > > ahead of time. So you want to do something like this:
> > > >
> > > > <?php
> > > > $query = 'SELECT strFileFilename FROM tblFiles ';
> > > > $query .= "WHERE intFileID=$id";
> > > > $filename = mysql_result(mysql_query($query), 0);
> > > > print "<a href=\"/stuff/getfile.php?id=$id/$filename\">Here's the
> > >PDF</a>\n";
> > > > ?>
> > > >
> > > > -Mike
> > > >
> > > > At 03:09 PM 2/26/2002 +0100, Sviss Cobazor wrote:
> > > > >However, sigh, IE seems to have a bug so that Acrobat Reader is only
> > >loaded
> > > > >when the URL ends with ".pdf" aka IE doesn't give a rats about the
>header
> > > > >sent to it.
> > > > >Using Telnet I can see that the pdf page is returned correctly but
>when
> > > > >using IE I still get a blank page due to the fact that no
>(pre-generated)
> > > > >pdf document is sent to it and therefore the URL doesn't contain a
> > > > >"whatever.pdf" ind the end and therefore doesn't load Acrobat Reader.
> > > > >Look at this example:
> > > > >
> > > > >header("Content-Type: application/pdf");
> > > > >flush();
> > > > >passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage
> > > > >\"http://localhost/whatever.html\"");
> > > > >
> > > > >This works fine with Telnet (where output is nonsense),
> > > > >but doesn't with IE (where the output would make sense).
> > > > >
> > > > >Does anyone have a solution to this?
> > > > >How to get IE to understand that the data sent to it is to be handled
>as
> > >a
> > > > >pdf document (as in load Acrobat Reader)?
> > > > >
> > > > >
> > > > >
> > > > >"Sviss Cobazor" <[EMAIL PROTECTED]> wrote in message
> > > > >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > > > It seemed that it was Putty itself that wouldn't work for me
>(don't
> > >ask me
> > > > > > why).
> > > > > > So I used Telnet and it worked.
> > > > > > After having my advicor (this is a education project) visiting me
>we
> > >found
> > > > > > out why that passthru() function didn't work.
> > > > > > It's very simple really, passthru() doesn't allow spaces in paths
>so
> > > > > > "C:\program files\etc." becomes "C:\program" => false path.
> > > > > > Removing the application (htmldoc.exe) to "C:\" instead did the
>job.
> > > > > >
> > > > > > For anyone else having same problems this is the correct way to
>type
> > >it
> > > > >(my
> > > > > > example):
> > > > > >
> > > > > > <?
> > > > > > function topdf($filename, $options = "") {
> > > > > > header("Content-Type: application/pdf");
> > > > > > flush();
> > > > > > passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage
> > > > >$options
> > > > > > \"$filename\"");
> > > > > > }
> > > > > > ?>
> > > > > >
> > > > > > This function now works and sends the result pdf directly to the
> > >browser.
> > > > > >
> > > > > > Thanks for your time Court, I wouldn't have thought of using
>Telnet
> > >myself
> > > > > > :)
> > > > > >
> > > > > > ~ Sviss
> > > > > >
> > > > > > "Court Shrock" <[EMAIL PROTECTED]> wrote in message
> > > > > >
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > > > > To explain the 400 bad request, you most likely had a typo when
>you
> > > > >typed
> > > > > > in
> > > > > > > the HTTP request. The request is case-sensitive and very
> > >particular.
> > > > > > Most
> > > > > > > likely, the "Host: localhost" portion of the request messed up
> > >somehow.
> > > > > > >
> > > > > > > When you get a "HTTP/1.1 200 OK" response, that means that the
> > >webserver
> > > > > > > accepted the request and will process your request. In order to
> > >test
> > > > > > > whether or not the passthru function is doing things properly,
>you
> > >are
> > > > > > > verifying what is being sent to the browser by simulating what
>the
> > > > >browser
> > > > > > > would send to your webserver and then what the browser is
>getting in
> > > > > > > response. It will all start to make sense when you start seeing
> > >your
> > > > > > files
> > > > > > > output--of course, in the request that I had you type, I assumed
>the
> > > > >file
> > > > > > > that returns the pdf is named "index.php" or whatever file your
> > > > >webserver
> > > > > > > will retrieve when it gets a root "/" request. If this is not
>the
> > >case,
> > > > > > you
> > > > > > > need to replace the "GET / HTTP/1.1" line with "GET
>/yourfile.php
> > > > > > HTTP/1.1"
> > > > > > > or even "GET /yourfile.php?var1=whatever__yougettheidea
>HTTP/1.1".
> > > > > > >
> > > > > > > passthru is working properly if you see something like:
> > > > > > > HTTP/1.1 200 OK
> > > > > > > Date: Mon, 25 Feb 2002 23:20:35 GMT
> > > > > > > Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_ssl/2.8.4
>OpenSSL/0.9.6
> > > > > > > X-Powered-By: PHP/4.0.6
> > > > > > > Transfer-Encoding: chunked
> > > > > > > Content-Type: application/pdf
> > > > > > >
> > > > > > > [lots of binary data]
> > > > > > >
> > > > > > > it isn't working if you see something like this:
> > > > > > > HTTP/1.1 200 OK
> > > > > > > Date: Mon, 25 Feb 2002 23:20:35 GMT
> > > > > > > Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_ssl/2.8.4
>OpenSSL/0.9.6
> > > > > > > X-Powered-By: PHP/4.0.6
> > > > > > > Transfer-Encoding: chunked
> > > > > > > Content-Type: text/html
> > > > > > >
> > > > > > > <html>some stupid html, or nothing at all</html>
> > > > > > >
> > > > > > > in which case, I would try a different method to verify that
>data is
> > > > > > > properly passing between php and htmldoc.exe.
> > > > > > >
> > > > > > > I hope this has addressed some of the confusion.
> > > > > > > Court
> > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Sviss Cobazor [mailto:[EMAIL PROTECTED]]
> > > > > > > > Sent: Monday, February 25, 2002 5:12 PM
> > > > > > > > To: [EMAIL PROTECTED]
> > > > > > > > Subject: Re: [PHP-WIN] passthru() on Win98 ??
> > > > > > > >
> > > > > > > >
> > > > > > > > I followed your instructions and got:
> > > > > > > >
> > > > > > > > HTTP/1.1 400 bad request
> > > > > > > > > Date: Tue, 26 Feb 2002 01:05:57 GMT
> > > > > > > > > Server: Apache/1.3.20 (Win32)
> > > > > > > > > Connection: close
> > > > > > > > > Content-Type: text/html charset=iso-8859-1
> > > > > > > >
> > > > > > > > ... And then the same in html source ... (in the putty window)
> > > > > > > >
> > > > > > > > So I didn't get what was expected but either way I'm not sure
> > > > > > > > what to do if
> > > > > > > > I did.
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > >--
> > > > >PHP Windows Mailing List (http://www.php.net/)
> > > > >To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > > >
> > > > -- Mike Flynn - Burlington, VT --
> > > > mike @ mikeflynn.net
> > > > http://www.mikeflynn.net/
> > > > home=>work=>home=>store=>home [adbusters]
> > > >
> > >
> > >
> > >
> > >--
> > >PHP Windows Mailing List (http://www.php.net/)
> > >To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> > -- Mike Flynn - Burlington, VT --
> > mike @ mikeflynn.net
> > http://www.mikeflynn.net/
> > home=>work=>home=>store=>home [adbusters]
> >
>
>
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
-- Mike Flynn --
mike @ mikeflynn . net
home => work => home => shop => home [adbusters]
--- End Message ---
--- Begin Message ---
Yep, I got it to work just as your mail poped in :)
Thanks for your help and time Mike
"Mike Flynn" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> It goes into a link to whatever PHP file you're using to return the
> contents of the .PDF. It would work in the address field in the browser,
> too. I don't see why you're typing http://localhost/test.php/whatever.pdf
> into the address field since that isn't the URL I told you to use. I
said:
>
> http://whatever/stuff.php?options/desired_filename.pdf
>
> As you can see, instead of stuff.php put the name of the php file that has
> your code to return the binary contents of the .pdf file. You can follow
> it with whatever optional parameters you want in the query string (i/e
> after the '?' question mark), either way, make sure at the very end of the
> address is a slash '/' followed by the desired filename you want to use,
> ending in .pdf.
>
> -Mike
>
> At 05:58 PM 2/26/02 +0100, you wrote:
> >Is the example below meant to go into a link (<a href=***></a>)?
> >Or is it meant for the address field on the browser?
> >If I type "http://localhost/test.php/whatever.pdf" in the address field I
> >get a server error which I was also expecting to be hornest. I don't see
how
> >that should work.
> >
> >
> >"Mike Flynn" <[EMAIL PROTECTED]> wrote in message
> >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Use a slash and then the filename.pdf. So
> > > http://whatever/stuff.php?options/desired_filename.pdf would do it.
It's
> > > ok that you aren't linking to a real file, it doesn't matter. Just
the
> > > file that you want the .pdf document to be known as to the user's
browser.
> > >
> > > At 05:07 PM 2/26/2002 +0100, Sviss Cobazor wrote:
> > > >Hmm in my case there is no file to link to. The pdf document doesn't
> >exist,
> > > >it's generated on-the-fly. Take this example:
> > > >
> > > >test.php contains:
> > > >
> > > ><?
> > > >function topdf($file, $options = "") {
> > > > header("Content-Type: application/pdf");
> > > > flush();
> > > > passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage
$options
> > > >\"$file\"");
> > > >}
> > > >
> > > >$url = "http://localhost/whatever.html";
> > > >
> > > >topdf($url);
> > > >?>
> > > >
> > > >So the idea was to write the address "http://localhost/test.php" and
the
> > > >browser would load Acrobat Reader and show the pdf document generated
> >from
> > > >"whatever.html".
> > > >
> > > >So how do I get the ".pdf" added?
> > > >By typing the address "http://localhost/test.php?.pdf" ? Doesn't seem
to
> > > >work.
> > > >
> > > >"Mike Flynn" <[EMAIL PROTECTED]> wrote in message
> > > >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > > Yes, this has been documented extensively on the web. The fix is
to
> >put a
> > > > > pdf extension at the end of the url call to your script that is
> >returning
> > > > > the pdf file. You can use an arbitrary filename ending in .pdf,
or
> >you
> > > >can
> > > > > use the actual filename of the .pdf file, which would be
preferable so
> > > >that
> > > > > if the user tries to save the .pdf file, the default filename is
> > > > > correct. So what this means is that the script that is linking to
> >your
> > > > > .pdf-returning script needs to know the filename/that it is a .pdf
> >file,
> > > > > ahead of time. So you want to do something like this:
> > > > >
> > > > > <?php
> > > > > $query = 'SELECT strFileFilename FROM tblFiles ';
> > > > > $query .= "WHERE intFileID=$id";
> > > > > $filename = mysql_result(mysql_query($query), 0);
> > > > > print "<a href=\"/stuff/getfile.php?id=$id/$filename\">Here's the
> > > >PDF</a>\n";
> > > > > ?>
> > > > >
> > > > > -Mike
> > > > >
> > > > > At 03:09 PM 2/26/2002 +0100, Sviss Cobazor wrote:
> > > > > >However, sigh, IE seems to have a bug so that Acrobat Reader is
only
> > > >loaded
> > > > > >when the URL ends with ".pdf" aka IE doesn't give a rats about
the
> >header
> > > > > >sent to it.
> > > > > >Using Telnet I can see that the pdf page is returned correctly
but
> >when
> > > > > >using IE I still get a blank page due to the fact that no
> >(pre-generated)
> > > > > >pdf document is sent to it and therefore the URL doesn't contain
a
> > > > > >"whatever.pdf" ind the end and therefore doesn't load Acrobat
Reader.
> > > > > >Look at this example:
> > > > > >
> > > > > >header("Content-Type: application/pdf");
> > > > > >flush();
> > > > > >passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage
> > > > > >\"http://localhost/whatever.html\"");
> > > > > >
> > > > > >This works fine with Telnet (where output is nonsense),
> > > > > >but doesn't with IE (where the output would make sense).
> > > > > >
> > > > > >Does anyone have a solution to this?
> > > > > >How to get IE to understand that the data sent to it is to be
handled
> >as
> > > >a
> > > > > >pdf document (as in load Acrobat Reader)?
> > > > > >
> > > > > >
> > > > > >
> > > > > >"Sviss Cobazor" <[EMAIL PROTECTED]> wrote in message
> > > > > >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > > > > It seemed that it was Putty itself that wouldn't work for me
> >(don't
> > > >ask me
> > > > > > > why).
> > > > > > > So I used Telnet and it worked.
> > > > > > > After having my advicor (this is a education project) visiting
me
> >we
> > > >found
> > > > > > > out why that passthru() function didn't work.
> > > > > > > It's very simple really, passthru() doesn't allow spaces in
paths
> >so
> > > > > > > "C:\program files\etc." becomes "C:\program" => false path.
> > > > > > > Removing the application (htmldoc.exe) to "C:\" instead did
the
> >job.
> > > > > > >
> > > > > > > For anyone else having same problems this is the correct way
to
> >type
> > > >it
> > > > > >(my
> > > > > > > example):
> > > > > > >
> > > > > > > <?
> > > > > > > function topdf($filename, $options = "") {
> > > > > > > header("Content-Type: application/pdf");
> > > > > > > flush();
> > > > > > > passthru("C:\htmldoc -t pdf14 --quiet --jpeg size
A4 --webpage
> > > > > >$options
> > > > > > > \"$filename\"");
> > > > > > > }
> > > > > > > ?>
> > > > > > >
> > > > > > > This function now works and sends the result pdf directly to
the
> > > >browser.
> > > > > > >
> > > > > > > Thanks for your time Court, I wouldn't have thought of using
> >Telnet
> > > >myself
> > > > > > > :)
> > > > > > >
> > > > > > > ~ Sviss
> > > > > > >
> > > > > > > "Court Shrock" <[EMAIL PROTECTED]> wrote in message
> > > > > > >
> >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > > > > > To explain the 400 bad request, you most likely had a typo
when
> >you
> > > > > >typed
> > > > > > > in
> > > > > > > > the HTTP request. The request is case-sensitive and very
> > > >particular.
> > > > > > > Most
> > > > > > > > likely, the "Host: localhost" portion of the request messed
up
> > > >somehow.
> > > > > > > >
> > > > > > > > When you get a "HTTP/1.1 200 OK" response, that means that
the
> > > >webserver
> > > > > > > > accepted the request and will process your request. In
order to
> > > >test
> > > > > > > > whether or not the passthru function is doing things
properly,
> >you
> > > >are
> > > > > > > > verifying what is being sent to the browser by simulating
what
> >the
> > > > > >browser
> > > > > > > > would send to your webserver and then what the browser is
> >getting in
> > > > > > > > response. It will all start to make sense when you start
seeing
> > > >your
> > > > > > > files
> > > > > > > > output--of course, in the request that I had you type, I
assumed
> >the
> > > > > >file
> > > > > > > > that returns the pdf is named "index.php" or whatever file
your
> > > > > >webserver
> > > > > > > > will retrieve when it gets a root "/" request. If this is
not
> >the
> > > >case,
> > > > > > > you
> > > > > > > > need to replace the "GET / HTTP/1.1" line with "GET
> >/yourfile.php
> > > > > > > HTTP/1.1"
> > > > > > > > or even "GET /yourfile.php?var1=whatever__yougettheidea
> >HTTP/1.1".
> > > > > > > >
> > > > > > > > passthru is working properly if you see something like:
> > > > > > > > HTTP/1.1 200 OK
> > > > > > > > Date: Mon, 25 Feb 2002 23:20:35 GMT
> > > > > > > > Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_ssl/2.8.4
> >OpenSSL/0.9.6
> > > > > > > > X-Powered-By: PHP/4.0.6
> > > > > > > > Transfer-Encoding: chunked
> > > > > > > > Content-Type: application/pdf
> > > > > > > >
> > > > > > > > [lots of binary data]
> > > > > > > >
> > > > > > > > it isn't working if you see something like this:
> > > > > > > > HTTP/1.1 200 OK
> > > > > > > > Date: Mon, 25 Feb 2002 23:20:35 GMT
> > > > > > > > Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_ssl/2.8.4
> >OpenSSL/0.9.6
> > > > > > > > X-Powered-By: PHP/4.0.6
> > > > > > > > Transfer-Encoding: chunked
> > > > > > > > Content-Type: text/html
> > > > > > > >
> > > > > > > > <html>some stupid html, or nothing at all</html>
> > > > > > > >
> > > > > > > > in which case, I would try a different method to verify that
> >data is
> > > > > > > > properly passing between php and htmldoc.exe.
> > > > > > > >
> > > > > > > > I hope this has addressed some of the confusion.
> > > > > > > > Court
> > > > > > > >
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: Sviss Cobazor [mailto:[EMAIL PROTECTED]]
> > > > > > > > > Sent: Monday, February 25, 2002 5:12 PM
> > > > > > > > > To: [EMAIL PROTECTED]
> > > > > > > > > Subject: Re: [PHP-WIN] passthru() on Win98 ??
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > I followed your instructions and got:
> > > > > > > > >
> > > > > > > > > HTTP/1.1 400 bad request
> > > > > > > > > > Date: Tue, 26 Feb 2002 01:05:57 GMT
> > > > > > > > > > Server: Apache/1.3.20 (Win32)
> > > > > > > > > > Connection: close
> > > > > > > > > > Content-Type: text/html charset=iso-8859-1
> > > > > > > > >
> > > > > > > > > ... And then the same in html source ... (in the putty
window)
> > > > > > > > >
> > > > > > > > > So I didn't get what was expected but either way I'm not
sure
> > > > > > > > > what to do if
> > > > > > > > > I did.
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >--
> > > > > >PHP Windows Mailing List (http://www.php.net/)
> > > > > >To unsubscribe, visit: http://www.php.net/unsub.php
> > > > >
> > > > >
> > > > > -- Mike Flynn - Burlington, VT --
> > > > > mike @ mikeflynn.net
> > > > > http://www.mikeflynn.net/
> > > > > home=>work=>home=>store=>home [adbusters]
> > > > >
> > > >
> > > >
> > > >
> > > >--
> > > >PHP Windows Mailing List (http://www.php.net/)
> > > >To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > > -- Mike Flynn - Burlington, VT --
> > > mike @ mikeflynn.net
> > > http://www.mikeflynn.net/
> > > home=>work=>home=>store=>home [adbusters]
> > >
> >
> >
> >
> >--
> >PHP Windows Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> -- Mike Flynn --
> mike @ mikeflynn . net
> home => work => home => shop => home [adbusters]
>
--- End Message ---
--- Begin Message ---
Hello!
I am having a really ugly problem here and I hope somebody can help me with
this.
I work on
- Windows 2000 Advanced Server
- PHP for Windows and IIS (it works ok)
I have a DBTest.mdb database (Access 2000) and an ODBC connection to this
database:
System DSN="DBTest", no user and password to connect! I have tested this
ODBC connection with a VBasic simple application and it works just fine.
Now I create a Test.php file with this content:
<?php
odbc_connect("DBTest", "", "");
?>
When I open this file in the browser http://localhost/directory/Test.php? I
get the next error:
"Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] The Microsoft
Jet database engine cannot open the file '(unknown)'. It is already opened
exclusively by another user, or you need permission to view its data., SQL
state S1000 in SQLConnect in C:\inetpub\wwwroot\directory\Test.php on line
3"
I have checked everything and the database is not opened by anybody. Plus,
the Security rights are set to enable Everyone and Internet Guest Account
(IUSR_myserver) to have Full Control ont the database.
So, could anybody help me with this PLEASE??
:`-(
Thank you in advance,
Sebastian.
--- End Message ---
--- Begin Message ---
I'm not sure this will help you but when I had to make some odbc_connect I
had major trouble too. The username and password for the db I was trying to
reach were both = "".
It turned out that this was the problem in my case. I had to create a
username and a password other than "" to make it work. Like if odbc_connect
wanted somthing else than empty strings, beats me.
~ Sviss
"Sebastian Timocea" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello!
>
> I am having a really ugly problem here and I hope somebody can help me
with
> this.
> I work on
> - Windows 2000 Advanced Server
> - PHP for Windows and IIS (it works ok)
>
> I have a DBTest.mdb database (Access 2000) and an ODBC connection to this
> database:
> System DSN="DBTest", no user and password to connect! I have tested this
> ODBC connection with a VBasic simple application and it works just fine.
>
> Now I create a Test.php file with this content:
> <?php
> odbc_connect("DBTest", "", "");
> ?>
>
> When I open this file in the browser http://localhost/directory/Test.php?
I
> get the next error:
> "Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] The
Microsoft
> Jet database engine cannot open the file '(unknown)'. It is already opened
> exclusively by another user, or you need permission to view its data., SQL
> state S1000 in SQLConnect in C:\inetpub\wwwroot\directory\Test.php on line
> 3"
>
> I have checked everything and the database is not opened by anybody. Plus,
> the Security rights are set to enable Everyone and Internet Guest Account
> (IUSR_myserver) to have Full Control ont the database.
>
> So, could anybody help me with this PLEASE??
> :`-(
>
> Thank you in advance,
> Sebastian.
>
>
>
--- End Message ---
--- Begin Message ---
I'm working in an Dos Box under Win2k.....
When i try to print é, è, ù ...characters ...
<?
Print("Hébé...");
?>
The output is
Hùbù...
Someone can help ... ?
--- End Message ---
--- Begin Message ---
To whom it may concern,
I am seeking insight to problem that I am having with the fsockopen()
function. I open the file pointer with the function without a problem. I
am expecting binary information to come back. All of the binary information
is being read when I know file size in advance. I want to code the php
script in such a way that I do not need to know file size in advance. It
hangs up when I try to read everything. I have tried fpassthru(), fread()
and copied contents to a buffer with a block size, I have turned blocking
off.
Thanks in advance for any insight or advice,
Lance
--- End Message ---
--- Begin Message ---
Newby question:
I am just trying to pass a value from one page to the
next, nothing complicated. In the the addess bar I see
the string pass, but on the page it is blank? Any
Ideas? Oh, everything is in lower case.
My code is like this for page test.html:
<form method="get" action="test.php">
<input type="text" name="blah">
<input type="submit">
then for the test.php page I have:
<?php
echo $blah;
?>
this is a standard intro deal, and I know the code is
good, but does anyone have any idea how to get passed
this. I makes all my other examples null if I can't
figure it out.
__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com
--- End Message ---
--- Begin Message ---
Frank,
> I am just trying to pass a value from one page to the
> next, nothing complicated. In the the addess bar I see
> the string pass, but on the page it is blank? Any
> Ideas? Oh, everything is in lower case.
>
> My code is like this for page test.html:
>
> <form method="get" action="test.php">
>
> <input type="text" name="blah">
>
> <input type="submit">
>
> then for the test.php page I have:
>
> <?php
>
> echo $blah;
>
> ?>
>
> this is a standard intro deal, and I know the code is
> good, but does anyone have any idea how to get passed
> this. I makes all my other examples null if I can't
> figure it out.
Do you have a new-ish version of PHP? Check the "register_globals" setting in php.ini.
Discussion in the manual
at http://www.php.net/manual/en/security.registerglobals.php
Regards,
=dn
--- End Message ---
--- Begin Message ---
I'm using PHP 4.1.1 on a Win2K server with IIS5, Dual PIII 933Mhz, 1,5GB
SDRam.
If I try to use the PHP4ISAPI.DLL and run php.info(), then I get a
bluescreen and something abut NDIS.SYS
Anyone knows why?
--- End Message ---
--- Begin Message ---
Aleborg,
> I'm using PHP 4.1.1 on a Win2K server with IIS5, Dual PIII 933Mhz, 1,5GB
> SDRam.
>
> If I try to use the PHP4ISAPI.DLL and run php.info(), then I get a
> bluescreen and something abut NDIS.SYS
What networking configuration do you have set up on that machine?
=dn
--- End Message ---
--- Begin Message ---
>i was reading a php book and it says on UNIX machines i must change the
CHMOD
>to 666 or 777, how do i do this? i never heard of the CHMOD. thanks.
Nobody wants in general to chomd a file 777!!!
Let me explain why:
chmod is an abbreviation of CHange MODe. The mode, or more specify the
access mode of the file is what is intended to be changed with chmod - so
don't change these flags unless you kmnow what you are doing!
Access right under unix is divided in three access groups. 1) Owner, 2)
Group and 3) Everybody. These groups has three flags for Read, Write and
Execute. These three flags could be set individually for each of the three
groups.
There is two ways to manipulate the Access flags under an unix environment:
a) absolute and b) relative.
The absolute method uses number to manipulates the access rights. The access
right for each group are represented by three bits like this: 111
The first bit is the access right for Read, the second for Write, and the
third for execute. These three bits fits into an octal number (range 0-7),
and the chomd actually uses octal numbers. The first octal number is for the
owner access, the second for group, and the first, you got it, everybody.
So if all bits are set to one for an access group, that access group will
have Read, Write and eXecute right, in short RWX access.
The most significant bit is the left on, and hence its value becomes 4, the
second bit has the value 2 and the first bit 1. If we add the value of these
three bits together, we get the number 7. Seven hence means that we will
give RWX access to a file. This might be oki for the owner, and even for the
group, but do we wants to do this for everybody?
In most case the answer to this question is: NO
For the access right RX we have the bit pattern 101 (= 4 + 0 + 1 = 5), which
is the most common value to set for the access groups Group and Everybody -
if they need to be able to execute the file. If execute rights is not
needed, it is sufficient to give the access right R only ( 100 = 4 + 0 + 0 =
4), so if you need to read only a file, the proper chmod should be: 744 and
if execute is needed to: 755. Actually you don't need the R flag set under
unix to execute a file, so for execute 711 will be sufficient. Setting the
access right to 711, means that the user can execute the file, but not
display its contents.
However. Access rights are set for directories two, and then they are
interpreted a little bit different. Access right X for a directory means
that a user can do a CD into it. To be able to display the contents of a
directory both RX are needed for a directory, since you both need to be able
to access it and read it.
X access for a directory could be used as a
"pass-through-but-not-display-content-of" directory. Could be useful if you
don't want everybody to know how the tree structure really looks like.
For more information about chmod check the online page by typing '% man
chmod'
/Anders
--- End Message ---
--- Begin Message ---
Remember that the php chmod call requires an octel number for the
permissions flag. You can do this by putting a zero ('0') infront of the
parm.
ex. chmod("foofile",0777);
// Mike Eynon
// www.MikeEynon.com
// 1366 Bulb Ave.
// Santa Cruz, CA 95062
// 831.588.2388
-----Original Message-----
From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 26, 2002 8:40 AM
To: '[EMAIL PROTECTED]'
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] CHMOD
>i was reading a php book and it says on UNIX machines i must change the
CHMOD
>to 666 or 777, how do i do this? i never heard of the CHMOD. thanks.
Nobody wants in general to chomd a file 777!!!
Let me explain why:
chmod is an abbreviation of CHange MODe. The mode, or more specify the
access mode of the file is what is intended to be changed with chmod - so
don't change these flags unless you kmnow what you are doing!
Access right under unix is divided in three access groups. 1) Owner, 2)
Group and 3) Everybody. These groups has three flags for Read, Write and
Execute. These three flags could be set individually for each of the three
groups.
There is two ways to manipulate the Access flags under an unix environment:
a) absolute and b) relative.
The absolute method uses number to manipulates the access rights. The access
right for each group are represented by three bits like this: 111
The first bit is the access right for Read, the second for Write, and the
third for execute. These three bits fits into an octal number (range 0-7),
and the chomd actually uses octal numbers. The first octal number is for the
owner access, the second for group, and the first, you got it, everybody.
So if all bits are set to one for an access group, that access group will
have Read, Write and eXecute right, in short RWX access.
The most significant bit is the left on, and hence its value becomes 4, the
second bit has the value 2 and the first bit 1. If we add the value of these
three bits together, we get the number 7. Seven hence means that we will
give RWX access to a file. This might be oki for the owner, and even for the
group, but do we wants to do this for everybody?
In most case the answer to this question is: NO
For the access right RX we have the bit pattern 101 (= 4 + 0 + 1 = 5), which
is the most common value to set for the access groups Group and Everybody -
if they need to be able to execute the file. If execute rights is not
needed, it is sufficient to give the access right R only ( 100 = 4 + 0 + 0 =
4), so if you need to read only a file, the proper chmod should be: 744 and
if execute is needed to: 755. Actually you don't need the R flag set under
unix to execute a file, so for execute 711 will be sufficient. Setting the
access right to 711, means that the user can execute the file, but not
display its contents.
However. Access rights are set for directories two, and then they are
interpreted a little bit different. Access right X for a directory means
that a user can do a CD into it. To be able to display the contents of a
directory both RX are needed for a directory, since you both need to be able
to access it and read it.
X access for a directory could be used as a
"pass-through-but-not-display-content-of" directory. Could be useful if you
don't want everybody to know how the tree structure really looks like.
For more information about chmod check the online page by typing '% man
chmod'
/Anders
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hello folks
I've got a problem that really requires me to use the pathinfo()
function. Unfortunately it is only available with PHP 4.0.3 (from
memory) and the servers I'm working on are only version 3. Before I go
and write my own version of pathinfo, does anyone have a solution for
it?
Cheers
Ross
and PS, It's not an option to upgrade the servers, they're not mine and
the syssies don't even support version 3, they just make it available.
:(
--- End Message ---
--- Begin Message ---
Given there wasn't any feedback, I just wrote my own function that works
under PHP3 and does exactly what pathinfo() does. If anyone wants a copy,
email me and I'll send it back. (thought I expect demand to be low!)
Cheers
Ross
-----Original Message-----
From: rxf [mailto:rxf]On Behalf Of Ross Fleming
Sent: 26 February 2002 17:22
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] pathinfo();
Hello folks
I've got a problem that really requires me to use the pathinfo()
function. Unfortunately it is only available with PHP 4.0.3 (from
memory) and the servers I'm working on are only version 3. Before I go
and write my own version of pathinfo, does anyone have a solution for
it?
Cheers
Ross
and PS, It's not an option to upgrade the servers, they're not mine and
the syssies don't even support version 3, they just make it available.
:(
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---