[PHP] how do i get a printout of original multipart post data

2007-11-26 Thread Olav Mørkrid
hello how can i get a raw and untouched printout of a multipart/form-data POST? i need this to analyze what certain user agents do wrong when uploading files. what happens is that php just fails to put files into $_FILES, and gives no way of seeing the original posting and exactly what is wrong

[PHP] partial upload & no file errors

2007-11-28 Thread Olav Mørkrid
hello under what EXACT circumstances does UPLOAD_ERR_PARTIAL and UPLOAD_ERR_NO_FILE occur? ...NO_FILE, does it happen ONLY if the user submits a form without choose a file to upload, or can this one also cover corrupt file data that php could not parse? ...PARTIAL, does it happen if the user pre

Re: [PHP] how do i get a printout of original multipart post data

2007-11-28 Thread Olav Mørkrid
what is the thought behind php not providing access to original post data? this removes any chance of analyzing corrupt upload data, which is often the case with mobile browsers. can future versions of php please include a way of viewing raw server requests in full? On 26/11/2007, [EMAIL PROTECTED

Re: [PHP] Re: how do i get a printout of original multipart post data

2007-12-01 Thread Olav Mørkrid
thanks, but that won't work. i need to see post data from other people out there, not my own data. still a mystery to me why php doesn't let developers see incoming raw data. On 01/12/2007, Dan <[EMAIL PROTECTED]> wrote: > ""Olav Mørkrid"" <[EMAIL

[PHP] utf-8 in $_POST

2008-01-07 Thread Olav Mørkrid
hello does php have any built-in functions to convert post data from whatever format it arrives in to whatever format i wish? example: i use iso-8859-1 internally, and even specify accept-charset=iso-8859-1 in my html, but some browsers (phones) send utf-8 anyway. do i have to manually check if

Re: [PHP] utf-8 in $_POST

2008-01-07 Thread Olav Mørkrid
i specify iso-8859-1 in both header and body: if two different people post the norwegian phrase "Godt nytt år" (happy new year), it may appear in the following variations: [CONTENT_TYPE] => application/x-www-form-urlencoded;charset=iso-8859-1 $_POST["input"] = "Godt nytt år" [CONTENT_TYPE] =>

Re: [PHP] utf-8 in $_POST

2008-01-16 Thread Olav Mørkrid
1/2008, Per Jessen <[EMAIL PROTECTED]> wrote: > Olav Mørkrid wrote: > > > i specify iso-8859-1 in both header and body: > > > > > accept-charset="iso-8859-1"> > > Have you checked 1) what the webserver sends in the header and 2) what > the br

[PHP] crc check for JPEG file exists

2008-02-26 Thread Olav Mørkrid
hello is crc32() an acceptable way of managing whether a JPEG file exists (in a database or similar collection)? i mean doing a crc32() on the binary data of the JPEG file, and then check the database if there is already another entry with the same CRC. the database has relatively few images (so

[PHP] getting timestamp for first day of current week

2007-07-03 Thread Olav Mørkrid
hello how do i get the TIMESTAMP for the FIRST DAY of the CURRENT WEEK (ie. monday 00:00:00)? i tried using strtotime("monday"), but: - when i use it on a monday, i get monday THIS WEEK - when i use it on tuesday thru sunday, i get monday NEXT WEEK i tried "last monday", "monday this week", "t

Re: [PHP] getting timestamp for first day of current week

2007-07-04 Thread Olav Mørkrid
On 03/07/07, Robert Cummings <[EMAIL PROTECTED]> wrote: If that's ALWAYS the case then it sounds like you have all the information you need to get the Monday you want :) what do you mean? php clearly makes a mistake in giving monday of the current week. -- PHP General Mailing List (http://ww

Re: [PHP] getting timestamp for first day of current week

2007-07-07 Thread Olav Mørkrid
uot;Y-m-d"); // if today if monday, just give today's date else $from = date("Y-m-d", strtotime("last monday")); // when asking on tuesday thru sunday it would be nice if strtotime understood the form "monday this week". On 04/07/07, Robert Cummings <[EMA

Re: [PHP] duration of mp3 file

2007-07-11 Thread Olav Mørkrid
http://arrozcru.no-ip.org/ffmpeg_builds/ On 11/07/07, Andrei <[EMAIL PROTECTED]> wrote: Or you could use ffmpeg executable to get details about the media file. You will have to parse the response of the executable. The only thing is that you must have exec function or an execution function avai

[PHP] getting the "next" element of an associative array

2007-07-11 Thread Olav Mørkrid
let's say we have the following associative array: $array = array( "red" => "ferrari", "yellow" => "volkswagen", "green" => "mercedes", "blue" => "volvo" ); then we have a current index into the array: $index = "yellow"; $current = $array[$index]; now: how do i get the key of the next arra

Re: [PHP] getting the "next" element of an associative array

2007-07-12 Thread Olav Mørkrid
like: array_set_internal_pointer($array, $index); On 12/07/07, Chris <[EMAIL PROTECTED]> wrote: Olav Mørkrid wrote: > let's say we have the following associative array: > > $array = array( > "red" => "ferrari", > "yellow" => "volk

Re: [PHP] getting the "next" element of an associative array

2007-07-12 Thread Olav Mørkrid
yep, a for loop is the fallback i use now. any reason why there isn't a built-in function for this? any plans for it in future versions of php? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] double output from trigger_error from command line

2007-07-17 Thread Olav Mørkrid
if i do a trigger_error() when running php scripts from the command line, each error is echoed twice. this is annoying. does anyone know how to make each error display only once? c:\>php -r "trigger_error(\"hello\");" PHP Notice: hello in Command line code on line 1 Notice: hello in Command li

[PHP] repetition of tedious references

2007-07-18 Thread Olav Mørkrid
consider the following statement: $language = isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]) && $_SERVER["HTTP_ACCEPT_LANGUAGE"] != "" ? $_SERVER["HTTP_ACCEPT_LANGUAGE"] : "*"; when using strings in arrays that may be non-existing or empty, you have to repeat the reference *three* times, which gets ex

