[PHP] Exporting Data as CSV - IE6/HTTPS Problem?
All: I have the following php code for downloading a file to the user via the browser: // Open csv file. $fp = fopen($fileName, "r"); // Set file name. $dwnldName = "report"; // Set headers for csv download. header("Content-Type:application/csv"); header("Content-Disposition:attachment; filename=$dwnldName.csv"); header("Content-Transfer-Encoding:binary"); // Put it to the browser. fpassthru($fp); Works great in the Mozilla browser over both http and https. Works great in IE 6 over http, but for some reason over https, my filename mysteriously turns into a mangled version of my page url, and the file cannot (obviously) be found to be downloaded. Is it something I'm doing, or is this an IE problem? And if so, are there any work-arounds? Thanks in advance, Geoff Thompson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems downloading files via https in IE 6
I posted this once under another subject, but didn't get any responses. I'm stuck on this, and could really use some help. I have the following php code for downloading a file to the user via the browser: // Open csv file. $fp = fopen("fileOnServer.csv", "r"); // Set headers for csv download. header("Content-Type:application/csv"); header("Content-Disposition:attachment; filename=downloadFile.csv"); header("Content-Transfer-Encoding:binary"); // Put it to the browser. fpassthru($fp); This works great in Mozilla and IE 6 via http, and it works in Mozilla via https, but for some reason in IE 6 via https, my filename is mysteriously replaced by a truncated version of my page url. This results in an error, because the file (obviously) cannot be found to be downloaded. Is it something I'm doing, or is this an IE problem? And if so, are there any work-arounds? I can get it working with a re-direct to the file after saving it, but that means my server file and my download file have to have the same name, which I would like to avoid. Thanks in advance, Geoff Thompson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Redirection to a named frame
I was only able to find one reference to targeting a named frame on a redirection, in the "MySQL Cookbook" by O'Reilly. According to the book, this should work: header('Window-target: main'); header('Location: http://localhost/phase1/report.php'); But, alas, it seems to only load up the current frame (which is not main). I also tried: header('Window-target: _top'); header('Location: http://localhost/phase1/report.php'); to see if I could get it to wipe out the frameset and get back to the full window, but it still loaded up in the current frame. Any help would be appreciated! Thanks, Geoff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Compare Array Elements
One approach: for ($i=0; $i < sizeof($xArray); $i++) { if ($xArray[$i] == $yArray[$i]) { new_yArray(); break; } } "Wknit" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I am a novice, I am sure this is pretty simple... > > I have two arrays of integers, equal length. > The arrays elements consists of the integers 0 through 9. > The order of the numbers in the arrays should always be different. > > Example 1: Is ok > xArray: 2 9 6 0 1 3 4 5 8 7 > yArray: 3 7 1 9 0 8 6 2 4 5 > > Example 2: Is not ok - the element "7" is in the same position in both > arrays. > xArray: 2 9 6 0 7 3 4 5 8 1 > yArray: 3 5 1 9 7 8 6 2 4 0 > > I need a snippet that will compare the value of each element in each > position and call a function to create a new array if the compare evaluates > to true. I assume that a foreach is the way to go, but I can't seem to find > the right syntax for it. > > --- > if foreach (xArray as $x) == (yArray as $y) { > new_yArray (); > } > -- > > I know this isn't correct, but in idiot terms, it is what I want to do... a > test/compare. Of course the compare should stop and call the function the > moment it evaluates to true at any given position. > > Maybe I should be using a "for" loop? (again, not a clue) > > Thanks anyone! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Redirection to a named frame
I would prefer not having to use script - is there not a way to handle this by modifying the header? Something similar to the example I found in the O'Reilly book - except which works? :) "Martin Helie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > How about simply: > > echo " > > window.top.main.location= '<a href="http://localhost/phase1/report.php">http://localhost/phase1/report.php</a>''; > "; > > ? > > "Geoffrey Thompson" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > I was only able to find one reference to targeting a named frame on a > > redirection, in the "MySQL Cookbook" by O'Reilly. According to the book, > > this should work: > > > > header('Window-target: main'); > > header('Location: http://localhost/phase1/report.php'); > > > > But, alas, it seems to only load up the current frame (which is not main). > > > > I also tried: > > > > header('Window-target: _top'); > > header('Location: http://localhost/phase1/report.php'); > > > > to see if I could get it to wipe out the frameset and get back to the full > > window, but it still loaded up in the current frame. > > > > Any help would be appreciated! > > > > Thanks, > > > > Geoff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Redirection to a named frame
BTW - I misquoted - the example below was in the "PHP Cookbook" (page 173) - not in the "MySQL Cookbook" - my apologies... "Geoffrey Thompson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I would prefer not having to use script - is there not a way to handle this > by modifying the header? Something similar to the example I found in the > O'Reilly book - except which works? :) > > "Martin Helie" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > How about simply: > > > > echo " > > > > window.top.main.location= '<a href="http://localhost/phase1/report.php">http://localhost/phase1/report.php</a>''; > > "; > > > > ? > > > > "Geoffrey Thompson" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > I was only able to find one reference to targeting a named frame on a > > > redirection, in the "MySQL Cookbook" by O'Reilly. According to the > book, > > > this should work: > > > > > > header('Window-target: main'); > > > header('Location: http://localhost/phase1/report.php'); > > > > > > But, alas, it seems to only load up the current frame (which is not > main). > > > > > > I also tried: > > > > > > header('Window-target: _top'); > > > header('Location: http://localhost/phase1/report.php'); > > > > > > to see if I could get it to wipe out the frameset and get back to the > full > > > window, but it still loaded up in the current frame. > > > > > > Any help would be appreciated! > > > > > > Thanks, > > > > > > Geoff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: OOP design question
"Mike Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I am starting to get a handle (I think) on OOP. I was wondering if > anyone would care to comment on what I think I understand: > > For simplicity's sake class.php contains AddItem() and DisplayItems(). > Since submitting form data > > include('class.php'); > > If(!$_POST['submit']){ //Do I need to instantiate(?) $po everytime the > page reloads? > $po = new PO; > } If you instantiate on every page load, you will only have one item - the last one added. So, you will need to instantiate only once, and then store the object in a session variable - but beware! Assigning the local variable to the object will make a copy of the object stored in the session, so you will have to either 1). Set the session variable back to $po at the end of the page, as such: $_SESSION[po] = $po; or 2). Set the local variable via reference to the session variable when initializing $po at the beginning of the page (which references the existing object, and does NOT make a copy), as such: $po = &$_SESSION[po];// notice the & which sets $po by reference, rather than making a copy. > > > If($_POST['submit']){ > $po->AddItem(); > } > > > ...form fields and a submit button... > > > $po->DisplayItems(); > > ?> > > Is this a good basic methodology (aside from checking the form fields > for valid characters). > > Thanks, > Mike Smith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php