[PHP] Re: Die Page, Die! (Was: Preview button to show PDF without submitting post data?)

2009-11-08 Thread Ashley Sheridan
On Sun, 2009-11-08 at 21:38 +0900, Dave M G wrote:

 PHP List,
 
 Okay, so I've got a nice situation where a form has a preview button as
 well as a submit button. When the user presses Submit, the page
 reloads, and it emails a PDF.
 
 If the user presses Preview, it launches a new page in a new window,
 and also outputs a PDF directly to the user so they can review it.
 
 All good, but I don't need that second window open once the PDF has been
 shown to the user.
 
 For some reason I can't kill that second window. I've tried two methods.
 Killing it with PHP, and killing it with JavaScript.
 
 Here's the PHP version:
 
 if (isset($_POST['preview']))
 {
   $pdf-Output(preview.pdf, D);
   die(PDF プレビュー出しました / PDF Preview Displayed);
 }
 
 Here's the JavaScript version:
 
 if (isset($_POST['preview']))
 {
   $pdf-Output(preview.pdf, D);
   echo 'script type=text/javascriptjavascript:self.close();/script';
 }
 
 But in either case, I keep getting that second page coming out, with the
 whole form rendered all over again.
 
 How can I kill a page? Once the PDF is rendered, I don't need it. I'd be
 okay if it came down to the browser then closed, but it would be better
 if the server sent the PDF and didn't send the page.
 
 Any advice would be much appreciated.


I think you do, or where else would you show the PDF? Unless you force
the PDF to download when the user clicks the preview button, you are
left with the default option of the users browser, which will most
usually be to display the PDF in the browser window. 

Thanks,
Ash
http://www.ashleysheridan.co.uk




[PHP] Re: Die Page, Die! (Was: Preview button to show PDF without submitting post data?)

2009-11-08 Thread Dave M G
Ashley,

Thank you for responding.

 I think you do, or where else would you show the PDF? Unless you force
 the PDF to download when the user clicks the preview button, you are
 left with the default option of the users browser, which will most
 usually be to display the PDF in the browser window.

No, that's not what's happening. I'm not showing the PDF in a browser
window. It's being given to the user with the option to download or view
in a separate application.

So I am fine with the download option. That's what I'm doing now, I
suppose. So since the user is downloading the PDF, they don't need an
in-browser window to view it.

Once the PDF is downloaded/viewed, I want the new window to die by any
means necessary.

Surely there's a way.

-- 
Dave M G

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



[PHP] Re: Die Page, Die! (Was: Preview button to show PDF without submittingpost data?)

2009-11-08 Thread Nathan Rixham
Dave M G wrote:
 Ashley,
 
 Thank you for responding.
 
 I think you do, or where else would you show the PDF? Unless you force
 the PDF to download when the user clicks the preview button, you are
 left with the default option of the users browser, which will most
 usually be to display the PDF in the browser window.
 
 No, that's not what's happening. I'm not showing the PDF in a browser
 window. It's being given to the user with the option to download or view
 in a separate application.
 
 So I am fine with the download option. That's what I'm doing now, I
 suppose. So since the user is downloading the PDF, they don't need an
 in-browser window to view it.
 
 Once the PDF is downloaded/viewed, I want the new window to die by any
 means necessary.
 
 Surely there's a way.
 

yup.. forget the new window all together, if you have it set to download
as an attachment then the user won't be taken away from the page; so no
need for a new window at all.

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



Re: [PHP] Re: Die Page, Die! (Was: Preview button to show PDF without submittingpost data?)

2009-11-08 Thread Dave M G
Nathan,

Thank you for responding.

 yup.. forget the new window all together, if you have it set to download
 as an attachment then the user won't be taken away from the page; so no
 need for a new window at all.

Right... so, we're all on board with the goals.

Now... how do I do that?

The whole problem here is that I keep getting a new window even though I
don't want it.

I would have thought if I told PHP to die immediately after outputting
the PDF, it would give up on making the new window.

I've also tried JavaScript to kill the window after it's made.

*How* do I get the page to die?

-- 
Dave M G

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



Re: [PHP] Re: Die Page, Die! (Was: Preview button to show PDF without submittingpost data?)

2009-11-08 Thread Phpster




On Nov 8, 2009, at 1:20 PM, Dave M G mar...@autotelic.com wrote:


Nathan,

Thank you for responding.

yup.. forget the new window all together, if you have it set to  
download
as an attachment then the user won't be taken away from the page;  
so no

need for a new window at all.


Right... so, we're all on board with the goals.

Now... how do I do that?

The whole problem here is that I keep getting a new window even  
though I

don't want it.

I would have thought if I told PHP to die immediately after outputting
the PDF, it would give up on making the new window.

I've also tried JavaScript to kill the window after it's made.

*How* do I get the page to die?

--
Dave M G

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



If you are popping up a new window just to handle the download, what  
about using a small iframe or hidden frame to handle that instead?


Bastien

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



[PHP] Re: die function

2005-03-23 Thread Barbara Picci
Hi all,
just to give you another solution that I've successfully adopted:
function die_script($errmsg)
{
$sendto = [EMAIL PROTECTED];
 $from = [EMAIL PROTECTED];
 $subject = FAILED;
 $message = CONNECTION FAILED\nTYPE OF ERROR:\n . mysql_error();
 $message .=\n\n;
 $headers = From: $from\r\n;
 mail($sendto, $subject, $message, $headers);

  print $errmsg . /body/html;
  die;
 }
$connessione = mysql_connect (192.168.168.1,user,password) or 
die(die_script($errmsg));
mysql_select_db (dbnamei);

Thanks for your help
Regards
Barbara

Barbara Picci wrote:
 Hi all,
 I have a machine that must insert in cron in a mysql db in another
 remote machine.
 The problem is that I cannot know if the connection in the first machine
 (adsl) go down because no entry in the machine log is generated. I would
 like to redirect the die function in a e-mail that say me what happens.
I think the way you want to solve this problem is to create a customized
error handler.  Check out this link:
http://php.net/manual/en/function.set-error-handler.php
?php
function email_error_handler($level, $msg, $file, $line) {
  switch ($level) {
/** E_ERROR, E_USER_ERROR, etc. */
mail_to_admin($level: $msg in $file on line $line);
  }
}
function mail_to_admin($msg) {
  /** stuff */
}
?
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename=signature.asc
Attachment converted: Barbara OS9:signature 276.asc (/) (000B65CD)

--

Barbara Picci
Micro srl
viale Marconi 222, 09131 Cagliari  - tel. (+39) 070400240
http://www.microsrl.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: die function

2005-03-21 Thread Jason Barnett
Barbara Picci wrote:
 Hi all,

 I have a machine that must insert in cron in a mysql db in another
 remote machine.
 The problem is that I cannot know if the connection in the first machine
 (adsl) go down because no entry in the machine log is generated. I would
 like to redirect the die function in a e-mail that say me what happens.

I think the way you want to solve this problem is to create a customized
error handler.  Check out this link:

http://php.net/manual/en/function.set-error-handler.php

?php

function email_error_handler($level, $msg, $file, $line) {
  switch ($level) {
/** E_ERROR, E_USER_ERROR, etc. */
mail_to_admin($level: $msg in $file on line $line);
  }
}

function mail_to_admin($msg) {
  /** stuff */
}

?

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: die! die! directory!

2002-02-08 Thread hugh danaher

Phil, Thanks for the suggestion.  I tried it and it worked the first time,
but as I changed to a second directory ./maps2/ it fell apart again.

Also, what I didn't state at the start, was that map1.jpg is actually a
variable, $map.  It's just that when I was pounding on it, I settled on
using hard names instead of variables figuring that I was at least limiting
the source for error.  The problem is the same though, it seems to work then
dies.  Not my machine either, I ftp the file to olm and see the results on
line.

Thanks for your help.  If you have any other suggestions, please let me
know.
Hugh



- Original Message -
From: Philip Hallstrom [EMAIL PROTECTED]
To: hugh danaher [EMAIL PROTECTED]
Sent: Friday, February 08, 2002 5:05 PM
Subject: Re: die! die! directory!


 what if you do this:

 print input type=image src=\./maps/map1.jpg\ name=coordinate ;

 ??

 On Fri, 8 Feb 2002, hugh danaher wrote:

  Help!
 
  I've been beating on a problem all day and think I've isolated the
problem to the following line:
 
 print input type=image src=./maps/map1.jpg name=coordinate ;
 
  If I call the statement as is, I get a little red x where my map should
