OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general-digest-help_at_lists.php.net
Date: Sat Jan 11 2003 - 06:20:39 CST

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    php-general Digest 11 Jan 2003 12:20:39 -0000 Issue 1816

    Topics (messages 131210 through 131239):

    Re: Make fil downloadable
            131210 by: Timothy Hitchens \(HiTCHO\)
            131211 by: Stephen
            131213 by: Timothy Hitchens \(HiTCHO\)
            131214 by: Stephen
            131217 by: Timothy Hitchens \(HiTCHO\)
            131218 by: Stephen
            131219 by: Stephen

    php with mime magic?
            131212 by: Rob Brandt

    Re: session_destroy problem
            131215 by: Tamás Árpád
            131232 by: Larry Brown
            131239 by: Tamás Árpád

    Re: Source Guardian
            131216 by: UberGoober
            131224 by: michael kimsal
            131226 by: Sean Malloy
            131227 by: michael kimsal

    Suggestions on FAQ application?
            131220 by: Jeff Lewis
            131221 by: Timothy Hitchens \(HiTCHO\)
            131222 by: Jeff Lewis
            131223 by: Sean Malloy
            131225 by: michael kimsal

    Re: Medium to Large PHP Application Design
            131228 by: Manuel Lemos

    Re: how to passing two dimension array
            131229 by: Rizki Salamun

    Re: Encrypt in Javascript and Decrypt in PHP????
            131230 by: Gerald Timothy Quimpo

    Binary data confusion
            131231 by: Clay Loveless
            131233 by: Clay Loveless

    Session vars vs. POST/GET vars?
            131234 by: Noel Wade
            131235 by: Noel Wade
            131236 by: Jason k Larson

    Using $vars from include()d functions in the main programm and other functions
            131237 by: ben9000

    version confusion - please help
            131238 by: Christian Stalberg

    Administrivia:

    To subscribe to the digest, e-mail:
            php-general-digest-subscribelists.php.net

    To unsubscribe from the digest, e-mail:
            php-general-digest-unsubscribelists.php.net

    To post to the list, e-mail:
            php-generallists.php.net

    ----------------------------------------------------------------------

    attached mail follows:


    You need to send headers to tell the browser how to handle it see:
    header(); or.. if it is a php file and you want the visitor to
    see/download the source you would be better off giving it another
    extension eg .phps or .txt etc or have a handler file that did a
    readfile after sending headers.

    Timothy Hitchens (HiTCHO)
    Open Platform Consulting
    e-mail: timhitcho.com.au

    -----Original Message-----
    From: Stephen [mailto:webmastermelchior.us]
    Sent: Saturday, 11 January 2003 10:17 AM
    To: PHP List
    Subject: [PHP] Make fil downloadable

    I need to somehow make it so when a user clicks a link, then get
    displayed the download dialogue for the file. The file is a .php file so
    I'm not sure how this is done but I've seen it been done before. How can
    you do this?

    Thanks,
    Stephen Craton
    http://www.melchior.us

    "What's the point in appearance if your true love, doesn't care about
    it?" -- http://www.melchior.us

    attached mail follows:


    It's a dynamically created file the user downloads and uses later as a PHP
    script. If I put header() in it, that would make it downloadable again when
    the user uses it on his/her server, wouldn't it?

    ----- Original Message -----
    From: "Timothy Hitchens (HiTCHO)" <phplistshitcho.com.au>
    To: "'Stephen'" <webmastermelchior.us>; "'PHP List'"
    <php-generallists.php.net>
    Sent: Friday, January 10, 2003 7:24 PM
    Subject: RE: [PHP] Make fil downloadable

    : You need to send headers to tell the browser how to handle it see:
    : header(); or.. if it is a php file and you want the visitor to
    : see/download the source you would be better off giving it another
    : extension eg .phps or .txt etc or have a handler file that did a
    : readfile after sending headers.
    :
    :
    : Timothy Hitchens (HiTCHO)
    : Open Platform Consulting
    : e-mail: timhitcho.com.au
    :
    :
    : -----Original Message-----
    : From: Stephen [mailto:webmastermelchior.us]
    : Sent: Saturday, 11 January 2003 10:17 AM
    : To: PHP List
    : Subject: [PHP] Make fil downloadable
    :
    :
    : I need to somehow make it so when a user clicks a link, then get
    : displayed the download dialogue for the file. The file is a .php file so
    : I'm not sure how this is done but I've seen it been done before. How can
    : you do this?
    :
    : Thanks,
    : Stephen Craton
    : http://www.melchior.us
    :
    : "What's the point in appearance if your true love, doesn't care about
    : it?" -- http://www.melchior.us
    :
    :
    : --
    : PHP General Mailing List (http://www.php.net/)
    : To unsubscribe, visit: http://www.php.net/unsub.php
    :
    :
    :

    attached mail follows:


    eg:

    <a href="file.php">Download File Click Here</a>

    Now in the file.php you have:

    <?php

    header("Content-type: text/plain");
    header("Content-Disposition: attachment; filename=xxx.php");;
    // now we read the real file
    readfile('xxx.php');

    exit();

    ?>

    This won't put the headers into the downloaded file and remember to
    change the xxx.php into the file
    to be delivered and the xxx.php in the header to the name you would like
    them to save as.

    * the file.php in the top is not the real file but a script that reads
    into the buffer the real file!!

    Timothy Hitchens (HiTCHO)
    Open Platform Consulting
    e-mail: timhitcho.com.au

    > -----Original Message-----
    > From: Stephen [mailto:webmastermelchior.us]
    > Sent: Saturday, 11 January 2003 10:29 AM
    > To: Timothy Hitchens (HiTCHO)
    > Cc: PHP List
    > Subject: Re: [PHP] Make fil downloadable
    >
    >
    > It's a dynamically created file the user downloads and uses
    > later as a PHP script. If I put header() in it, that would
    > make it downloadable again when the user uses it on his/her
    > server, wouldn't it?
    >
    >
    > ----- Original Message -----
    > From: "Timothy Hitchens (HiTCHO)" <phplistshitcho.com.au>
    > To: "'Stephen'" <webmastermelchior.us>; "'PHP List'"
    > <php-generallists.php.net>
    > Sent: Friday, January 10, 2003 7:24 PM
    > Subject: RE: [PHP] Make fil downloadable
    >
    >
    > : You need to send headers to tell the browser how to handle it see:
    > : header(); or.. if it is a php file and you want the visitor to
    > : see/download the source you would be better off giving it another
    > : extension eg .phps or .txt etc or have a handler file that did a
    > : readfile after sending headers.
    > :
    > :
    > : Timothy Hitchens (HiTCHO)
    > : Open Platform Consulting
    > : e-mail: timhitcho.com.au
    > :
    > :
    > : -----Original Message-----
    > : From: Stephen [mailto:webmastermelchior.us]
    > : Sent: Saturday, 11 January 2003 10:17 AM
    > : To: PHP List
    > : Subject: [PHP] Make fil downloadable
    > :
    > :
    > : I need to somehow make it so when a user clicks a link, then get
    > : displayed the download dialogue for the file. The file is a
    > .php file so
    > : I'm not sure how this is done but I've seen it been done
    > before. How can
    > : you do this?
    > :
    > : Thanks,
    > : Stephen Craton
    > : http://www.melchior.us
    > :
    > : "What's the point in appearance if your true love, doesn't
    > care about
    > : it?" -- http://www.melchior.us
    > :
    > :
    > : --
    > : PHP General Mailing List (http://www.php.net/)
    > : To unsubscribe, visit: http://www.php.net/unsub.php
    > :
    > :
    > :
    >
    >

    attached mail follows:


    Would this print the contents or the actual file for download?

    ----- Original Message -----
    From: "Timothy Hitchens (HiTCHO)" <phplistshitcho.com.au>
    To: "'Stephen'" <webmastermelchior.us>
    Cc: "'PHP List'" <php-generallists.php.net>
    Sent: Friday, January 10, 2003 7:47 PM
    Subject: RE: [PHP] Make fil downloadable

    : eg:
    :
    : <a href="file.php">Download File Click Here</a>
    :
    : Now in the file.php you have:
    :
    : <?php
    :
    : header("Content-type: text/plain");
    : header("Content-Disposition: attachment; filename=xxx.php");;
    : // now we read the real file
    : readfile('xxx.php');
    :
    : exit();
    :
    : ?>
    :
    : This won't put the headers into the downloaded file and remember to
    : change the xxx.php into the file
    : to be delivered and the xxx.php in the header to the name you would like
    : them to save as.
    :
    : * the file.php in the top is not the real file but a script that reads
    : into the buffer the real file!!
    :
    :
    :
    : Timothy Hitchens (HiTCHO)
    : Open Platform Consulting
    : e-mail: timhitcho.com.au
    :
    : > -----Original Message-----
    : > From: Stephen [mailto:webmastermelchior.us]
    : > Sent: Saturday, 11 January 2003 10:29 AM
    : > To: Timothy Hitchens (HiTCHO)
    : > Cc: PHP List
    : > Subject: Re: [PHP] Make fil downloadable
    : >
    : >
    : > It's a dynamically created file the user downloads and uses
    : > later as a PHP script. If I put header() in it, that would
    : > make it downloadable again when the user uses it on his/her
    : > server, wouldn't it?
    : >
    : >
    : > ----- Original Message -----
    : > From: "Timothy Hitchens (HiTCHO)" <phplistshitcho.com.au>
    : > To: "'Stephen'" <webmastermelchior.us>; "'PHP List'"
    : > <php-generallists.php.net>
    : > Sent: Friday, January 10, 2003 7:24 PM
    : > Subject: RE: [PHP] Make fil downloadable
    : >
    : >
    : > : You need to send headers to tell the browser how to handle it see:
    : > : header(); or.. if it is a php file and you want the visitor to
    : > : see/download the source you would be better off giving it another
    : > : extension eg .phps or .txt etc or have a handler file that did a
    : > : readfile after sending headers.
    : > :
    : > :
    : > : Timothy Hitchens (HiTCHO)
    : > : Open Platform Consulting
    : > : e-mail: timhitcho.com.au
    : > :
    : > :
    : > : -----Original Message-----
    : > : From: Stephen [mailto:webmastermelchior.us]
    : > : Sent: Saturday, 11 January 2003 10:17 AM
    : > : To: PHP List
    : > : Subject: [PHP] Make fil downloadable
    : > :
    : > :
    : > : I need to somehow make it so when a user clicks a link, then get
    : > : displayed the download dialogue for the file. The file is a
    : > .php file so
    : > : I'm not sure how this is done but I've seen it been done
    : > before. How can
    : > : you do this?
    : > :
    : > : Thanks,
    : > : Stephen Craton
    : > : http://www.melchior.us
    : > :
    : > : "What's the point in appearance if your true love, doesn't
    : > care about
    : > : it?" -- http://www.melchior.us
    : > :
    : > :
    : > : --
    : > : PHP General Mailing List (http://www.php.net/)
    : > : To unsubscribe, visit: http://www.php.net/unsub.php
    : > :
    : > :
    : > :
    : >
    : >
    :
    :
    :

    attached mail follows:


    Correct!... yes the source not interpreted raw!!

    Isn't that what you wanted??

    Timothy Hitchens (HiTCHO)
    Open Platform Consulting
    e-mail: timhitcho.com.au

    > -----Original Message-----
    > From: Stephen [mailto:webmastermelchior.us]
    > Sent: Saturday, 11 January 2003 11:01 AM
    > To: Timothy Hitchens (HiTCHO)
    > Cc: PHP List
    > Subject: Re: [PHP] Make fil downloadable
    >
    >
    > Would this print the contents or the actual file for download?
    >
    >
    > ----- Original Message -----
    > From: "Timothy Hitchens (HiTCHO)" <phplistshitcho.com.au>
    > To: "'Stephen'" <webmastermelchior.us>
    > Cc: "'PHP List'" <php-generallists.php.net>
    > Sent: Friday, January 10, 2003 7:47 PM
    > Subject: RE: [PHP] Make fil downloadable
    >
    >
    > : eg:
    > :
    > : <a href="file.php">Download File Click Here</a>
    > :
    > : Now in the file.php you have:
    > :
    > : <?php
    > :
    > : header("Content-type: text/plain");
    > : header("Content-Disposition: attachment; filename=xxx.php");;
    > : // now we read the real file
    > : readfile('xxx.php');
    > :
    > : exit();
    > :
    > : ?>
    > :
    > : This won't put the headers into the downloaded file and remember to
    > : change the xxx.php into the file
    > : to be delivered and the xxx.php in the header to the name
    > you would like
    > : them to save as.
    > :
    > : * the file.php in the top is not the real file but a script
    > that reads
    > : into the buffer the real file!!
    > :
    > :
    > :
    > : Timothy Hitchens (HiTCHO)
    > : Open Platform Consulting
    > : e-mail: timhitcho.com.au
    > :
    > : > -----Original Message-----
    > : > From: Stephen [mailto:webmastermelchior.us]
    > : > Sent: Saturday, 11 January 2003 10:29 AM
    > : > To: Timothy Hitchens (HiTCHO)
    > : > Cc: PHP List
    > : > Subject: Re: [PHP] Make fil downloadable
    > : >
    > : >
    > : > It's a dynamically created file the user downloads and uses
    > : > later as a PHP script. If I put header() in it, that would
    > : > make it downloadable again when the user uses it on his/her
    > : > server, wouldn't it?
    > : >
    > : >
    > : > ----- Original Message -----
    > : > From: "Timothy Hitchens (HiTCHO)" <phplistshitcho.com.au>
    > : > To: "'Stephen'" <webmastermelchior.us>; "'PHP List'"
    > : > <php-generallists.php.net>
    > : > Sent: Friday, January 10, 2003 7:24 PM
    > : > Subject: RE: [PHP] Make fil downloadable
    > : >
    > : >
    > : > : You need to send headers to tell the browser how to
    > handle it see:
    > : > : header(); or.. if it is a php file and you want the visitor to
    > : > : see/download the source you would be better off giving
    > it another
    > : > : extension eg .phps or .txt etc or have a handler file that did a
    > : > : readfile after sending headers.
    > : > :
    > : > :
    > : > : Timothy Hitchens (HiTCHO)
    > : > : Open Platform Consulting
    > : > : e-mail: timhitcho.com.au
    > : > :
    > : > :
    > : > : -----Original Message-----
    > : > : From: Stephen [mailto:webmastermelchior.us]
    > : > : Sent: Saturday, 11 January 2003 10:17 AM
    > : > : To: PHP List
    > : > : Subject: [PHP] Make fil downloadable
    > : > :
    > : > :
    > : > : I need to somehow make it so when a user clicks a link, then get
    > : > : displayed the download dialogue for the file. The file is a
    > : > .php file so
    > : > : I'm not sure how this is done but I've seen it been done
    > : > before. How can
    > : > : you do this?
    > : > :
    > : > : Thanks,
    > : > : Stephen Craton
    > : > : http://www.melchior.us
    > : > :
    > : > : "What's the point in appearance if your true love, doesn't
    > : > care about
    > : > : it?" -- http://www.melchior.us
    > : > :
    > : > :
    > : > : --
    > : > : PHP General Mailing List (http://www.php.net/)
    > : > : To unsubscribe, visit: http://www.php.net/unsub.php
    > : > :
    > : > :
    > : > :
    > : >
    > : >
    > :
    > :
    > :
    >

    attached mail follows:


    I wanted it so the user downloaded the file to their PC like when you're
    downloading a zip file or exe file from someplace like www.download.com...

    ----- Original Message -----
    From: "Timothy Hitchens (HiTCHO)" <phplistshitcho.com.au>
    To: "'Stephen'" <webmastermelchior.us>
    Cc: "'PHP List'" <php-generallists.php.net>
    Sent: Friday, January 10, 2003 8:40 PM
    Subject: RE: [PHP] Make fil downloadable

    : Correct!... yes the source not interpreted raw!!
    :
    : Isn't that what you wanted??
    :
    :
    : Timothy Hitchens (HiTCHO)
    : Open Platform Consulting
    : e-mail: timhitcho.com.au
    :
    : > -----Original Message-----
    : > From: Stephen [mailto:webmastermelchior.us]
    : > Sent: Saturday, 11 January 2003 11:01 AM
    : > To: Timothy Hitchens (HiTCHO)
    : > Cc: PHP List
    : > Subject: Re: [PHP] Make fil downloadable
    : >
    : >
    : > Would this print the contents or the actual file for download?
    : >
    : >
    : > ----- Original Message -----
    : > From: "Timothy Hitchens (HiTCHO)" <phplistshitcho.com.au>
    : > To: "'Stephen'" <webmastermelchior.us>
    : > Cc: "'PHP List'" <php-generallists.php.net>
    : > Sent: Friday, January 10, 2003 7:47 PM
    : > Subject: RE: [PHP] Make fil downloadable
    : >
    : >
    : > : eg:
    : > :
    : > : <a href="file.php">Download File Click Here</a>
    : > :
    : > : Now in the file.php you have:
    : > :
    : > : <?php
    : > :
    : > : header("Content-type: text/plain");
    : > : header("Content-Disposition: attachment; filename=xxx.php");;
    : > : // now we read the real file
    : > : readfile('xxx.php');
    : > :
    : > : exit();
    : > :
    : > : ?>
    : > :
    : > : This won't put the headers into the downloaded file and remember to
    : > : change the xxx.php into the file
    : > : to be delivered and the xxx.php in the header to the name
    : > you would like
    : > : them to save as.
    : > :
    : > : * the file.php in the top is not the real file but a script
    : > that reads
    : > : into the buffer the real file!!
    : > :
    : > :
    : > :
    : > : Timothy Hitchens (HiTCHO)
    : > : Open Platform Consulting
    : > : e-mail: timhitcho.com.au
    : > :
    : > : > -----Original Message-----
    : > : > From: Stephen [mailto:webmastermelchior.us]
    : > : > Sent: Saturday, 11 January 2003 10:29 AM
    : > : > To: Timothy Hitchens (HiTCHO)
    : > : > Cc: PHP List
    : > : > Subject: Re: [PHP] Make fil downloadable
    : > : >
    : > : >
    : > : > It's a dynamically created file the user downloads and uses
    : > : > later as a PHP script. If I put header() in it, that would
    : > : > make it downloadable again when the user uses it on his/her
    : > : > server, wouldn't it?
    : > : >
    : > : >
    : > : > ----- Original Message -----
    : > : > From: "Timothy Hitchens (HiTCHO)" <phplistshitcho.com.au>
    : > : > To: "'Stephen'" <webmastermelchior.us>; "'PHP List'"
    : > : > <php-generallists.php.net>
    : > : > Sent: Friday, January 10, 2003 7:24 PM
    : > : > Subject: RE: [PHP] Make fil downloadable
    : > : >
    : > : >
    : > : > : You need to send headers to tell the browser how to
    : > handle it see:
    : > : > : header(); or.. if it is a php file and you want the visitor to
    : > : > : see/download the source you would be better off giving
    : > it another
    : > : > : extension eg .phps or .txt etc or have a handler file that did a
    : > : > : readfile after sending headers.
    : > : > :
    : > : > :
    : > : > : Timothy Hitchens (HiTCHO)
    : > : > : Open Platform Consulting
    : > : > : e-mail: timhitcho.com.au
    : > : > :
    : > : > :
    : > : > : -----Original Message-----
    : > : > : From: Stephen [mailto:webmastermelchior.us]
    : > : > : Sent: Saturday, 11 January 2003 10:17 AM
    : > : > : To: PHP List
    : > : > : Subject: [PHP] Make fil downloadable
    : > : > :
    : > : > :
    : > : > : I need to somehow make it so when a user clicks a link, then get
    : > : > : displayed the download dialogue for the file. The file is a
    : > : > .php file so
    : > : > : I'm not sure how this is done but I've seen it been done
    : > : > before. How can
    : > : > : you do this?
    : > : > :
    : > : > : Thanks,
    : > : > : Stephen Craton
    : > : > : http://www.melchior.us
    : > : > :
    : > : > : "What's the point in appearance if your true love, doesn't
    : > : > care about
    : > : > : it?" -- http://www.melchior.us
    : > : > :
    : > : > :
    : > : > : --
    : > : > : PHP General Mailing List (http://www.php.net/)
    : > : > : To unsubscribe, visit: http://www.php.net/unsub.php
    : > : > :
    : > : > :
    : > : > :
    : > : >
    : > : >
    : > :
    : > :
    : > :
    : >
    :
    :

    attached mail follows:


    Eh, sorry. Didn't understand what you meant. Thanks for the code, it does do
    what I was asking. Thanks again!

    ----- Original Message -----
    From: "Timothy Hitchens (HiTCHO)" <phplistshitcho.com.au>
    To: "'Stephen'" <webmastermelchior.us>
    Cc: "'PHP List'" <php-generallists.php.net>
    Sent: Friday, January 10, 2003 8:40 PM
    Subject: RE: [PHP] Make fil downloadable

    : Correct!... yes the source not interpreted raw!!
    :
    : Isn't that what you wanted??
    :
    :
    : Timothy Hitchens (HiTCHO)
    : Open Platform Consulting
    : e-mail: timhitcho.com.au
    :
    : > -----Original Message-----
    : > From: Stephen [mailto:webmastermelchior.us]
    : > Sent: Saturday, 11 January 2003 11:01 AM
    : > To: Timothy Hitchens (HiTCHO)
    : > Cc: PHP List
    : > Subject: Re: [PHP] Make fil downloadable
    : >
    : >
    : > Would this print the contents or the actual file for download?
    : >
    : >
    : > ----- Original Message -----
    : > From: "Timothy Hitchens (HiTCHO)" <phplistshitcho.com.au>
    : > To: "'Stephen'" <webmastermelchior.us>
    : > Cc: "'PHP List'" <php-generallists.php.net>
    : > Sent: Friday, January 10, 2003 7:47 PM
    : > Subject: RE: [PHP] Make fil downloadable
    : >
    : >
    : > : eg:
    : > :
    : > : <a href="file.php">Download File Click Here</a>
    : > :
    : > : Now in the file.php you have:
    : > :
    : > : <?php
    : > :
    : > : header("Content-type: text/plain");
    : > : header("Content-Disposition: attachment; filename=xxx.php");;
    : > : // now we read the real file
    : > : readfile('xxx.php');
    : > :
    : > : exit();
    : > :
    : > : ?>
    : > :
    : > : This won't put the headers into the downloaded file and remember to
    : > : change the xxx.php into the file
    : > : to be delivered and the xxx.php in the header to the name
    : > you would like
    : > : them to save as.
    : > :
    : > : * the file.php in the top is not the real file but a script
    : > that reads
    : > : into the buffer the real file!!
    : > :
    : > :
    : > :
    : > : Timothy Hitchens (HiTCHO)
    : > : Open Platform Consulting
    : > : e-mail: timhitcho.com.au
    : > :
    : > : > -----Original Message-----
    : > : > From: Stephen [mailto:webmastermelchior.us]
    : > : > Sent: Saturday, 11 January 2003 10:29 AM
    : > : > To: Timothy Hitchens (HiTCHO)
    : > : > Cc: PHP List
    : > : > Subject: Re: [PHP] Make fil downloadable
    : > : >
    : > : >
    : > : > It's a dynamically created file the user downloads and uses
    : > : > later as a PHP script. If I put header() in it, that would
    : > : > make it downloadable again when the user uses it on his/her
    : > : > server, wouldn't it?
    : > : >
    : > : >
    : > : > ----- Original Message -----
    : > : > From: "Timothy Hitchens (HiTCHO)" <phplistshitcho.com.au>
    : > : > To: "'Stephen'" <webmastermelchior.us>; "'PHP List'"
    : > : > <php-generallists.php.net>
    : > : > Sent: Friday, January 10, 2003 7:24 PM
    : > : > Subject: RE: [PHP] Make fil downloadable
    : > : >
    : > : >
    : > : > : You need to send headers to tell the browser how to
    : > handle it see:
    : > : > : header(); or.. if it is a php file and you want the visitor to
    : > : > : see/download the source you would be better off giving
    : > it another
    : > : > : extension eg .phps or .txt etc or have a handler file that did a
    : > : > : readfile after sending headers.
    : > : > :
    : > : > :
    : > : > : Timothy Hitchens (HiTCHO)
    : > : > : Open Platform Consulting
    : > : > : e-mail: timhitcho.com.au
    : > : > :
    : > : > :
    : > : > : -----Original Message-----
    : > : > : From: Stephen [mailto:webmastermelchior.us]
    : > : > : Sent: Saturday, 11 January 2003 10:17 AM
    : > : > : To: PHP List
    : > : > : Subject: [PHP] Make fil downloadable
    : > : > :
    : > : > :
    : > : > : I need to somehow make it so when a user clicks a link, then get
    : > : > : displayed the download dialogue for the file. The file is a
    : > : > .php file so
    : > : > : I'm not sure how this is done but I've seen it been done
    : > : > before. How can
    : > : > : you do this?
    : > : > :
    : > : > : Thanks,
    : > : > : Stephen Craton
    : > : > : http://www.melchior.us
    : > : > :
    : > : > : "What's the point in appearance if your true love, doesn't
    : > : > care about
    : > : > : it?" -- http://www.melchior.us
    : > : > :
    : > : > :
    : > : > : --
    : > : > : PHP General Mailing List (http://www.php.net/)
    : > : > : To unsubscribe, visit: http://www.php.net/unsub.php
    : > : > :
    : > : > :
    : > : > :
    : > : >
    : > : >
    : > :
    : > :
    : > :
    : >
    :
    :

    attached mail follows:


    I'm trying to get php compiled with mime magic, and it doesn't
    appear to be working.

    Here's my phpinfo page, showing the parameters I've used to
    compile; it does show that I used '--enable-mime-magic' as
    instructed in the docs at php.net:

    http://horde.csd-bes.net/horde/test.php?mode=phpinfo (I need
    mime-magic for the latest Horde).

    My understanding is that there will be a section in phpinfo()
    displaying mime magic settings when everything is good. It is not
    there at this time.

    When I do the configure/make/make install, there are no complaints.

    Is this an extention that requires a seperate module file like
    mysql's mysql.so file? If so, it's no where on my system. I've
    googled to find something of the sort with no luck.

    I know also that I have to have a reference in php.ini pointing to
    the magic.mime file; my entry says:

    mime_magic.magicfile = "/usr/share/misc/magic.mime"

    and I have verified that the magic.mime file is actually in the
    location.

    How do I figure out what's wrong?

    Thanks

    attached mail follows:


    > Yes, the JavaScript code can run before the browser is closed but it would
    > not be finish running because the browser closing had been executed.
    > Someone had tried it before and struggled with it. But that is a good
    > advice, thanks for jumping in.
    I really doubt that browsers doesn't run the code that is in unload event of
    the page because the window is closed. That would be a very bad thing. Isn't
    it what the unload event is for? I mean to run code when the page is
    unloaded, it doesn't matter if the window is being closed or the user is
    going to another page. I think the browser should finish all the opened
    window's unload code and only after that close the application really.
    I made a quick test for it:
    <html>
    <head>
    <script language=javascript>
    function wait(msec){
     var enter_date = new Date();
     var enter_time = enter_date.getTime();

     var leave_date = new Date();
     var leave_time = leave_date.getTime();

     while (enter_time + msec > leave_time)
     {
      leave_date = new Date();
      leave_time = leave_date.getTime();
     }
     alert('unload test');
    }
    </script>
    </head>

    <body onunload="wait(5000)">
     unload test
    </body>
    </html

    It works fine for me in ie6 and mozila 0.9.6, it shows the alert message
    after about 5 seconds.

        Arpi

    attached mail follows:


    You da man. Unload is perfect. If the problem he mentioned before prevents
    the browser from finishing its communication with the server you can always
    send a wait command with sufficient time for things to finish up. I'll
    start testing in a live environment with it now. Thank you for the help.

    Larry S. Brown
    Dimension Networks, Inc.
    (727) 723-8388

    -----Original Message-----
    From: Tamás Árpád [mailto:stsmail.xubion.hu]
    Sent: Friday, January 10, 2003 8:03 PM
    To: Larry Brown; Scott Fletcher; PHP List
    Subject: Re: [PHP] session_destroy problem

    > Yes, the JavaScript code can run before the browser is closed but it would
    > not be finish running because the browser closing had been executed.
    > Someone had tried it before and struggled with it. But that is a good
    > advice, thanks for jumping in.
    I really doubt that browsers doesn't run the code that is in unload event of
    the page because the window is closed. That would be a very bad thing. Isn't
    it what the unload event is for? I mean to run code when the page is
    unloaded, it doesn't matter if the window is being closed or the user is
    going to another page. I think the browser should finish all the opened
    window's unload code and only after that close the application really.
    I made a quick test for it:
    <html>
    <head>
    <script language=javascript>
    function wait(msec){
     var enter_date = new Date();
     var enter_time = enter_date.getTime();

     var leave_date = new Date();
     var leave_time = leave_date.getTime();

     while (enter_time + msec > leave_time)
     {
      leave_date = new Date();
      leave_time = leave_date.getTime();
     }
     alert('unload test');
    }
    </script>
    </head>

    <body onunload="wait(5000)">
     unload test
    </body>
    </html

    It works fine for me in ie6 and mozila 0.9.6, it shows the alert message
    after about 5 seconds.

        Arpi

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

    attached mail follows:


    > You da man. Unload is perfect. If the problem he mentioned before prevents > the browser from finishing its communication with the server you can always > send a wait command with sufficient time for things to finish up. I'll > start testing in a live environment with it now. Thank you for the help. You don't have to use the wait function, I just made it to show that the browser will always wait till the script finishes it's job. Arpi

    attached mail follows:


    What is the URL, is it like Zend encoder?

    "Christopher Ditty" <cdittymlgw.org> wrote in message news:se1ec715.066mail.mlgw.org... > Does anyone here use Source Guardian? I am about to purchase it and > thought I'd ask before I do. Any problems using it? > > Thanks > > CDitty >

    attached mail follows:


    Christopher Ditty wrote: > Does anyone here use Source Guardian? I am about to purchase it and > thought I'd ask before I do. Any problems using it? > > Thanks > > CDitty >

    Hello.

    We've used it to create demos. It does work, but is being surpassed by other options (at the time we purchased, it was the cheapest option, but it's not anymore).

    They seem to have updated their site some - $150 for 'just' the obfuscator is a bit much, and the obfuscation portion was, I thought, pretty poor.

    If you relied at all on globals, or ever used 'extract' on arrays coming from form input, it was useless. We don't rely on globals, but we do rely on form array extraction sometimes - completely wasted when the system would 'obfuscate' your code. Reason being:

    <? echo $myName; ?> becomes <? echo $uu7whfdsisdf; ?>

    But if you've got a form with <input type='text' name='foo[bar]'>

    You can't do

    <? extract($_POST['foo']); echo $bar; ?>

    and expect it to work, because the obfuscation will turn it into:

    <? extract($_POST['foo']); echo $uu7whfdsisdf; ?>

    I wrote them and told them it was fairly pointless, atleast for systems large/advanced enough that you'd consider wanting to protect them in the first place.

    They didn't seem to have much on their site before about how to get new .so and .dll files for newer versions of PHP (they bundle .so and .dll files for each version of PHP - 4.1.0, 4.1.1, etc). Also, the support for working 'out of the box' with no need to fiddle with the php.ini file was useful. Ioncube's encoder answer requires your users to install the appropriate .so or .dll file in a particular directory, or to edit php.ini - not as useful for giving out demos. Ioncube is making an effort to move in that 'ease of use' direction, but it doesn't seem to be there just yet.

    Having said that, the ioncube answer offers a greater level of security for the encrypted code - the sourceguardian stuff is, last I checked, 'just' encrypted source code. zend and ioncube package encrypted byte code. If someone decrypts zend-encoded files, they'll only get bytecode. If they decrypt sourceguardian code, they get the original code. This was how it was last summer - they may have upgraded since then.

    All in all, it's not bad. That the files now can be run on Windows servers is a plus, but lack of a command line version to allow for dynamic encryption from a server isn't all that good. If you *need* that, you'll need to find something else. Why?

    The 'time limiting' aspect, for starters - you can set a 'timeout' for a particular date. Unless you put up a new trial file on a site every day, you won't be able to offer '14 day' trials, for a start. The file will timeout on date X, regardless of when the user downloaded it. The Zend license manager is much more flexible in that regard, but is overkill for most smaller projects.

    Does this help at all?

    Michael Kimsal http://www.logicreate.com 734-480-9961

    attached mail follows:


    Keep in mind the "Works out of the box with no changes to your server" requires the use of the function dl()

    according to the PHP docs; dl() is not supported in multithreaded Web servers. Use the extensions statement in your php.ini when operating under such an environment. However, the CGI and CLI build are not affected !

    I haven't tested wether it actually works with servers such as IIS/Apache2, and given its not supported, perhaps it works, but could have weird results after the so/dll has been loaded after the millionth time.

    user contributed notes off of the PHP site: the function dl() is not supported on Multithreaded systems like Windows XP. You need an external library for it, that has to be loaded when your server does. If not, you will get a fatal error and the script will stop parsing.

    -----Original Message----- From: michael kimsal [mailto:michaeltapinternet.com] Sent: Saturday, 11 January 2003 2:39 PM To: php-generallists.php.net; Christopher Ditty Subject: [PHP] Re: Source Guardian

    Christopher Ditty wrote: > Does anyone here use Source Guardian? I am about to purchase it and > thought I'd ask before I do. Any problems using it? > > Thanks > > CDitty >

    Hello.

    We've used it to create demos. It does work, but is being surpassed by other options (at the time we purchased, it was the cheapest option, but it's not anymore).

    They seem to have updated their site some - $150 for 'just' the obfuscator is a bit much, and the obfuscation portion was, I thought, pretty poor.

    If you relied at all on globals, or ever used 'extract' on arrays coming from form input, it was useless. We don't rely on globals, but we do rely on form array extraction sometimes - completely wasted when the system would 'obfuscate' your code. Reason being:

    <? echo $myName; ?> becomes <? echo $uu7whfdsisdf; ?>

    But if you've got a form with <input type='text' name='foo[bar]'>

    You can't do

    <? extract($_POST['foo']); echo $bar; ?>

    and expect it to work, because the obfuscation will turn it into:

    <? extract($_POST['foo']); echo $uu7whfdsisdf; ?>

    I wrote them and told them it was fairly pointless, atleast for systems large/advanced enough that you'd consider wanting to protect them in the first place.

    They didn't seem to have much on their site before about how to get new .so and .dll files for newer versions of PHP (they bundle .so and .dll files for each version of PHP - 4.1.0, 4.1.1, etc). Also, the support for working 'out of the box' with no need to fiddle with the php.ini file was useful. Ioncube's encoder answer requires your users to install the appropriate .so or .dll file in a particular directory, or to edit php.ini - not as useful for giving out demos. Ioncube is making an effort to move in that 'ease of use' direction, but it doesn't seem to be there just yet.

    Having said that, the ioncube answer offers a greater level of security for the encrypted code - the sourceguardian stuff is, last I checked, 'just' encrypted source code. zend and ioncube package encrypted byte code. If someone decrypts zend-encoded files, they'll only get bytecode. If they decrypt sourceguardian code, they get the original code. This was how it was last summer - they may have upgraded since then.

    All in all, it's not bad. That the files now can be run on Windows servers is a plus, but lack of a command line version to allow for dynamic encryption from a server isn't all that good. If you *need* that, you'll need to find something else. Why?

    The 'time limiting' aspect, for starters - you can set a 'timeout' for a particular date. Unless you put up a new trial file on a site every day, you won't be able to offer '14 day' trials, for a start. The file will timeout on date X, regardless of when the user downloaded it. The Zend license manager is much more flexible in that regard, but is overkill for most smaller projects.

    Does this help at all?

    Michael Kimsal http://www.logicreate.com 734-480-9961

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

    attached mail follows:


    Sean Malloy wrote: > Keep in mind the "Works out of the box with no changes to your server" > requires the use of the function dl() > Good point - had forgotten that may have issues for some people.

    However - in our case we've used 'protected' versions only for demos, which people generally aren't running on production machines, but local development environments, so issues of crashing or 'safe_mode' and other issues have usually been of limited concern. But it is a good point nonetheless, and isn't just a strike against SG, but ioncube as well should the user not be able to edit the php.ini file.

    > according to the PHP docs; > dl() is not supported in multithreaded Web servers. Use the extensions > statement in your php.ini when operating under such an environment. > However, the CGI and CLI build are not affected ! >

    attached mail follows:


    I've checked Hotscripts and I can't findanything relatively new or that suits my needs. I was wondering if anyone uses a FAQ program that they could suggest?

    Jeff

    attached mail follows:


    It is a 30 minute write... not that hard!!

    Timothy Hitchens (HiTCHO) Open Platform Consulting e-mail: timhitcho.com.au

    > -----Original Message----- > From: Jeff Lewis [mailto:jeffhyrum.net] > Sent: Saturday, 11 January 2003 12:37 PM > To: php-gen > Subject: [PHP] Suggestions on FAQ application? > > > I've checked Hotscripts and I can't findanything relatively > new or that suits my needs. I was wondering if anyone uses a > FAQ program that they could suggest? > > Jeff >

    attached mail follows:


    Why re-invent what is already written? I'm well aware that it's easy to write but there may be something out there already that suits my needs and has some features that I hadn't thought of. If you don't have a suggestion on a package please spare me the rude replies which seem to run rampant on here lately...

    Jeff ----- Original Message ----- From: "Timothy Hitchens (HiTCHO)" <phplistshitcho.com.au> To: "'Jeff Lewis'" <jeffhyrum.net>; "'php-gen'" <php-generallists.php.net> Sent: Friday, January 10, 2003 9:39 PM Subject: RE: [PHP] Suggestions on FAQ application?

    > It is a 30 minute write... not that hard!! > > > Timothy Hitchens (HiTCHO) > Open Platform Consulting > e-mail: timhitcho.com.au > > > -----Original Message----- > > From: Jeff Lewis [mailto:jeffhyrum.net] > > Sent: Saturday, 11 January 2003 12:37 PM > > To: php-gen > > Subject: [PHP] Suggestions on FAQ application? > > > > > > I've checked Hotscripts and I can't findanything relatively > > new or that suits my needs. I was wondering if anyone uses a > > FAQ program that they could suggest? > > > > Jeff > > > > > >

    attached mail follows:


    I would suggest you try one of the following;

    faqomatic http://faqomatic.sourceforge.net/, which is actually perl based

    or phpFAQ http://product.cybergl.co.id/dev/version.php?cmd=browse&product_id=15

    or FAQbot http://mason.gmu.edu/~bhroleno/FB.html

    or knowhow^2 http://www.linuxclass.de/kh2/

    or piFAQ http://pifaq.sourceforge.net/

    or StandardFAQ http://www.stampede.org/~drax/StandardFAQ/

    or PHPWiki (http://phpwiki.sourceforge.net/) (Not a faq system, but it would do the job)

    when hotscripts fails, try sourceforge. when sourceforge fails, try freshmeat.

    -----Original Message----- From: Jeff Lewis [mailto:jeffhyrum.net] Sent: Saturday, 11 January 2003 1:52 PM To: Timothy Hitchens (HiTCHO); 'php-gen' Subject: Re: [PHP] Suggestions on FAQ application?

    Why re-invent what is already written? I'm well aware that it's easy to write but there may be something out there already that suits my needs and has some features that I hadn't thought of. If you don't have a suggestion on a package please spare me the rude replies which seem to run rampant on here lately...

    Jeff ----- Original Message ----- From: "Timothy Hitchens (HiTCHO)" <phplistshitcho.com.au> To: "'Jeff Lewis'" <jeffhyrum.net>; "'php-gen'" <php-generallists.php.net> Sent: Friday, January 10, 2003 9:39 PM Subject: RE: [PHP] Suggestions on FAQ application?

    > It is a 30 minute write... not that hard!! > > > Timothy Hitchens (HiTCHO) > Open Platform Consulting > e-mail: timhitcho.com.au > > > -----Original Message----- > > From: Jeff Lewis [mailto:jeffhyrum.net] > > Sent: Saturday, 11 January 2003 12:37 PM > > To: php-gen > > Subject: [PHP] Suggestions on FAQ application? > > > > > > I've checked Hotscripts and I can't findanything relatively > > new or that suits my needs. I was wondering if anyone uses a > > FAQ program that they could suggest? > > > > Jeff > > > > > >

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

    attached mail follows:


    Jeff Lewis wrote: > Why re-invent what is already written? I'm well aware that it's easy to > write but there may be something out there already that suits my needs and > has some features that I hadn't thought of. If you don't have a suggestion > on a package please spare me the rude replies which seem to run rampant on > here lately... > >>>I've checked Hotscripts and I can't findanything relatively >>>new or that suits my needs. I was wondering if anyone uses a >>>FAQ program that they could suggest? >>>

    Are you looking for something new, or something which suits your needs? Not trying to flame here, but I didn't understand the sentence.

    I think what the other poster was getting at is that if you searched and can't find anything that meets your needs, do go ahead and write your own tool. Yes, re-inventing the wheel isn't the best idea, but your 'wheel' (what you want the app to be) doesn't exist, based on your own searching.

    If you'd searched Lycos for 30 seconds, I'd say search again. If you've exhausted HotScripts, I'd say you've gone thru the majority of known systems - certainly systems that had authors who were interested enough to bother to register them in the first place.

    Michael Kimsal http://www.logicreate.com 734-480-9961

    attached mail follows:


    Hello,

    On 01/10/2003 01:51 AM, Nick Oostveen wrote: > As PHP becomes more accepted in the corporate world, it is only logical > that larger and more complex applications are going to be developed > using it. While there is an abundance of information out there about > making specific things work, there seems to be a shortage regarding the > big picture. > > As such, my question is this: What methods and techniques can be used to > help design and build complex, medium to large PHP applications that are > not only scalable, but maintainable and extensible? I'm looking for > online references, personal experience and opinion and even examples of > open source code which you think demonstrate the above criteria on this > one. I think an extended discussion on this topic could be of great > benefit to everyone. > > Obviously separating application and business logic from interface code > is a given, but what about other things? Are the object orientated > facilities of PHP currently worth really trying to take advantage of? If > so, what are you doing to take advantage of them? Are design concepts > such as design patterns relevant at this level? What frameworks, if > any, currently exist to assist in rapid, structured development, and > what specific benefits do they bring to the table?

    Your concerns are the same that I had several months ago. PHP is indeed fine for small applications but when it comes to large applications you end up coding by hand many repetitive tasks that could be abstracted by tools that generate the code for from conceptual definitions to save a lot of development time.

    One of the most frequent tasks that becomes one of the most development time consuming is interfacing with databases to store and retrieve application data.

    I did some research to find what kind of tools exist to automate tasks like database interfacing making it flexible enough to adjust to the application needs and generate efficient code. I realized that there are plenty of components for handling what I need that are usually named persistence layers.

    One of the problems that those components has is that most of them are not for PHP. Another problem is that many of them tend to be too generic and a try to do most of the things at run time.

    So, I decided to develop a persistence layer generator application. It would generate PHP (although mine can also generate Java and Perl) and it would not generate code that applications may not need to avoid generating bloatware made of code that most of the time is not needed. I also would like to never need to deal SQL in any place.

    Last month I finally released Metastorage after over 3 months of development. It is a persistence layer generator application that takes a XML based description of components made of classes . You just describe the classes variables, relationships between classes, validation rules and the declaration functions that you want to use to store and retrieve the classes objects from persistence storage that is currently a SQL based database.

    From then on, Metastorage generate everything for you, including all the code for all the classes and even schemas definitions and classes for installing the database tables that are needed. The generated code is database independent.

    As a bonus, it also generates entity relationship like class diagrams in UML that you can render in many image formats. This is usually very good to document projects in such a professional way that impresses customers and bosses.

    The good part is that it reduces to minutes or hours, the work that usually would take weeks or months to develop with hand written code.

    Metastorage is Open Source is available here:

    http://www.meta-language.net/news-2002-12-09-metastorage.html

    http://www.meta-language.net/metastorage.html

    -- 
    

    Regards, Manuel Lemos

    attached mail follows:


    its works!!

    thanks alot guys, i have tried with this codes:

    array1.php ----------

    <FORM METHOD=POST ACTION="array2.php">

    <?php for($i=1; $i<=3; $i++) { for($j=1; $j<=3; $j++) { ?> <SELECT NAME="<?php echo "try[$i][$j]" ?>"> <OPTION value="1">One <OPTION value="2">Two <OPTION value="3">Three <OPTION value="4">Four <OPTION value="5">Five </SELECT> <?php } } ?> <INPUT TYPE="submit" value="NEXT"> </FORM>

    array2.php ----------

    <?php for($i=1; $i<=3; $i++) { for($j=1; $j<=3; $j++) { echo $try[$i][$j]; echo "<BR>"; } } ?>

    and the output are come out in the array2.php since the output can printed out, means that this page (array2.php) can receive these variable and we can send the values of these variable to mysql.

    thanks

    -rizki-

    attached mail follows:


    On Saturday 11 January 2003 12:12 am, Scott Fletcher wrote: > The only thing that is important to me is that the password get > encrypted before transmitting across the internet.

    from other posts further in the thread it looks like you aren't ready to use https. that's too bad. that would really be the right solution.

    but since you must hash, one problem with hashing is, it is still necessary to have the hash vary from one invocation to another. otherwise, if the hash is the same every time the user logs in (i.e., if all you do is take the password and run it through md5), then anyone who can sniff the hash will be able to replay a login.

    unfortunately, if you want the hash to be different from one invocation to the next, then the password cannot be stored on the server as a one-way hash. instead, it would be either plaintext or encrypted on the server. this way, when you want to send the hash over the internet, instead of just hashing the password, you can generate a few extra characters. append (or prepend) the characters to the password. then hash the whole thing.

    then, when you send the hash over, send the extra characters too. on the server side, you would then take the password from the database (or wherever), decrypt it (if it's encrypted), append or prepend the extra characters, hash the whole thing, and compare the hashes.

    tiger

    -- 
    Gerald Timothy Quimpo  tiger*quimpo*org gquimpo*sni-inc.com tiger*sni*ph
    Public Key: "gpg --keyserver pgp.mit.edu --recv-keys 672F4C78"
                       Veritas liberabit vos.
                       Doveryai no proveryai.
    

    attached mail follows:


    Hi,

    I've got a problem to solve regarding binary data strings, which is an area I don't have a lot of experience in. If anyone can help, I would be grateful.

    Here's the problem in a nutshell:

    I am getting a binary string from a third-party server that I need to encode into a PNG image. The string arrives double-quoted, so double quotes which may occur in the binary string have been escaped. I need to parse through the string and extract only the PNG data, and convert whatever has been escaped into usable data.

    I cannot control the output from the third-party -- I've got to deal with what they're sending. (I would much rather have them send a base64 encoded PNG, but unfortunately I'm not able to influence their methods.)

    Here's the problem as described by the API I'm working with:

    ____________________________________________________________________________ The rule for encoding the PNG image in the returned buffer was designed to eliminate certain illegal characters (byte values) by replacing them with an escape sequence. Those values that are not allowed include:

    * NULL (0x00 hex) * Double Quote (0x22 hex)

    The percent character '%' (0x25 hex) is used as the escape character, and therefore it must be replaced where it occurs naturally. Whenever a disallowed character or the escape character '%' is encountered, it is replaced by the escape character '%' (0x25 hex) followed by two characters comprising the hexadecimal numeral representing the value of the character. For example, the NULL character (0x00 hex) is replaced by three characters:

    * '%' (0x25) * '0' (0x30) * '0' (0x30)

    The percent character 0x25 is replaced by three characters:

    * '%' (0x25) * '2' (0x32) * '5' (0x35)

    The algorithm for decoding the PNG image in the returned buffer is as follows. Read bytes from the buffer one at a time. When a byte read is not equal to the '%' character (0x25 hex), pass it through unchanged. When a byte is read that is equal to the '%' character (0x25 hex), read an additional two bytes, which will each take a value from zero (0x30 hex) through nine (0x39 hex) or 'A' (0x41 hex) through 'F' (0x46 hex). These two bytes are interpreted as a character representation of a two-digit hexadecimal numeral ranging from 0x00 through 0xFF. The single byte having the integral value represented by that numeral is appended to your output.

    For example, when the 3-byte string '%22' is encountered, '"' (0x22) - the double quote character - is passed out. When the 3 bytes '%00' are read, the null character is written.

    In essence, the developer will need to take the data received and store it in a buffer, which has sufficient memory to hold the entire data stream. Once the data has been received, the program must call a function similar to the one described below in order to parse the data in the buffer and extract only the PNG image data. ____________________________________________________________________________

    The API then presents an example in C, which I've tried to translate into PHP as best as I can. It's pretty close, I think -- but I'm still not getting a PNG out when I'm done.

    Here's what I've written, based on the C example: ____________________________________________________________________________ $buf = [binary data received]; $len = strlen($buf); $out = '';

    for ($c = 1; $c < $len; $c++) { $data = $buf{$c};

    if ($data != '%') $out .= $data;

    if ($data == '%') { for ($e = 0; $e < 2; $e++) { $c++; $data = $buf{$c};

    if ((($data >= 0x30) && ($data <= 0x39)) || (($data >= 0x41) && ($data <= 0x46))) { if ($e == 1) { $d = $data; $d = $d & 0x0f; if (($data >= 0x41) && ($data <= 0x46)) { $d += 9; } $store = $store | $d; } else { $d = $data; $d = $d & 0x0f; if (($data >= 0x41) && ($data <= 0x46)) { $d += 9; } $store = $d << 4; } } }

    $out .= $store; } }

    Header("Content-type: image/png"); echo $out; ____________________________________________________________________________

    I'm just getting a blank screen at the end here -- not a PNG image.

    Can anyone with more experience dealing with binary data offer any suggestions? I'm at a loss and would appreciate the help! I would be happy to send the example C code from the API if that would be helpful.

    Thank you!

    -Clay

    attached mail follows:


    Well, I'm always trying to make it harder than it needs to be. A few more hours of research yielded this solution:

    $out = preg_replace("/\%([0-9][0-9])/e", "chr(hexdec(\"0x$1\"))", $buf); Header("Content-type: image/png"); echo $out;

    ... Worked like a charm.

    If anyone can see any problems with this solution, I would be interested to hear them!

    Thanks, Clay

    > From: Clay Loveless <listscrawlspace.com> > Date: Fri, 10 Jan 2003 22:09:03 -0800 > To: PHP-General <php-generallists.php.net> > Subject: [PHP] Binary data confusion > > Hi, > > I've got a problem to solve regarding binary data strings, which is an area > I don't have a lot of experience in. If anyone can help, I would be > grateful. > > Here's the problem in a nutshell: > > I am getting a binary string from a third-party server that I need to encode > into a PNG image. The string arrives double-quoted, so double quotes which > may occur in the binary string have been escaped. I need to parse through > the string and extract only the PNG data, and convert whatever has been > escaped into usable data. > > I cannot control the output from the third-party -- I've got to deal with > what they're sending. (I would much rather have them send a base64 encoded > PNG, but unfortunately I'm not able to influence their methods.) > > > Here's the problem as described by the API I'm working with: > > ____________________________________________________________________________ > The rule for encoding the PNG image in the returned buffer was designed to > eliminate certain illegal characters (byte values) by replacing them with an > escape sequence. Those values that are not allowed include: > > * NULL (0x00 hex) > * Double Quote (0x22 hex) > > The percent character '%' (0x25 hex) is used as the escape character, and > therefore it must be replaced where it occurs naturally. Whenever a > disallowed character or the escape character '%' is encountered, it is > replaced by the escape character '%' (0x25 hex) followed by two characters > comprising the hexadecimal numeral representing the value of the character. > For example, the NULL character (0x00 hex) is replaced by three characters: > > * '%' (0x25) > * '0' (0x30) > * '0' (0x30) > > The percent character 0x25 is replaced by three characters: > > * '%' (0x25) > * '2' (0x32) > * '5' (0x35) > > The algorithm for decoding the PNG image in the returned buffer is as > follows. Read bytes from the buffer one at a time. When a byte read is not > equal to the '%' character (0x25 hex), pass it through unchanged. When a > byte is read that is equal to the '%' character (0x25 hex), read an > additional two bytes, which will each take a value from zero (0x30 hex) > through nine (0x39 hex) or 'A' (0x41 hex) through 'F' (0x46 hex). These two > bytes are interpreted as a character representation of a two-digit > hexadecimal numeral ranging from 0x00 through 0xFF. The single byte having > the integral value represented by that numeral is appended to your output. > > For example, when the 3-byte string '%22' is encountered, '"' (0x22) - the > double quote character - is passed out. When the 3 bytes '%00' are read, the > null character is written. > > In essence, the developer will need to take the data received and store it > in a buffer, which has sufficient memory to hold the entire data stream. > Once the data has been received, the program must call a function similar to > the one described below in order to parse the data in the buffer and extract > only the PNG image data. > ____________________________________________________________________________ > > The API then presents an example in C, which I've tried to translate into > PHP as best as I can. It's pretty close, I think -- but I'm still not > getting a PNG out when I'm done. > > Here's what I've written, based on the C example: > ____________________________________________________________________________ > $buf = [binary data received]; > $len = strlen($buf); > $out = ''; > > for ($c = 1; $c < $len; $c++) { > $data = $buf{$c}; > > if ($data != '%') > $out .= $data; > > if ($data == '%') { > for ($e = 0; $e < 2; $e++) { > $c++; > $data = $buf{$c}; > > if ((($data >= 0x30) && ($data <= 0x39)) > || (($data >= 0x41) && ($data <= 0x46))) { > if ($e == 1) { > $d = $data; > $d = $d & 0x0f; > if (($data >= 0x41) && ($data <= 0x46)) { > $d += 9; > } > $store = $store | $d; > } else { > $d = $data; > $d = $d & 0x0f; > if (($data >= 0x41) && ($data <= 0x46)) { > $d += 9; > } > $store = $d << 4; > } > } > > } > > $out .= $store; > } > } > > Header("Content-type: image/png"); > echo $out; > ____________________________________________________________________________ > > > I'm just getting a blank screen at the end here -- not a PNG image. > > Can anyone with more experience dealing with binary data offer any > suggestions? I'm at a loss and would appreciate the help! I would be happy > to send the example C code from the API if that would be helpful. > > Thank you! > > -Clay > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Hi all,

    So I have a session variable; but with register_globals active on the server I'm hosted at (no way to turn it off), just checkng for "$varX" in my script could retrieve the session variable, a GET variable with the same name, or a POST variable with the same name - and as a security concern, someone could use a GET request (http://somehost/mypage.php?varX=0) to spoof the script into thinking that "varX" is the wrong value.

    So, is there any way in a script to specify that I want to retrieve the value stored in the registered session_variable("varX")??

    Thanks,

    --Noel

    attached mail follows:


    Nevermind, just found the $HTTP_SESSION_VARS array...

    Thanks anyways! Take care,

    --Noel

    "Noel Wade" <noelwadeattbi.com> wrote in message news:20030111103335.60382.qmailpb1.pair.com... > Hi all, > > So I have a session variable; but with register_globals active on the server > I'm hosted at (no way to turn it off), just checkng for "$varX" in my script > could retrieve the session variable, a GET variable with the same name, or a > POST variable with the same name - and as a security concern, someone could > use a GET request (http://somehost/mypage.php?varX=0) to spoof the script > into thinking that "varX" is the wrong value. > > So, is there any way in a script to specify that I want to retrieve the > value stored in the registered session_variable("varX")?? > > Thanks, > > --Noel > > >

    attached mail follows:


    FYI: Don't like auto register globals ... try the following at the beginning of your script.

    ini_set ('register_globals','Off');

    Works for me places I'm hosted at.

    HTH, Jason k Larson

    Noel Wade wrote: > Hi all, > > So I have a session variable; but with register_globals active on the server > I'm hosted at (no way to turn it off), just checkng for "$varX" in my script > could retrieve the session variable, a GET variable with the same name, or a > POST variable with the same name - and as a security concern, someone could > use a GET request (http://somehost/mypage.php?varX=0) to spoof the script > into thinking that "varX" is the wrong value. > > So, is there any way in a script to specify that I want to retrieve the > value stored in the registered session_variable("varX")?? > > Thanks, > > --Noel > > > >

    attached mail follows:


    -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

    Hello List,

    a simple problem turned out to be not so simple as I thought.

    Here the situation: main.php4 | +-include() mainhtml.php4 | +-include() functions.php4 | +a function does include() languagevars.php4

    I can see the included $vars from languagevars.php4 in functions.php4 but not in main.php4.

    Using "global $var" just seems to work top->down but I'm not able to bring the $vars up to the main.php4 or to the mainhtml.php4.

    This time, I just wanted to write not one scary large PHP4-Page with around ~100kb in size. But I'm really stuck - all the books, pdfs and web information just want to bring the $vars down.

    Or is there just a failure in thinking?!

    Any hint is highly appreciated. Ben :) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux)

    iD8DBQE+IATAROwluvOuI4ARApiOAJ9EyDo2ER3YROGZ120CgllOkjM8tgCfUIeD pxtKmzi71xC3n8Tpb0FSQ7w= =BZcc -----END PGP SIGNATURE-----

    attached mail follows:


    what does debug_phpinfo.php read to get its information?

    When I run debug_phpinfo.php in my browser it says version 4.2.3

    But when I execute php -v at the command line I get 4.0.4pl1