Speed of header("Location: blah.blah")?
| From: | Zachery Bir | Date: | Fri, 02 Jun 2000 18:38:43 +0000 |
| Subject: | Speed of header("Location: blah.blah")? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-917@lists.php.net to get a copy of this message | ||
Hey,
I'm developing the following script for a client who wants to have a script
run middle man for users viewing the client's online PDFs. (bleah, gag)
It works wonderfully on, lesse:
+ Netscape Navigator 4.x on Mac
+ Internet Explorer 5.0 on Mac
+ Internet Explorer 5.0 on Win 9x
It breaks on:
+ Internet Explorer 4.5 on Mac
+ AOL 5.0 on Win9x
IE4.5 reports back that it is unable to load the file. This may be less to
do with PHP than it has to do with IE4.5's inability to either view or
prompt for download PDF files (at least, the version I have installed...).
This is reproducable for any URL that would normally hit on a PDF (in this
case: http://myhost.domain.com/pdfs/ReadMe.pdf, for
instance)
AOL seems to suffer the same result. It spins its wheels for a while, then
tells me I'm trying to access a file of type application/pdf (which is
correct), but rather than offering a download dialog, it wants to shuffle me
off to some Microsoft page to look for third party solutions...
I swear to god this is the last full-time web gig I'm ever gonna have... :P
I'd appreciate anyone's insight and commiseration.
Thanks,
Zac
<?php
include "$DOCUMENT_ROOT/luck_library/libdb.php3";
function in_array($needle,$haystack) {
$found = false;
for($ptr=0;$ptr<count($haystack);$ptr++) {
if($haystack[$ptr] == $needle) {
$found = true;
}
}
return $found;
}
if($pdf && $id) {
// First we update the member database to reflect that this user
// has now seen this pdf (if s/he hasn't already)
// BrochOnline is stored as "pdfseen[]=1&dateseen[]=2000-04-24", etc.
$query = "select BrochOnline from Members where ID='$id'";
$result = mysql_query_wrap($query);
$numseen = mysql_numrows($result);
if ($numseen > 0) {
$brochseen = mysql_result($result,0,"BrochOnline");
$newbrochseen = "";
parse_str($brochseen); // gives $pdfseen[] and $dateseen[] arrays
if (!in_array($pdf,$pdfseen)) {
$pdfseen[] = $pdf;
$dateseen[] = "";
}
for ($i = 0; $i < count($pdfseen); $i++) {
if (strcmp($pdf, $pdfseen[$i]) == 0) {
$dateseen[$i] = date( "Y" . "-" . "m" . "-" .
"d" );
}
if ($i > 0) { $newbrochseen .= "&"; }
$newbrochseen .= "pdfseen[]=$pdfseen[$i]&dateseen[]=$dateseen[$i]";
}
$query = "update Members set BrochOnline='$newbrochseen' where " .
"ID='$id'";
$result = mysql_query_wrap($query);
}
$query = "select filename from pdfs where id='$pdf'";
$result = mysql_query_wrap($query);
$numpdfs = mysql_numrows($result);
if ($numpdfs > 0) {
$filename = mysql_result($result,0, "filename");
$filename = trim($filename);
$LS_URL_ROOT = "http://myhost.domain.com";
header("Location: $LS_URL_ROOT/pdfs/$filename");
}
};
?>
--
$name="zachery bir"; $email="zbir@techead.com";
$position="systems administrator"; $altposition="witch doctor";
$voice="804.782.6971"; $web="http://www.techead.com";