php-general Digest 1 Jun 2011 14:50:48 -0000 Issue 7338
Topics (messages 313285 through 313291):
Re: displaying a pdf
313285 by: Tamara Temple
313290 by: Richard Quadling
Re: https help
313286 by: Tamara Temple
313289 by: Negin Nickparsa
Re: php causes HTTP 500, but results in blank page in apache
313287 by: Tamara Temple
313288 by: Stephon Chen
Re: smart auto download file
313291 by: Jonesy
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 ---
On May 30, 2011, at 10:01 AM, Jim Giner wrote:
Thanks for the attempt Simon, but your code only displayed gibberish.
While looking around again for help, I found this and it works
perfectly:
<?php
session_start();
//
// Specify the name of the pdf here and the folder
//
$pdfname='VFD_ByLaws.pdf';
$path='/pdfs/';
//
// the rest will handle the displaying
//
header("Cache-Control: no-cache");
header("Content-type: application/pdf");
header("Location:$path$pdfname");
?>
I may not be fully understanding this, but if you set a Location:
header, the other headers you've set don't matter at all, since the
client will merely redirect to the page specified by the Location:
header.
--- End Message ---
--- Begin Message ---
On 1 June 2011 06:53, Tamara Temple <[email protected]> wrote:
>
> On May 30, 2011, at 10:01 AM, Jim Giner wrote:
>
>> Thanks for the attempt Simon, but your code only displayed gibberish.
>> While looking around again for help, I found this and it works perfectly:
>>
>> <?php
>> session_start();
>> //
>> // Specify the name of the pdf here and the folder
>> //
>> $pdfname='VFD_ByLaws.pdf';
>> $path='/pdfs/';
>> //
>> // the rest will handle the displaying
>> //
>> header("Cache-Control: no-cache");
>> header("Content-type: application/pdf");
>> header("Location:$path$pdfname");
>> ?>
>
> I may not be fully understanding this, but if you set a Location: header,
> the other headers you've set don't matter at all, since the client will
> merely redirect to the page specified by the Location: header.
Yes. That's true. But the URL you link to is the one responsible for
sending the headers to download a PDF.
Just like if it was a link ...
<a href="download_pdf.php">Got your PDF here</a>
download.pdf.php would send the appropriate headers.
--
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea
--- End Message ---
--- Begin Message ---
On May 31, 2011, at 12:34 AM, Negin Nickparsa wrote:
I need to create a login page with HTTPS to yahoo
Do I have to have a valid certificate?
I have not trust certification centre, so before anything under
HTTPS will
be shown up, the window will come with information: valid
certificate: yes,
valid domain: yes, valid authority for SSL key: no.
am I right?
<?php
//if not on HTTPS
if(empty($_SERVER['HTTPS'])) {
//build link to https page; protocol, server and current script path
$url = "Location: https://www.yahoo.com/";
//addy querystring, if appropriate
if(count($_GET) != 0) {
$url .= "?";
foreach($_GET as $key => $value) {
$url .= "$key=$value&";
}
}
//send permanent move redirect
header($url, true, 301);
}
?>
but it goes to http://www.yahoo.com
I don't have an answer to your question, but you should look at
http_build_query: http://us.php.net/manual/en/function.http-build-query.php
for the last part of your code. It makes the query string safe for
transmittal.
--- End Message ---
--- Begin Message ---
Thank you
--- End Message ---
--- Begin Message ---
On May 31, 2011, at 8:14 AM, Stephon Chen wrote:
Hello Sean,
Here is my apache config for error handling.
403, 404 works fine, but 500 shows blank page
Alias /errorpage/ "/usr/local/www/apache22/errorpage/"
<Directory "/usr/local/www/apache22/errorpage/">
AllowOverride None
Options -Indexes FollowSymLinks MultiViews
Order allow,deny
Allow from all
</Directory>
#
ErrorDocument 403 /errorpage/403.html
ErrorDocument 404 /errorpage/404.html
ErrorDocument 500 /errorpage/500.html
What's in 500.html?
--- End Message ---
--- Begin Message ---
All 403, 404, 500.html are static html pages like:
<div>
500 error happens
</div>
On Wed, Jun 1, 2011 at 14:10, Tamara Temple <[email protected]> wrote:
>
> On May 31, 2011, at 8:14 AM, Stephon Chen wrote:
>
> Hello Sean,
>>
>> Here is my apache config for error handling.
>> 403, 404 works fine, but 500 shows blank page
>>
>> Alias /errorpage/ "/usr/local/www/apache22/errorpage/"
>> <Directory "/usr/local/www/apache22/errorpage/">
>> AllowOverride None
>> Options -Indexes FollowSymLinks MultiViews
>> Order allow,deny
>> Allow from all
>> </Directory>
>> #
>> ErrorDocument 403 /errorpage/403.html
>> ErrorDocument 404 /errorpage/404.html
>> ErrorDocument 500 /errorpage/500.html
>>
>
> What's in 500.html?
>
>
--- End Message ---
--- Begin Message ---
On Tue, 31 May 2011 21:01:09 +0100, Stuart Dallas wrote:
>
> Sometimes I miss the way the web was before javascript :/
Sometimes???
Jonesy
--- End Message ---