php-general Digest 29 Aug 2009 13:06:00 -0000 Issue 6312

Topics (messages 297453 through 297472):

Re: Problem outputting MySQL Date field
        297453 by: Jim Lucas

Re: [PHP-WIN] Re: [PHP] Problem outputting MySQL Date field
        297454 by: Keith Davis
        297455 by: John Meyer

Re: Best way to test for form submission?
        297456 by: Keith
        297459 by: J DeBord
        297463 by: Nisse Engström
        297466 by: Warren Vail
        297467 by: O. Lavell
        297472 by: tedd

Re: Error when execute header('location: otherpage.php') after  email been sent 
out. Any Workaround?
        297457 by: Keith

Re: Some body test php6-dev version for mbs?
        297458 by: hack988 hack988

Re: Converting URL's to hyperlinks.
        297460 by: Eric

Re: File Open Prompt?
        297461 by: Ralph Deffke
        297462 by: Ashley Sheridan
        297464 by: Ralph Deffke
        297468 by: Eric
        297469 by: Eric

Re: Calling extension function from another
        297465 by: leledumbo
        297470 by: J DeBord
        297471 by: Stuart

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
John Meyer wrote:
Devendra Jadhav wrote:
No need to do anything special. It should display date as string. Can you provide little more information or code snippet?
$tweettable .= preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="$1">$1</a>',$row["TWEET_TEXT"]) . "<br>" . "Sent at: " . $rowqry["TWEET_CREATEDAT"]; $tweettable .= "<br>Sent Using: " . $row["TWEET_CREATEDBY"] . "</td></tr>";

And I checked the database.  The date is there.


Two things jump out.

1.  TWEET_CREATEDAT  is that suppose to be TWEET_CREATEDATE  ??
2. two variables are accessed from the $row array, but the third is referenced from the $rowqry array. This begs the question: Which is it? $row or $rowqry ?

Try this

$tweettable .= preg_replace(
        '@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@',
        '<a href="$1">$1</a>',
        $row["TWEET_TEXT"]);
$tweettable .= '<br />Sent at: ' . $row["TWEET_CREATEDATE"];
$tweettable .= '<br />Sent Using: {$row['TWEET_CREATEDBY']}</td></tr>";

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--- End Message ---
--- Begin Message ---
But how are you getting the data from the db?

Does $rowqry represent a call using the mysql_fetch_array() function?


Sent from my magic iPhone,
Keith Davis 214-906-5183

On Aug 28, 2009, at 7:39 PM, "John Meyer" <johnme...@pueblocomputing.com> wrote:

Devendra Jadhav wrote:
No need to do anything special. It should display date as string. Can you provide little more information or code snippet?
$tweettable .= preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.] *(\?\S+)?)?)?)@', '<a href="$1">$1</a>',$row["TWEET_TEXT"]) . "<br>" . "Sent at: " . $rowqry["TWEET_CREATEDAT"]; $tweettable .= "<br>Sent Using: " . $row["TWEET_CREATEDBY"] . "</td></tr>";

And I checked the database.  The date is there.

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


This message (including any attachments) may contain confidential or otherwise 
privileged information and is intended only for the individual(s) to which it 
is addressed. If you are not the named addressee you should not disseminate, 
distribute or copy this e-mail. Please notify the sender immediately by e-mail 
if you have received this e-mail by mistake and delete this e-mail from your 
system. E-mail transmission cannot be guaranteed to be secured or error-free as 
information could be intercepted, corrupted, lost, destroyed, arrive late or 
incomplete, or contain viruses. The sender therefore does not accept liability 
for any errors or omissions in the contents of this message or that arise as a 
result of e-mail transmission. If verification is required please request a 
hard-copy version from the sender.

www.pridedallas.com


--- End Message ---
--- Begin Message ---
Keith Davis wrote:
But how are you getting the data from the db?

Does $rowqry represent a call using the mysql_fetch_array() function?

mysql_fetch_assoc()

--- End Message ---
--- Begin Message ---
I've encountered issue with checking $_POST['submit']
   if(isset($_POST['submit'])) {}

