php-general Digest 28 Jan 2012 10:31:30 -0000 Issue 7666

Topics (messages 316414 through 316420):

Re: differences in between these env. variables
        316414 by: Matijn Woudt
        316415 by: admin.buskirkgraphics.com
        316416 by: Adam Richardson

Re: Getting Column Names from an AS400 Database
        316417 by: Cheryl Sullivan

Re: ArrayInterator always true
        316418 by: TCP

Re: File upload in map drive with PHP
        316419 by: Michelle Konzack
        316420 by: Stuart Dallas

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 ---
On Fri, Jan 27, 2012 at 6:09 PM, Tedd Sperling <tedd.sperl...@gmail.com> wrote:
> On Jan 11, 2012, at 9:24 PM, tamouse mailing lists wrote:
>
>> Is there ever a case where SCRIPT_NAME does not equal PHP_SELF?
>
> Was this every answered? I would like to know.
>
> Cheers,
>
> tedd

I don't think it was answered, but I'll answer now. Yes, there is a difference.

At [1] you'll find a script that prints both SCRIPT_NAME and PHP_SELF.
For most of the time, the output will be the same. But now, try the
url at [2], and you'll see that it returns /dev/test/envvars.php for
SCRIPT_NAME, and /dev/test/envvars.php/a/b/c for PHP_SELF.

I hope this clears things up a bit.

- Matijn


[1] http://tijnema.myftp.org/dev/test/envvars.php
[2] http://tijnema.myftp.org/dev/test/envvars.php/a/b/c

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Tedd Sperling [mailto:tedd.sperl...@gmail.com]
> Sent: Friday, January 27, 2012 12:09 PM
> To: php-general. List
> Subject: Re: [PHP] differences in between these env. variables
> 
> On Jan 11, 2012, at 9:24 PM, tamouse mailing lists wrote:
> 
> > Is there ever a case where SCRIPT_NAME does not equal PHP_SELF?
> 
> Was this every answered? I would like to know.
> 
> Cheers,
> 
> tedd
> 
> 
> _____________________
> t...@sperling.com
> http://sperling.com
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


Ted I show on the 11 Jan there was 2 answers.

I'll extend your example. We now have a RewriteRule in apache like this:

RewriteRule ^files/?$ /directory/file.php [L,QSA]

Which will rewrite /files/... --> /directory/file.php

REQUEST_URI now contains how it was called by the browser,
'/files/something.php'
SCRIPT_NAME returns path to script (/directory/file.php), set by the SAPI
(apache, ..).
PHP_SELF returns also the path to script (/directory/file.php), but set by
PHP self.
I don't have any ORIG_PATH_INFO on my Ubuntu box, so be careful about this
one.

Recommended: Depends on which you need. I prefer PHP_SELF over SCRIPT_NAME,
but that's more personal choice.
Matijn




--- End Message ---
--- Begin Message ---
On Fri, Jan 27, 2012 at 12:09 PM, Tedd Sperling <tedd.sperl...@gmail.com>wrote:

> On Jan 11, 2012, at 9:24 PM, tamouse mailing lists wrote:
>
> > Is there ever a case where SCRIPT_NAME does not equal PHP_SELF?
>
> Was this every answered? I would like to know.
>
> Cheers,
>
> tedd
>

Yep, can be different:
http://stackoverflow.com/questions/279966/php-self-vs-path-info-vs-script-name-vs-request-uri

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com

--- End Message ---
--- Begin Message ---
Indeed!!  Thank you - got it going.  I am by no means a
database-connection expert (clearly)

-----Original Message-----
From: Maciek Sokolewicz [mailto:tula...@php.net] 
Sent: Thursday, January 26, 2012 11:48 AM
To: php-gene...@lists.php.net; Cheryl Sullivan
Cc: Jim Giner; php-gene...@lists.php.net
Subject: Re: [PHP] Re: Getting Column Names from an AS400 Database