be.  In earlier calls to the same directory, I can get a server error,
misconfiguration...
 
  if I change the line to:
 
 print input type=image src=map1.jpg name=coordinate ;
 
  I see the image.
 
  is there a way to declare the path before asking for the file, or a
better way to state the file location.
 
  Any help will be greatly appreciated.
 
  Hugh
 



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




Re: [PHP] Re: die! die! directory!

2002-02-08 Thread Jason Wong

On Saturday 09 February 2002 09:35, hugh danaher wrote:
 Phil, Thanks for the suggestion.  I tried it and it worked the first time,
 but as I changed to a second directory ./maps2/ it fell apart again.

 Also, what I didn't state at the start, was that map1.jpg is actually a
 variable, $map.  It's just that when I was pounding on it, I settled on
 using hard names instead of variables figuring that I was at least limiting
 the source for error.  The problem is the same though, it seems to work
 then dies.  Not my machine either, I ftp the file to olm and see the
 results on line.


Instead of using ./maps2/ why don't you just use maps2/ ?


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
If it ain't broke, don't fix it.
*/

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




Re: [PHP] Re: die! die! directory!

2002-02-08 Thread hugh danaher

ok, I'll buy that, but.  Now, in a strictly php page that is also
failing intermittently I have the following:

$im_size = GetImageSize(./maps/$map);

Same basic HTML problem?

I'll change everything to be relative to http:// and see if that helps.

- Original Message -
From: Larry Jeannette [EMAIL PROTECTED]
To: 'hugh danaher' [EMAIL PROTECTED]
Sent: Friday, February 08, 2002 7:49 PM
Subject: RE: [PHP] Re: die! die! directory!


 This is a standard HTML question, not a PHP question.

 If you do not include http:// or a / in front of the src value then it
 is taken as relative to the documents directory - ie: if the document is
 at the location http://www.someplace.com/somedir and src=map1.jpg then
 the browswer will look for the image at
 http://www.someplace.com/somedir/map1.jpg, if src=/map1.jpg then the
 browser will look for it http://www.someplace.com/map1.jpg (the / tells
 it to start from the web sites root, or top level, directory).

 LRJ

 -Original Message-
 From: hugh danaher [mailto:[EMAIL PROTECTED]]
 Sent: Friday, February 08, 2002 5:35 PM
 To: php
 Subject: [PHP] Re: die! die! directory!


 Phil, Thanks for the suggestion.  I tried it and it worked the first
 time, but as I changed to a second directory ./maps2/ it fell apart
 again.

 Also, what I didn't state at the start, was that map1.jpg is actually a
 variable, $map.  It's just that when I was pounding on it, I settled on
 using hard names instead of variables figuring that I was at least
 limiting the source for error.  The problem is the same though, it seems
 to work then dies.  Not my machine either, I ftp the file to olm and see
 the results on line.

 Thanks for your help.  If you have any other suggestions, please let me
 know. Hugh



 - Original Message -
 From: Philip Hallstrom [EMAIL PROTECTED]
 To: hugh danaher [EMAIL PROTECTED]
 Sent: Friday, February 08, 2002 5:05 PM
 Subject: Re: die! die! directory!


  what if you do this:
 
  print input type=image src=\./maps/map1.jpg\ name=coordinate ;
 
  ??
 
  On Fri, 8 Feb 2002, hugh danaher wrote:
 
   Help!
  
   I've been beating on a problem all day and think I've isolated the
 problem to the following line:
  
  print input type=image src=./maps/map1.jpg name=coordinate ;
  
   If I call the statement as is, I get a little red x where my map
   should
 be.  In earlier calls to the same directory, I can get a server error,
 misconfiguration...
  
   if I change the line to:
  
  print input type=image src=map1.jpg name=coordinate ;
  
   I see the image.
  
   is there a way to declare the path before asking for the file, or a
 better way to state the file location.
  
   Any help will be greatly appreciated.
  
   Hugh
  
 


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




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




Re: [PHP] Re: die! die! directory!

2002-02-08 Thread hugh danaher

Thanks Jason, I'll give it a try too.
Hugh
- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, February 08, 2002 9:20 PM
Subject: Re: [PHP] Re: die! die! directory!


 On Saturday 09 February 2002 09:35, hugh danaher wrote:
  Phil, Thanks for the suggestion.  I tried it and it worked the first
