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 13 Dec 2005 09:05:31 -0000 Issue 3847

php-general-digest-helplists.php.net
Date: Tue Dec 13 2005 - 03:05:31 CST


php-general Digest 13 Dec 2005 09:05:31 -0000 Issue 3847

Topics (messages 227344 through 227366):

Re: IE6 not returning POST data from a textarea
        227344 by: Jared Williams
        227345 by: Zareef Ahmed
        227346 by: Al
        227347 by: Jay Blanchard
        227348 by: Jay Blanchard
        227352 by: M
        227353 by: Jay Blanchard
        227356 by: Al
        227357 by: Michael Hulse

Re: OO XML Parser
        227349 by: Robert Cummings

detecting file size
        227350 by: Ahmed Abdel-Aliem
        227351 by: Jay Blanchard
        227359 by: Jeffrey Sambells

Help with preg_match and windows domain logins...
        227354 by: Daevid Vincent
        227355 by: Robin Vickery

Re: need for $_POST[''] changed after server upgrade
        227358 by: Ray
        227361 by: Michael Hulse
        227362 by: matt.criticalcode.com
        227363 by: Michael Hulse
        227364 by: Robert Cummings

Container Loading Script
        227360 by: Leonard Burton

AMF PHP
        227365 by: Yaswanth Narvaneni

Sending $_GET directly to AJAX
        227366 by: Erfan Shirazi

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:


> Anyone know to get IE6 to return POST data from a textarea
> when the text is pasted in?
>
> Works fine for Mozilla, etc.
>
> print_r($_POST) shows several <input...> and <text ...>
> values just fine.
>

If it doesn't have a name attribute, or is disabled IE won't include it in the post.

Jared

attached mail follows:


----- Original Message -----
From: "Al" <newsridersite.org>
To: <php-generallists.php.net>
Sent: Monday, December 12, 2005 12:16 PM
Subject: [PHP] IE6 not returning POST data from a textarea

> Anyone know to get IE6 to return POST data from a textarea when the text
is pasted in?
>
Can you explain what exactly you are doing? print_r($_POST) should show the
all values of the form including a textarea.

What do you mean by "pasted in"?

Zareef Ahmed

> Works fine for Mozilla, etc.
>
> print_r($_POST) shows several <input...> and <text ...> values just fine.
>
> Thanks....
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

====================================================
PHP Expert Consultancy in Development http://www.indiaphp.com
Yahoo! : consultant_php MSN : consultancyindiaphp.com

attached mail follows:


tomasz abramowicz wrote:
> Al wrote:
>
>> Anyone know to get IE6 to return POST data from a textarea when the
>> text is pasted in?
>>
>> Works fine for Mozilla, etc.
>>
>> print_r($_POST) shows several <input...> and <text ...> values just
>> fine.
>>
>> Thanks....
>>
> post your code.
> ie6 not returning post values from textarea fields works fine for me.
> ie6 not returning post value is not php.
>
> try sending to a file which has <?php phpinfo(); ?> as its first line.
> check in the last table if you find your missing var.
>
> bye.
> t.

I'm onto the bug.

If the text contains "…" char [hex 85]; IE6 doesn't send the POST data. There may be other bad characters; i haven't
tested yet.

attached mail follows:


[snip]
I'm onto the bug.

If the text contains "…" char [hex 85]; IE6 doesn't send the POST data.
There may be other bad characters; i haven't
tested yet.
[/snip]

Is the text area named?

attached mail follows:


[snip]
Everyone keeps asking it. Of course it's named or Mozzilla wouldn't work.
[/snip]

You can insert a textarea into a page without a name and mozilla will work.
If the textarea is named have you tried this....

echo $_POST['textareaName'];

attached mail follows:


Jay Blanchard wrote:
> [snip]
> Everyone keeps asking it. Of course it's named or Mozzilla wouldn't work.
> [/snip]
>
>
> You can insert a textarea into a page without a name and mozilla will work.

Are you sure? I just tried it using FF and textarea is not posted. Even
if I set id attribute.

attached mail follows:


[snip]
Jay Blanchard wrote:
> [snip]
> Everyone keeps asking it. Of course it's named or Mozzilla wouldn't work.
> [/snip]
>
>
> You can insert a textarea into a page without a name and mozilla will
work.

Are you sure? I just tried it using FF and textarea is not posted. Even
if I set id attribute.
[/snip]

Without a name the text area will not get posted, but it will display. I
asked the OP if the textarea was named.