If the form consists of checkbox/radio and text field, some of my forms can be submitted by just press [ENTER] at the end of one of the text field. In this case, the $_POST['submit'] is set even the submit button was not clicked. However, in some of my forms, $_POST['submit'] will not be set if I submit the form by pressing [ENTER] in one of the text field. So, if the later case happen, I need to remind the user to explicitly click the [Submit] button. I don't know why or in what condition that pressing [ENTER] will not submit the whole form include the $_POST['submit'].

Keith


"Ashley Sheridan" <a...@ashleysheridan.co.uk> wrote in message news:1251467419.27899.106.ca...@localhost...
On Thu, 2009-08-27 at 23:21 -0400, Adam Jimerson wrote:
On 08/27/2009 11:09 PM, Adam Jimerson wrote:
> This question might give away the fact that I am a php noob, but I am
> looking for the best way to test for form submission in PHP.  I know in
> Perl this can be done with
>
> if (param)
>
> but I don't know if that will work with PHP.  I have read the Learning
> PHP 5 book and the only thing that was mentioned in the book was the > use
> of something like this
>
> print "<p>Hello ".$_POST['username']."</p>";

Sorry copied and pasted the wrong line (long day)

if (array_key_exists('username',$_POST))
>
> I'm sure that this is not the best/recommended way to do this but I'm
> hoping someone here will point me in the right direction.



The best way I've found is to do something like this:

if(isset($_POST['submit']))
{}

Note that in-place of submit you can put the name of any form element. I
chose submit here, because every form should have a submit button. Note
also that this will only work if you have given your submit button a
name:

<input type="submit" name="submit" value="Submit"/>

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




--- End Message ---
--- Begin Message ---
I've heard stories like this before, but never encountered it myself.

I forgot to mention that it is a good idea to give your submit buttons a
"value" attribute. Regardless of how the form is submitted, you should then
have a value for ['submit'].

Reminding the user that they must do anything other than the simplest things
is usually not a good approach. There will inevitably be users who do not
see/follow your reminder and use the enter button. Give the submit button a
value.


On Sat, Aug 29, 2009 at 6:50 AM, Keith <survivor_...@hotmail.com> wrote:

> I've encountered issue with checking $_POST['submit']
>   if(isset($_POST['submit'])) {}
>
> If the form consists of checkbox/radio and text field, some of my forms can
> be submitted by just press [ENTER] at the end of one of the text field. In
> this case, the $_POST['submit'] is set even the  submit button was not
> clicked.
> However, in some of my forms, $_POST['submit'] will not be set if I submit
> the form by pressing [ENTER] in one of the text field.
> So, if the later case happen, I need to remind the user to explicitly click
> the [Submit] button.
> I don't know why or in what condition that pressing [ENTER] will not submit
> the whole form include the $_POST['submit'].
>
> Keith
>
>
> "Ashley Sheridan" <a...@ashleysheridan.co.uk> wrote in message
> news:1251467419.27899.106.ca...@localhost...
>
>  On Thu, 2009-08-27 at 23:21 -0400, Adam Jimerson wrote:
>>
>>> On 08/27/2009 11:09 PM, Adam Jimerson wrote:
>>> > This question might give away the fact that I am a php noob, but I am
>>> > looking for the best way to test for form submission in PHP.  I know in
>>> > Perl this can be done with
>>> >
>>> > if (param)
>>> >
>>> > but I don't know if that will work with PHP.  I have read the Learning
>>> > PHP 5 book and the only thing that was mentioned in the book was the >
>>> use
>>> > of something like this
>>> >
>>> > print "<p>Hello ".$_POST['username']."</p>";
>>>
>>> Sorry copied and pasted the wrong line (long day)
>>>
>>> if (array_key_exists('username',$_POST))
>>> >
>>> > I'm sure that this is not the best/recommended way to do this but I'm
>>> > hoping someone here will point me in the right direction.
>>>
>>>
>>>
>> The best way I've found is to do something like this:
>>
>> if(isset($_POST['submit']))
>> {}
>>
>> Note that in-place of submit you can put the name of any form element. I
>> chose submit here, because every form should have a submit button. Note
>> also that this will only work if you have given your submit button a
>> name:
>>
>> <input type="submit" name="submit" value="Submit"/>
>>
>> Thanks,
>> Ash
>> http://www.ashleysheridan.co.uk
>>
>>
>>
>>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On Sat, 29 Aug 2009 12:50:41 +0800, "Keith" wrote:

> I don't know why or in what condition that pressing [ENTER] will not submit 
> the whole form include the $_POST['submit'].

<http://www.alanflavell.org.uk/www/formquestion.html>
<http://www.alanflavell.org.uk/www/#Tips>


/Nisse

--- End Message ---
--- Begin Message ---
To test a form I usually send the form contents to a php file that contains
the following;

foreach($_POST as $nm => $val) echo "_POST[".$nm."] [".$val."]<br>";
foreach($_GET as $nm => $val) echo "_GET[".$nm."] [".$val."]<br>";

Checkboxes and radio buttons only send their value if the control is
"checked".

You can have multiple submit buttons (type="submit") on a form, but you
should assign them different name parameters to recognize which one is
clicked (any one of them will cause the form to be submitted, but the only
one that will establish a $_POST entry named "submit" is the submit control
that is named "submit" (name="submit"). 

Pressing enter is not sensed by most controls.
Most browsers will look at the field the cursor is positioned on when enter
is pressed, and if it is not one of the controls that response to an enter,
it scans the DOM (list of controls), and will apply the enter to the first
control that responds to an enter, most common is the type="submit" control.


If a select control is between the text box and the submit button (in the
DOM list) the current entry for the select list will be selected and the
form will not be submitted unless the list includes a
onChange="this.form.submit(); " javascript entry.

Be careful designing forms that are dependent on some of these behaviors,
like positioning a submit button to the right of a text box to intentionally
receive the "enter", because different browsers will probably behave
differently.

Hope this helps a bit.

Warren Vail
Vail Systems Technology

-----Original Message-----
From: Keith [mailto:survivor_...@hotmail.com] 
Sent: Friday, August 28, 2009 9:51 PM
To: php-gene...@lists.php.net
Subject: Re: [PHP] Re: Best way to test for form submission?

I've encountered issue with checking $_POST['submit']
    if(isset($_POST['submit'])) {}

If the form consists of checkbox/radio and text field, some of my forms can 
be submitted by just press [ENTER] at the end of one of the text field. In 
this case, the $_POST['submit'] is set even the  submit button was not 
clicked.
However, in some of my forms, $_POST['submit'] will not be set if I submit 
the form by pressing [ENTER] in one of the text field.
So, if the later case happen, I need to remind the user to explicitly click 
the [Submit] button.
I don't know why or in what condition that pressing [ENTER] will not submit 
the whole form include the $_POST['submit'].

Keith


"Ashley Sheridan" <a...@ashleysheridan.co.uk> wrote in message 
news:1251467419.27899.106.ca...@localhost...
> On Thu, 2009-08-27 at 23:21 -0400, Adam Jimerson wrote:
>> On 08/27/2009 11:09 PM, Adam Jimerson wrote:
>> > This question might give away the fact that I am a php noob, but I am
>> > looking for the best way to test for form submission in PHP.  I know in
>> > Perl this can be done with
>> >
>> > if (param)
>> >
>> > but I don't know if that will work with PHP.  I have read the Learning
>> > PHP 5 book and the only thing that was mentioned in the book was the 
>> > use
>> > of something like this
>> >
>> > print "<p>Hello ".$_POST['username']."</p>";
>>
>> Sorry copied and pasted the wrong line (long day)
>>
>> if (array_key_exists('username',$_POST))
>> >
>> > I'm sure that this is not the best/recommended way to do this but I'm
>> > hoping someone here will point me in the right direction.
>>
>>
>
> The best way I've found is to do something like this:
>
> if(isset($_POST['submit']))
> {}
>
> Note that in-place of submit you can put the name of any form element. I
> chose submit here, because every form should have a submit button. Note
> also that this will only work if you have given your submit button a
> name:
>
> <input type="submit" name="submit" value="Submit"/>
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
> 

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


--- End Message ---
--- Begin Message ---
Shawn McKenzie wrote:
> Adam Jimerson wrote:
>> This question might give away the fact that I am a php noob, but I am
>> looking for the best way to test for form submission in PHP.

[..]

> Just to throw it into the mix:
> 
> if(!empty($_POST)) for a general test of whether any form was posted.

There are more methods, I always use:

if($_SERVER["REQUEST_METHOD"] == "POST") {

    do_something();

}


--- End Message ---
--- Begin Message ---
At 5:33 PM +0100 8/28/09, Ashley Sheridan wrote:
On Fri, 2009-08-28 at 12:28 -0400, tedd wrote:
 > Ash:

 What catches me every once in a while is using variable names that
 are the same as $_SESSION indexes, such as:

     $session_name =  $_SESSION['session_name'];

 Believe it or not, that does NOT always work! Sometimes I have to do this --

     $my_session_name =  $_SESSION['session_name'];

 -- to get around the problem.

 I have experienced this error more than once -- it's strange.

 Cheers,

 tedd

Does that happen even with register globals off?

Yes. it happens with register globals set to off

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
Ash, Ben, Thanks!

For my web server, I can access to:
./httpdocs
./httpsdocs

all the http documents are stored inside httpdocs and SSL documents inside httpsdocs. The web root you mean here is referred to ./httpdocs and ./httpsdocs or the parent directory of them? If I put the logfile inside ./log/logfile.txt where ./log is same level as ./httpdocs, can the web users access it?

Thanks!
Keith


"Ashley Sheridan" <a...@ashleysheridan.co.uk> wrote in message news:1251477059.27899.117.ca...@localhost...
On Fri, 2009-08-28 at 09:28 -0700, Ben Dunlap wrote:
> Which format should I used for log file? *.log or *.txt?

Doesn't matter to PHP -- but you do need to provide a local path, not a URL.

> [http://domain.com/log/logfile.*] or

No...

> [C:\some_path\domain.com\log\logfile.*] or just

Yes!

Ben

You should try and put the log somewhere that is not in the web root, to
prevent anyone from accessing it and getting information which could
help a hack.


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




--- End Message ---
--- Begin Message ---
nobody have a solution for no-unicode php script with MBCS (Multiple
Byte Character Set) run on php6?
I have an wrong spelling for MBCS in OM.:(

2009/8/27 hack988 hack988 <hack...@dev.htwap.com>:
>  I'm not sure,but one thing is that ,the code save as ANSI format will
> throw Parse error in php6.
> Sometime I don't like script run with unicode because of some system
> environment limitation.
> I'm make a spell mistake in before message :( (trow->throw).
> Any boday have a solution for it?
>

--- End Message ---
--- Begin Message ---
----- Original Message ----- 
From: "John Meyer" <johnme...@pueblocomputing.com>
To: <php-gene...@lists.php.net>
Sent: Friday, August 28, 2009 1:56 AM
Subject: [PHP] Converting URL's to hyperlinks.


> What sort of function would I need if I wanted to convert those URLs 
> from plain jane text?
> 

You should encode the url before printing as usual way

$url = htmlentities('http://www.mysite.com/index.php?act=1&t=10');

echo "<a href=\"{$url}\">mysite</a>";


- Eric

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

--- End Message ---
--- Begin Message ---
are u shure, u dont send anything out before u send the headers? even one
space would be too much.

ralph_def...@yahoo.de

"Dan Shirah" <mrsqua...@gmail.com> wrote in message
news:a16da1ff0908281328k641ea332v25d887c4de5b3...@mail.gmail.com...
> >
> > You will need to add some headers to the page to popup the prompt, at
least
> > with
> > these.
> >
> > $filename = 'somefile.tif';
> > $filesize = filesize($filename);
> >
> > header('Content-Type: application/force-download');
> > header('Content-disposition: attachement; filename=' . $filename);
> > header('Content-length: ' . $filesize);
> >
> > Eric
> >
> >
>
> I don't know what I'm doing wrong.  I've tried:
>
> header('Content-Description: File Transfer');
> header('Content-Type: application/force-download');
> header('Content-Length: ' . filesize($filename));
> header('Content-Disposition: attachment; filename=' . basename($file));
> readfile($file);
> AND
>
> if (file_exists($new_file)) {
>     header('Content-Description: File Transfer');
>     header('Content-Type: application/octet-stream');
>     header('Content-Disposition: attachment; filename='.basename($new_file
> ));
>     header('Content-Transfer-Encoding: binary');
>     header('Expires: 0');
>     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
>     header('Pragma: public');
>     header('Content-Length: ' . filesize($new_file));
>     ob_clean();
>     flush();
>     readfile($new_file);
>     exit;
> }
>
> But everything I do just sends heiroglyphics to the screen instead of
giving
> the download box.
>



--- End Message ---
--- Begin Message ---
On Sat, 2009-08-29 at 09:03 +0200, Ralph Deffke wrote:
> are u shure, u dont send anything out before u send the headers? even one
> space would be too much.
> 
> ralph_def...@yahoo.de
> 
> "Dan Shirah" <mrsqua...@gmail.com> wrote in message
> news:a16da1ff0908281328k641ea332v25d887c4de5b3...@mail.gmail.com...
> > >
> > > You will need to add some headers to the page to popup the prompt, at
> least
> > > with
> > > these.
> > >
> > > $filename = 'somefile.tif';
> > > $filesize = filesize($filename);
> > >
> > > header('Content-Type: application/force-download');
> > > header('Content-disposition: attachement; filename=' . $filename);
> > > header('Content-length: ' . $filesize);
> > >
> > > Eric
> > >
> > >
> >
> > I don't know what I'm doing wrong.  I've tried:
> >
> > header('Content-Description: File Transfer');
> > header('Content-Type: application/force-download');
> > header('Content-Length: ' . filesize($filename));
> > header('Content-Disposition: attachment; filename=' . basename($file));
> > readfile($file);
> > AND
> >
> > if (file_exists($new_file)) {
> >     header('Content-Description: File Transfer');
> >     header('Content-Type: application/octet-stream');
> >     header('Content-Disposition: attachment; filename='.basename($new_file
> > ));
> >     header('Content-Transfer-Encoding: binary');
> >     header('Expires: 0');
> >     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
> >     header('Pragma: public');
> >     header('Content-Length: ' . filesize($new_file));
> >     ob_clean();
> >     flush();
> >     readfile($new_file);
> >     exit;
> > }
> >
> > But everything I do just sends heiroglyphics to the screen instead of
> giving
> > the download box.
> >
> 
> 
> 
Try putting all of that inside of a headers_sent(){} block. If nothing
is displayed, it means that you've already sent something to the
browser, so the headers have already been sent and the extra ones you
are sending do nothing. This sort of thing is shown in your error log
also.

If you still get the tif displayed as text, then are you sure that the
tif is valid?

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




--- End Message ---
--- Begin Message ---
even the .tif is valid or not, the file should be downloaded


"Ashley Sheridan" <a...@ashleysheridan.co.uk> wrote in message
news:1251530173.27899.135.ca...@localhost...
> On Sat, 2009-08-29 at 09:03 +0200, Ralph Deffke wrote:
> > are u shure, u dont send anything out before u send the headers? even
one
> > space would be too much.
> >
> > ralph_def...@yahoo.de
> >
> > "Dan Shirah" <mrsqua...@gmail.com> wrote in message
> > news:a16da1ff0908281328k641ea332v25d887c4de5b3...@mail.gmail.com...
> > > >
> > > > You will need to add some headers to the page to popup the prompt,
at
> > least
> > > > with
> > > > these.
> > > >
> > > > $filename = 'somefile.tif';
> > > > $filesize = filesize($filename);
> > > >
> > > > header('Content-Type: application/force-download');
> > > > header('Content-disposition: attachement; filename=' . $filename);
> > > > header('Content-length: ' . $filesize);
> > > >
> > > > Eric
> > > >
> > > >
> > >
> > > I don't know what I'm doing wrong.  I've tried:
> > >
> > > header('Content-Description: File Transfer');
> > > header('Content-Type: application/force-download');
> > > header('Content-Length: ' . filesize($filename));
> > > header('Content-Disposition: attachment; filename=' .
basename($file));
> > > readfile($file);
> > > AND
> > >
> > > if (file_exists($new_file)) {
> > >     header('Content-Description: File Transfer');
> > >     header('Content-Type: application/octet-stream');
> > >     header('Content-Disposition: attachment;
filename='.basename($new_file
> > > ));
> > >     header('Content-Transfer-Encoding: binary');
> > >     header('Expires: 0');
> > >     header('Cache-Control: must-revalidate, post-check=0,
pre-check=0');
> > >     header('Pragma: public');
> > >     header('Content-Length: ' . filesize($new_file));
> > >     ob_clean();
> > >     flush();
> > >     readfile($new_file);
> > >     exit;
> > > }
> > >
> > > But everything I do just sends heiroglyphics to the screen instead of
> > giving
> > > the download box.
> > >
> >
> >
> >
> Try putting all of that inside of a headers_sent(){} block. If nothing
> is displayed, it means that you've already sent something to the
> browser, so the headers have already been sent and the extra ones you
> are sending do nothing. This sort of thing is shown in your error log
> also.
>
> If you still get the tif displayed as text, then are you sure that the
> tif is valid?
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>



--- End Message ---
--- Begin Message ---
----- Original Message ----- 
From: "Ashley Sheridan" <a...@ashleysheridan.co.uk>
To: "Ralph Deffke" <ralph_def...@yahoo.de>
Cc: <php-gene...@lists.php.net>
Sent: Saturday, August 29, 2009 3:16 PM
Subject: Re: [PHP] File Open Prompt?


> On Sat, 2009-08-29 at 09:03 +0200, Ralph Deffke wrote:
>> are u shure, u dont send anything out before u send the headers? even one
>> space would be too much.
>> 
>> ralph_def...@yahoo.de
>> 
>> "Dan Shirah" <mrsqua...@gmail.com> wrote in message
>> news:a16da1ff0908281328k641ea332v25d887c4de5b3...@mail.gmail.com...
>> > >
>> > > You will need to add some headers to the page to popup the prompt, at
>> least
>> > > with
>> > > these.
>> > >
>> > > $filename = 'somefile.tif';
>> > > $filesize = filesize($filename);
>> > >
>> > > header('Content-Type: application/force-download');
>> > > header('Content-disposition: attachement; filename=' . $filename);
>> > > header('Content-length: ' . $filesize);
>> > >
>> > > Eric
>> > >
>> > >
>> >
>> > I don't know what I'm doing wrong.  I've tried:
>> >
>> > header('Content-Description: File Transfer');
>> > header('Content-Type: application/force-download');
>> > header('Content-Length: ' . filesize($filename));
>> > header('Content-Disposition: attachment; filename=' . basename($file));
>> > readfile($file);
>> > AND
>> >
>> > if (file_exists($new_file)) {
>> >     header('Content-Description: File Transfer');
>> >     header('Content-Type: application/octet-stream');
>> >     header('Content-Disposition: attachment; filename='.basename($new_file
>> > ));
>> >     header('Content-Transfer-Encoding: binary');
>> >     header('Expires: 0');
>> >     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
>> >     header('Pragma: public');
>> >     header('Content-Length: ' . filesize($new_file));
>> >     ob_clean();
>> >     flush();
>> >     readfile($new_file);
>> >     exit;
>> > }
>> >
>> > But everything I do just sends heiroglyphics to the screen instead of
>> giving
>> > the download box.
>> >
>> 
>> 
>> 
> Try putting all of that inside of a headers_sent(){} block. If nothing
> is displayed, it means that you've already sent something to the
> browser, so the headers have already been sent and the extra ones you
> are sending do nothing. This sort of thing is shown in your error log
> also.
> 
> If you still get the tif displayed as text, then are you sure that the
> tif is valid?
>

You may also try put these line at top of page to avoid anythings sent before
your attachment headers

error_reporting(E_ALL);
ini_set('display_errors', 1);

Which browsers you used to test it and  their versions ?


- Eric


> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
----- Original Message ----- 
From: "Eric" <blueray2...@yahoo.com>
To: <a...@ashleysheridan.co.uk>; "Ralph Deffke" <ralph_def...@yahoo.de>
Cc: <php-gene...@lists.php.net>
Sent: Saturday, August 29, 2009 5:01 PM
Subject: Re: [PHP] File Open Prompt?


> 
> ----- Original Message ----- 
> From: "Ashley Sheridan" <a...@ashleysheridan.co.uk>
> To: "Ralph Deffke" <ralph_def...@yahoo.de>
> Cc: <php-gene...@lists.php.net>
> Sent: Saturday, August 29, 2009 3:16 PM
> Subject: Re: [PHP] File Open Prompt?
> 
> 
>> On Sat, 2009-08-29 at 09:03 +0200, Ralph Deffke wrote:
>>> are u shure, u dont send anything out before u send the headers? even one
>>> space would be too much.
>>> 
>>> ralph_def...@yahoo.de
>>> 
>>> "Dan Shirah" <mrsqua...@gmail.com> wrote in message
>>> news:a16da1ff0908281328k641ea332v25d887c4de5b3...@mail.gmail.com...
>>> > >
>>> > > You will need to add some headers to the page to popup the prompt, at
>>> least
>>> > > with
>>> > > these.
>>> > >
>>> > > $filename = 'somefile.tif';
>>> > > $filesize = filesize($filename);
>>> > >
>>> > > header('Content-Type: application/force-download');
>>> > > header('Content-disposition: attachement; filename=' . $filename);
>>> > > header('Content-length: ' . $filesize);
>>> > >
>>> > > Eric
>>> > >
>>> > >
>>> >
>>> > I don't know what I'm doing wrong.  I've tried:
>>> >
>>> > header('Content-Description: File Transfer');
>>> > header('Content-Type: application/force-download');
>>> > header('Content-Length: ' . filesize($filename));
>>> > header('Content-Disposition: attachment; filename=' . basename($file));
>>> > readfile($file);
>>> > AND
>>> >
>>> > if (file_exists($new_file)) {
>>> >     header('Content-Description: File Transfer');
>>> >     header('Content-Type: application/octet-stream');
>>> >     header('Content-Disposition: attachment; filename='.basename($new_file
>>> > ));
>>> >     header('Content-Transfer-Encoding: binary');
>>> >     header('Expires: 0');
>>> >     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
>>> >     header('Pragma: public');
>>> >     header('Content-Length: ' . filesize($new_file));
>>> >     ob_clean();
>>> >     flush();
>>> >     readfile($new_file);
>>> >     exit;
>>> > }
>>> >
>>> > But everything I do just sends heiroglyphics to the screen instead of
>>> giving
>>> > the download box.
>>> >
>>> 
>>> 
>>> 
>> Try putting all of that inside of a headers_sent(){} block. If nothing
>> is displayed, it means that you've already sent something to the
>> browser, so the headers have already been sent and the extra ones you
>> are sending do nothing. This sort of thing is shown in your error log
>> also.
>> 
>> If you still get the tif displayed as text, then are you sure that the
>> tif is valid?
>>
> 
> You may also try put these line at top of page to avoid anythings sent before
> your attachment headers
> 
> error_reporting(E_ALL);
> ini_set('display_errors', 1);
> 
> Which browsers you used to test it and  their versions ?
> 
> 

Also, did you browse it directly or through a secondary page ?
It should used on a second page.

i.e.

page1.php

<a href="download.php?id=10">download</a>

download.php

header( ....

-Eric

> 
> 
>> Thanks,
>> Ash
>> http://www.ashleysheridan.co.uk
>> 
>> 
>> 
>> 
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
>>

--- End Message ---
--- Begin Message ---
extension A has function a, extension B has function b. How can I make b
calls a?
-- 
View this message in context: 
http://www.nabble.com/Calling-extension-function-from-another-tp25185839p25200892.html
Sent from the PHP - General mailing list archive at Nabble.com.


--- End Message ---
--- Begin Message ---
On Sat, Aug 29, 2009 at 10:14 AM, leledumbo <leledumbo_c...@yahoo.co.id>wrote:

>
> extension A has function a, extension B has function b. How can I make b
> calls a?


What is an extension?


>
> --
> View this message in context:
> http://www.nabble.com/Calling-extension-function-from-another-tp25185839p25200892.html
> Sent from the PHP - General mailing list archive at Nabble.com.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
2009/8/28 leledumbo <leledumbo_c...@yahoo.co.id>:
>
> Is it possible to call a function that resides in an extension from another
> extension?

It's certainly possible but I've never needed to do it so I don't know
how. I suggest you ask this question on the PHP Internals list.

-Stuart

-- 
http://stut.net/

--- End Message ---

Reply via email to