time,
  but as I changed to a second directory ./maps2/ it fell apart again.
 
  Also, what I didn't state at the start, was that map1.jpg is actually a
  variable, $map.  It's just that when I was pounding on it, I settled on
  using hard names instead of variables figuring that I was at least
limiting
  the source for error.  The problem is the same though, it seems to work
  then dies.  Not my machine either, I ftp the file to olm and see the
  results on line.
 

 Instead of using ./maps2/ why don't you just use maps2/ ?


 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk

 /*
 If it ain't broke, don't fix it.
 */

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



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




Re: [PHP] Re: die! die! directory!

2002-02-08 Thread hugh danaher

ok, I changed all the paths to include:
( http://www.host.com/directory/sub-directory ) before the /maps2/map1.jpg
call.  It still falls apart, but... if I shorten the path I can get to the
image.  I am beginning to think there is a weakness in the file structure on
my site.  Anyone else see anything like this?
Hugh
- Original Message -
From: hugh danaher [EMAIL PROTECTED]
To: php [EMAIL PROTECTED]
Sent: Friday, February 08, 2002 9:41 PM
Subject: Re: [PHP] Re: die! die! directory!


 ok, I'll buy that, but.  Now, in a strictly php page that is also
 failing intermittently I have the following:

 $im_size = GetImageSize(./maps/$map);

 Same basic HTML problem?

 I'll change everything to be relative to http:// and see if that helps.

 - Original Message -
 From: Larry Jeannette [EMAIL PROTECTED]
 To: 'hugh danaher' [EMAIL PROTECTED]
 Sent: Friday, February 08, 2002 7:49 PM
 Subject: RE: [PHP] Re: die! die! directory!


  This is a standard HTML question, not a PHP question.
 
  If you do not include http:// or a / in front of the src value then it
  is taken as relative to the documents directory - ie: if the document is
  at the location http://www.someplace.com/somedir and src=map1.jpg then
  the browswer will look for the image at
  http://www.someplace.com/somedir/map1.jpg, if src=/map1.jpg then the
  browser will look for it http://www.someplace.com/map1.jpg (the / tells
  it to start from the web sites root, or top level, directory).
 
  LRJ
 
  -Original Message-
  From: hugh danaher [mailto:[EMAIL PROTECTED]]
  Sent: Friday, February 08, 2002 5:35 PM
  To: php
  Subject: [PHP] Re: die! die! directory!
 
 
  Phil, Thanks for the suggestion.  I tried it and it worked the first
  time, but as I changed to a second directory ./maps2/ it fell apart
  again.
 
  Also, what I didn't state at the start, was that map1.jpg is actually a
  variable, $map.  It's just that when I was pounding on it, I settled on
  using hard names instead of variables figuring that I was at least
  limiting the source for error.  The problem is the same though, it seems
  to work then dies.  Not my machine either, I ftp the file to olm and see
  the results on line.
 
  Thanks for your help.  If you have any other suggestions, please let me
  know. Hugh
 
 
 
  - Original Message -
  From: Philip Hallstrom [EMAIL PROTECTED]
  To: hugh danaher [EMAIL PROTECTED]
  Sent: Friday, February 08, 2002 5:05 PM
  Subject: Re: die! die! directory!
 
 
   what if you do this:
  
   print input type=image src=\./maps/map1.jpg\ name=coordinate ;
  
   ??
  
   On Fri, 8 Feb 2002, hugh danaher wrote:
  
Help!
   
I've been beating on a problem all day and think I've isolated the
  problem to the following line:
   
   print input type=image src=./maps/map1.jpg name=coordinate ;
   
If I call the statement as is, I get a little red x where my map
should
  be.  In earlier calls to the same directory, I can get a server error,
  misconfiguration...
   
if I change the line to:
   
   print input type=image src=map1.jpg name=coordinate ;
   
I see the image.
   
is there a way to declare the path before asking for the file, or a
  better way to state the file location.
   
Any help will be greatly appreciated.
   
Hugh
   
  
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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



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




[PHP] Re: Die

2001-12-11 Thread Jeremy Reed

Use IF statements to group code, and only use exit() statements when you
want to stop execution/parsing.


Max [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 If I use die or exit() it break execution of php script but also
 browswer stop parsing html code. How to avoid this?

 Regards.Max.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]