attached mail follows:


Al wrote:
> Anyone know to get IE6 to return POST data from a textarea when the text
> is pasted in?
>
> Works fine for Mozilla, etc.
>
> print_r($_POST) shows several <input...> and <text ...> values just fine.
>
> Thanks....

For those interested, here is the answer...

Text pasted into a textarea [e.g., from Word] can have characters not defined in IE's textarea ISO-8859-1 charset.

Appearently, IE6 has a bug such that it does not send the POST value for the textarea name when some of these are
present. [e.g., "…" char [hex 85]] I don't know how many.

You can get it to work by right-mouse selecting Encoding UTF-8 on the client browser or use in the html header:
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >

attached mail follows:


> For those interested, here is the answer...
>
> Text pasted into a textarea [e.g., from Word] can have characters not
> defined in IE's textarea ISO-8859-1 charset.
>
> Appearently, IE6 has a bug such that it does not send the POST value
> for the textarea name when some of these are present. [e.g., "…" char
> [hex 85]] I don't know how many.
>
> You can get it to work by right-mouse selecting Encoding UTF-8 on the
> client browser or use in the html header:
> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >

Sometimes I use BBEDIT and turn-on "Show Invisibles"... that usually
catches any odd character. Then I save the file with unix line
endings... Seems to work really well.

I am glad you got it figured out.