Re: [PHP] repetition of tedious references

2007-07-18 Thread Olav Mørkrid
ECTED]> wrote: Hi OLav, what about this ? $language = isused($_SERVER["HTTP_ACCEPT_LANGUAGE"]); echo "language is " . $language; function isused($variable) { return isset($variable) && $variable != "" ? $variable : "*"; } HTH, Cor - Origin

Re: [PHP] repetition of tedious references

2007-07-18 Thread Olav Mørkrid
rob, yes i thought of this, you could possible even do function magic($array, $name, $default=null ) { return isset($array[$name]) && $array[$name] ? $array[$name] : $default; } $string = magic($_SERVER, "HTTP_ACCEPT_LANGUAGE", "*") however i wish php would have some built-in support to solve

Re: [PHP] repetition of tedious references

2007-07-18 Thread Olav Mørkrid
i didn't know about empty. thanks! do you have a link to this new php 6 ? : convention? it would be great if php 6 could have a solution for this. php is sweet when it's compact! On 18/07/07, Arpad Ray <[EMAIL PROTECTED]> wrote: You can use empty() to take one of them out, since "0" is presum

Re: [PHP] double output from trigger_error from command line

2007-07-18 Thread Olav Mørkrid
sorry. still get it twice. c:\>php -r "error_reporting(E_ALL ^ E_NOTICE); trigger_error(\"hello\", E_USER_ERROR);" PHP Fatal error: hello in Command line code on line 1 Fatal error: hello in Command line code on line 1 - if i do error_reporting(0) then i get NO lines at all. and if i do error_r

[PHP] isset($a->b) even if $a->b = null

2007-08-17 Thread Olav Mørkrid
how do i test if a property of a stdclass object is set, even if its value is null, similar to how array_key_exists() works for arrays. the following method fails: $a->b = null; if(isset($a->b)) echo "yes"; and property_exists() seems only to work for defined objects. hope someone can h

Re: [PHP] Re: isset($a->b) even if $a->b = null

2007-08-17 Thread Olav Mørkrid
the solution has been found. array_key_exists() can actually be used on objects, and yields the correct result. http://no.php.net/array_key_exists thanks to dordea cosmin for pointing this out. On 17/08/07, Olav Mørkrid <[EMAIL PROTECTED]> wrote: > the test i need should give the

Re: [PHP] Re: isset($a->b) even if $a->b = null

2007-08-17 Thread Olav Mørkrid
/us.php.net/manual/en/function.property-exists.php > > class a { > var $b; > } > > if (property_exists('a','b')) { > print "yes\n"; > } > > > On 8/17/07, Olav Mørkrid <[EMAIL PROTECTED]> wrote: > > the test i need should

Re: [PHP] Re: isset($a->b) even if $a->b = null

2007-08-17 Thread Olav Mørkrid
e else? On 17/08/07, Colin Guthrie <[EMAIL PROTECTED]> wrote: > Olav Mørkrid wrote: > > how do i test if a property of a stdclass object is set, even if its > > value is null, similar to how array_key_exists() works for arrays. > > > > the following method f

[PHP] what is my dns ip address

2007-09-01 Thread Olav Mørkrid
is there a function in php that will return the ip address of the dns server on the system? eg. $dns_ip = get_dns_ip_address(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] what is my dns ip address

2007-09-02 Thread Olav Mørkrid
the source of the problem is gethostbyaddr(). it seems to have a 4,5 second timeout, so some lookups time out after 4,5 seconds, while most of them are resolved in < 0.1 second; a radically performance difference. the user written gethostbyaddr_timeout() on the gethostbyaddr man page overcomes thi

Re: [PHP] what is my dns ip address

2007-09-03 Thread Olav Mørkrid
yeah but i assume this assumes you are on a unix machine and have administrator rights. it would be nice to be able to look up ip addresses swiftly and automatically on any machine and any operating system running php. On 03/09/07, Per Jessen <[EMAIL PROTECTED]> wrote: > Olav Mørk