On 26-01-2012 16:40, Cheryl Sullivan wrote:
>
> Thanks for your response... I changed the $outval line to
>
> $outval = odbc_columns($rs, "DB#LIBNAME", "%", "TABLENAME", "%");
>
> ...but still got the same error -
>
> Warning: odbc_columns() expects parameter 1 to be resource, object
given
> in D:\WAMP\www\directory\filename.php on line 13
>
>
> -----Original Message-----
> From: Jim Giner [mailto:jim.gi...@albanyhandball.com]
> Sent: Thursday, January 26, 2012 10:31 AM
> To: php-gene...@lists.php.net
> Subject: [PHP] Re: Getting Column Names from an AS400 Database
>
> I'm thinking that it should read
>
> $rs = $conn->execute($q);
> $outval = odbc_columns($rs, "DB#LIBNAME", "%", "TABLENAME", "%");
>
> You need to provide the results of the query to the odbc_columns, not
> the
> connection object.
> Just my guess since I've never used this.
>
According to the manual, the connection resource should be used.
But anyway, that's not the problem.

The problem is that you're starting with a COM Object, and all of a 
sudden try to use the odbc functions on it. Of course that blows up in 
your face, since COM !== ODBC.

Instead, you should use the properties and methods from the COM OLE 
Object you've instantiated. I don't know what these are exactly, but I'm

sure you'll be able to find them in the MSDN reference somewhere.

Just remember that using the COM API will make things a lot harder for 
you, since you can't rely on the PHP Manual to help you with anything. 
If you're familair with the OLE object you're using, it shouldn't post 
any problems though.

- Tul


Notice: This communication, including attachments, may contain information that 
is confidential and protected. It constitutes non-public information intended 
to be conveyed only to the designated recipient(s). If you believe that you 
have received this communication in error, please notify the sender immediately 
by return e-mail and promptly delete this e-mail, including attachments without 
reading or saving them in any manner. The unauthorized use, dissemination, 
distribution, or reproduction of this e-mail, including attachments, is 
prohibited and may be unlawful. Thank you.


--- End Message ---
--- Begin Message ---
I've got a temporary fix but still the iterator always return true,
still hope someone could help me out to point out the problem:)

//parseOptions utilitiese by tgckpg
function parseOptions ( $argStream, $handler ) {
        //Chop first useless argument -- argv[0]
        array_shift ( $argStream ) ;
        //Initiate ArrayObject for iterator
        $arrayobject = new ArrayObject ( $argStream ) ;
        //Initiate iterator for iteration
        $iterator = $arrayobject->getIterator();

        //If options is set first
        if( $iterator->valid() && preg_match ( '/^-\w$/', $iterator->current() 
) ) {
                //iterate through whole argument stream
                for (   ; $iterator->valid(); $iterator->next() ) {
                        //Check if reached next option
                        if( preg_match ( '/^-\w$/', $opts = 
$iterator->current() ) ) {
                                //Get current options
                                $currOpt = $opts;
                                //echo "$currOpt\n";
                                //Test if next stream is an option
                                for ( $iterator->next(); $iterator->valid(); 
$iterator->next() ) {
                                        if ( preg_match ( '/^-\w$/', $opts = 
$iterator->current() ) ) {
                                                //echo "$currOpt $opts\n";
                                                $handler($currOpt);
                                                $currOpt = $opts;
                                        } else break;
                                        //var_dump($iterator->valid());
                                }
                        }//End if
                        //echo "$currOpt $opts\n";
                        $handler($currOpt, $opts);
                        //A temporary fix for infinite 
loop<------------------------------
                        if(!$iterator->valid())
                                break;
                }// End for
        //If option is not set first.
        } else {
                //Try other approach.
        }// End if
}