Cheers,
Micky
--
¸.·´¯`·.¸¸><(((º>`·.¸¸.·´¯`·.¸¸><((((º>
·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸><((((º>
`·.¸¸><((((º>¸.·´¯`·.¸¸><((((º>

attached mail follows:


On Mon, 2005-12-12 at 05:40, Jochem Maas wrote:
> in this case there is an alterntive:
>
> http://php.net/manual/en/function.xml-set-object.php
>
> Norbert Wenzel wrote:
> > Robert Cummings wrote:
> >
> >> On Sat, 2005-12-10 at 11:25, mail wrote:
> >>
> >>> xml_set_element_handler($parser, "xml_start_element",
> >>> "xml_stop_element"); //can't find function

Cool, I learn something new all the time :) I think I first used the XML
functions back in PHP3 before they had this particular option.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


hi
i am making a form to upload files to server
i know i can detect the file size after being uploaded, but i do want
to detect the file after it is being uploaded to the server.
is there anyway i can do this ?

any help would be appreciated,
thanks in advance.

--
Ahmed Abdel-Aliem
Web Developer
www.SafariStudio.net
+20101108551
registered Linux user number 382789

attached mail follows:


[snip]
i am making a form to upload files to server
i know i can detect the file size after being uploaded, but i do want
to detect the file after it is being uploaded to the server.
is there anyway i can do this ?
[/snip]

You can detect file size on the client side with JavaScript, this may help;
http://www.codeproject.com/jscript/search_in_files.asp

attached mail follows:


The php script starts to execute AFTER the file has already been
uploaded so the quick answer is no you can't get the file size prior to
the upload finishing (in PHP). I fought with a similar problem and
ended up implementing the uploading portion of a script using perl
which has access to the file as it is uploading.

Jeff

On 12-Dec-05, at 4:26 PM, Jay Blanchard wrote:

> [snip]
> i am making a form to upload files to server
> i know i can detect the file size after being uploaded, but i do want
> to detect the file after it is being uploaded to the server.
> is there anyway i can do this ?
> [/snip]
>
> You can detect file size on the client side with JavaScript, this may
> help;
> http://www.codeproject.com/jscript/search_in_files.asp
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


I'm trying to do what should be a very simple regex, but can't seem to get
PHP to work, yet regex-coach and even an XML .XSD work fine:

Valid forms of a windows logon are:
"foo\bar"
"\\foo\bar"

function isValidWinLogon($logon)
{
//$logon = '\\\\foo\\bar';
$logon = '\\foo\bar';
print "<P><PRE>logon = '$logon'<BR></PRE>\n";
        preg_match('/(\\\\)?.+\\.+/', $logon, $matches);
        //preg_match('/(\\\\)?.+(\\).+/', $logon, $matches);
print_r($matches);
        
        return (count($matches) > 0);
}

I'm obviously passing in the strings, but for testing, I tried to hard-code
it.

First, when I use single ticks, I thought that meant to be taken literally.
Seems I still have to escape (\) the backslashes.

In either case, the $matches array is EMPTY.

Further more, WTF do I get this error:
"Compilation failed: missing ) at offset 12" (pointing to the commented out
preg_match.
WTF should adding a set of parenthesis cause a compilation error?!

# php -v
PHP 5.0.3 (built: Dec 1 2005 02:20:49)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.3, Copyright (c) 1998-2004 Zend Technologies
    with Zend Extension Manager v1.0.9, Copyright (c) 2003-2005, by Zend
Technologies
    with Zend Optimizer v2.6.0, Copyright (c) 1998-2005, by Zend
Technologies

attached mail follows:


On 12/13/05, Daevid Vincent <daeviddaevid.com> wrote:
> I'm trying to do what should be a very simple regex, but can't seem to get
> PHP to work, yet regex-coach and even an XML .XSD work fine:
>
> Valid forms of a windows logon are:
> "foo\bar"
> "\\foo\bar"
> [...]
> //preg_match('/(\\\\)?.+(\\).+/', $logon, $matches);
> [...]
> Further more, WTF do I get this error:
> "Compilation failed: missing ) at offset 12" (pointing to the commented out
> preg_match.
> WTF should adding a set of parenthesis cause a compilation error?!

WTF do you need so many WTFs?

Adding a set of parenthesis isn't causing the error. Adding an
open-bracket and then an escaped close-bracket is causing your error.
The "missing ) at offset 12" is a bit of a clue there.

Backslashes are special characters to both single-quoted strings AND
regular expressions so if you use them, you're normally going to have
to escape them twice.

So if you want optional double backslashes, followed by any characters
followed by a backslash followed by any characters - which is what I'm
guessing you were aiming at, you'd start off with this:

/^(\\)?.+\.+$/

you need to escape the backslashes for the regular expression engine
so you get this:

/^(\\\\)?.+\\.+$/

and you're supplying it in a single-quoted string, which also needs
the backslashes escaped, so you get this:

'/^(\\\\\\\\)?.+\\\\.+$/'

by which point you should be swearing at Microsoft for choosing such a
stupid character for a login string delimiter.

Clear?

 -robin

attached mail follows:


Hello,
Thanks Matt, I appreciate your help. your solution is a lot easier than mine.
It's also nice to understand what was happening. I was introduced to PHP
after that type of globals were considered 'evil' so I hadn't seen code
written that way.
Ray

-----Original Message-----
From: "Matt Babineau" <mattcriticalcode.com>
To: "'Ray'" <raymedia32.ca>, <php-generallists.php.net>
Date: Sun, 11 Dec 2005 22:42:46 -0800
Subject: RE: [PHP] need for $_POST[''] changed after server upgrade

> Register globals is no longer ON I believe. That is why it happened.
>
> To fix this:
>
> Foreach($_POST as $key => $value) ${$key} = $value;
>
> That will convert all of your post variables to local variables.
>
> :)
>
>
> Thanks,
>
> Matt Babineau
> Criticalcode
> 858.733.0160
> mattcriticalcode.com
> http://www.criticalcode.com
>
> TAKE ORDERS from the WEB and add them right into QUICKBOOKS! Ask me
> how...
>
>
> > -----Original Message-----
> > From: Ray [mailto:raymedia32.ca]
> > Sent: Sunday, December 11, 2005 10:29 PM
> > To: php-generallists.php.net
> > Subject: [PHP] need for $_POST[''] changed after server upgrade
> >
> > Hello All,
> > We just upgraded our server at work, and one client's web
> > site stoped working. I didn't write the code, I just get to
> > clean up someone else's mess. :) After a little
> > troubleshooting, I found that forms refered back to the same
> > script. so far, so good. very normal. The strange part was
> > the variable names were just "$foo" not, "$_POST['foo']".
> > After the upgrade, the variable "$foo" was not recognized
> > when the form was processed, so of course, everything failed.
> > My solution was to put if (isset($_POST["foo"]))
> > {$foo=$_POST["foo"]}; at the top of the script. This seems to
> > make everything work.
> > My two questions are: first, is there a better way to fix
> > this, and second, how did this work in the first place?
> > TIA
> > Ray
> >
> > --
> > PHP General Mailing List (http://www.php.net/) To
> > unsubscribe, visit: http://www.php.net/unsub.php
> >
>

attached mail follows:


On Dec 12, 2005, at 8:21 PM, Ray wrote:
> Hello,
> Thanks Matt, I appreciate your help. your solution is a lot easier
> than mine.
> It's also nice to understand what was happening. I was introduced to
> PHP
> after that type of globals were considered 'evil' so I hadn't seen code
> written that way.
> Ray
> -----Original Message-----
>> Register globals is no longer ON I believe. That is why it happened.
>>
>> To fix this:
>>
>> Foreach($_POST as $key => $value) ${$key} = $value;
>>
>> That will convert all of your post variables to local variables.

Could not you also do:

<?php
        if (count($_REQUEST) > 0) {
                while(list ($key, $val) = each ($_REQUEST)) {
                        $$key = $val;
                }
        }
?>

attached mail follows:


> On Dec 12, 2005, at 8:21 PM, Ray wrote:
>> Hello,
>> Thanks Matt, I appreciate your help. your solution is a lot easier
>> than mine.
>> It's also nice to understand what was happening. I was introduced to
>> PHP
>> after that type of globals were considered 'evil' so I hadn't seen code
>> written that way.
>> Ray
>> -----Original Message-----
>>> Register globals is no longer ON I believe. That is why it happened.
>>>
>>> To fix this:
>>>
>>> Foreach($_POST as $key => $value) ${$key} = $value;
>>>
>>> That will convert all of your post variables to local variables.
>
> Could not you also do:
>
> <?php
> if (count($_REQUEST) > 0) {
> while(list ($key, $val) = each ($_REQUEST)) {
> $$key = $val;
> }
> }
> ?>
>
The only problem I see with this is now you are asking php to issue a
count on the $_REQUEST array, this could take some time depending on your
form size.

attached mail follows:


On Dec 12, 2005, at 9:26 PM, mattcriticalcode.com wrote:
> The only problem I see with this is now you are asking php to issue a
> count on the $_REQUEST array, this could take some time depending on
> your
> form size.

Ah, very good point... did not think of that. :)

attached mail follows:


On Tue, 2005-12-13 at 00:31, Michael Hulse wrote:
> On Dec 12, 2005, at 9:26 PM, mattcriticalcode.com wrote:
> > The only problem I see with this is now you are asking php to issue a
> > count on the $_REQUEST array, this could take some time depending on
> > your
> > form size.
>
> Ah, very good point... did not think of that. :)

That shouldn't be an issue. I'm quite sure PHP doesn't traverse the
array to count the elements, but rather already knows the size by virtue
of housekeeping when elements are added or removed. Either way it would
be the copy process that would be heaviest but since PHP uses a
copy-on-write system of variable copying, the expense is mitigated until
such time as the value copied changes in one of the lightweight copies
at which time a real copy occurs.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


HI all,

I am working on a project where it would be nice to be able to create
a load plan for a semi trailer or ocean container. There are some
commercially available programs to do this in windows but nothing in
PHP.

Does anyone know of a PHP script that will do this?

Basically it needs to know the size of the trailer and the size of the
items being loaded and then it will go through and create a load based
upon the density of each piece and distribute the weight evenly across
the trailer and fill the trailer up.

Thanks,

--
Leonard Burton, N9URK
leonardburtongmail.com

"You must understand, if you are on a plane you must behave yourself."

"The prolonged evacuation would have dramatically affected the
survivability of the occupants."

attached mail follows:


Hi!

Did any of you guys work with AMF PHP? I have been using AMF PHP for
flash remoting and I am unable to propagate cookieless sessions from
my web application to flash. Any suggestions? I am using Tufat.com's
AMF Flash Chat as the flash app.

Regards,
Yaswanth
--
"In theory there is no difference between theory and practice.
In practice there is." -- Fortune Cookie

attached mail follows:


Hi all

I'm writing a function which will redirect the user to the last page
they were at when a session timeout occurred. The function will save all
variables and set them through POST or whatever was used on that page.

I.e: $_POST[$variableName] = $variableContent;

This works fine with regular php/html pages which uses either POST, GET
or SESSION for sending variable from one page to another.

But I have some pages which uses AJAX and it communicates internally
through GET, I'm able to save the variables which are send through GET
in AJAX, in debug mode AJAX refers to it by:
(RSD: destinationUpdate uri) which basically seems to be a normal link
without the pagename and only variables which are sent.

But when I try to set the variables again for AJAX to use after a
timeout, nothing happens and it only displays what is called (RSD:
received) AJAX debug mode. Which seems to be the answer to AJAX "question".

It seems that it all works good when I set the correct GET variables
until it sends back its answer, then it gets stuck. And this is my
problem, I would like to send variables through GET to AJAX and make it
work as it has send the variables it self.

Is there any experience AJAX users/developers which could help me with
me problem?

Thx in advance.
/Erfan