On Tue, Jan 24, 2012 at 4:18 AM, TCP <tgc...@gmail.com> wrote:
> I'm trying to parse an $agrv array that contain options (without
> square brackets): [-a "abc" -b "bbc" "bcc" -d "dbc" -e -f]
> I use ArrayIterator to iterate through the line:
>  - whenever it reach /-\w/, it read through the following qoutes
> until it reach another /-\w/.
>
>
>
> The problem is it seems the $iterator->valid() always return TRUE and
> cause infinte loop.
>
>
> function parseOptions ( $argStream, $handler ) {
>        //Chop first useless argument -- argv[0]
>        array_shift ( $argStream ) ;
>        //Initiate ArrayObject for iterator
>        $arrayobject = new ArrayObject ( $argStream ) ;
>        //Initiate iterator for iteration
>        $iterator = $arrayobject->getIterator();
>
>        //If options is set first
>        if( $iterator->valid() && preg_match ( '/^-\w$/', $iterator->current() 
> ) ) {
>                //iterate through whole argument stream
>                for (   ; $iterator->valid(); $iterator->next() ) {
>                        //Check if reached next option
>                        if( preg_match ( '/^-\w$/', $opts = 
> $iterator->current() ) ) {
>                                //Get current options
>                                $currOpt = $opts;
>                                //echo "$currOpt\n";
>                                //Test if next stream is an option
>                                for ($iterator->next(); $iterator->valid(); 
> $iterator->next() ) {
>                                        if ( preg_match ( '/^-\w$/', $opts = 
> $iterator->current() ) ) {
>                                                //echo "$currOpt $opts\n";
>                                                //$handler($currOpt, $opts);
>                                                $currOpt = $opts;
>                                        }
>                                        var_dump($iterator->valid());
>                                }
>                        }//End if
>                        //echo "$currOpt $opts\n";
>                        //$handler($currOpt, $opts);
>                }// End for
>
>        //If option is not set first.
>        } else {
>                //Try other approach.
>        }// End if
> }
>
>
> I've no idea what is going on.
> Please help.
>
>
> Regards,
> Panguin
>
> --
> 筆使文富,卻使人窮。



-- 
Regards,
Panguin

--- End Message ---
--- Begin Message ---
Merhaba Mehmet YAYLA,

Am 2012-01-26 15:10:34, hacktest Du folgendes herunter:
> I'm using code this bellow.

...with an error!

> <form enctype="multipart/form-data" action="upload_file.php?upload=1" 
> method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
>                 Select image: <input name="userfile" type="file"/>
>                 <input type="submit" value="Upload" />

You can not use
    action="upload_file.php?upload=1"

together with
    method="post"

and you have to use
    <form enctype="multipart/form-data" action="upload_file.php method="post"> 
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
                  <input type="hidden" name="upload" value="1" />

Thanks, Greetings and nice Day/Evening
    Michelle Konzack

-- 
##################### Debian GNU/Linux Consultant ######################
   Development of Intranet and Embedded Systems with Debian GNU/Linux
               Internet Service Provider, Cloud Computing
                <http://www.itsystems.tamay-dogan.net/>

itsystems@tdnet                     Jabber  linux4miche...@jabber.ccc.de
Owner Michelle Konzack

Gewerbe Strasse 3                   Tel office: +49-176-86004575
77694 Kehl                          Tel mobil:  +49-177-9351947
Germany                             Tel mobil:  +33-6-61925193  (France)

USt-ID:  DE 278 049 239

Linux-User #280138 with the Linux Counter, http://counter.li.org/

Attachment: signature.pgp
Description: Digital signature


--- End Message ---
--- Begin Message ---
On 28 Jan 2012, at 01:41, Michelle Konzack wrote:

> Merhaba Mehmet YAYLA,
> 
> Am 2012-01-26 15:10:34, hacktest Du folgendes herunter:
>> I'm using code this bellow.
> 
> ...with an error!
> 
>> <form enctype="multipart/form-data" action="upload_file.php?upload=1" 
>> method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
>>                Select image: <input name="userfile" type="file"/>
>>                <input type="submit" value="Upload" />
> 
> You can not use
>    action="upload_file.php?upload=1"
> 
> together with
>    method="post"
> 
> and you have to use
>    <form enctype="multipart/form-data" action="upload_file.php method="post"> 
> <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
>                  <input type="hidden" name="upload" value="1" />

There is nothing stopping you doing this. Mixing GET and POST parameters is 
perfectly valid and can be incredibly useful.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

--- End Message ---

Reply via email to