php-general Digest 28 Oct 2005 06:41:49 -0000 Issue 3762
php-general Digest 28 Oct 2005 06:41:49 - Issue 3762 Topics (messages 224731 through 224754): Re: Using PHP for accsess control, preventing access to static files 224731 by: Dan Trainor 224732 by: Ben 224740 by: Dan Trainor 224741 by: Ben 224744 by: Dan Trainor 224749 by: Jeffrey Sambells How to account for misspellings and alternatives in searching? 224733 by: Chris W. Parker 224736 by: James Benson Trouble using DOM component with PHP 4.4.0 224734 by: Andrew Kachalo 224735 by: Andrew Kachalo 224739 by: Alessandro Rossini 224742 by: Andrew Kachalo 224743 by: James Benson Re: Strange array access problem 224737 by: Al Re: regex and global vars problem 224738 by: Al 224750 by: Tom Rogers foreach / unset 224745 by: Richard Lynch 224748 by: Niels Ganser Decompressing a string with zlib problems 224746 by: Graham Anderson PHP5 class constants 224747 by: Dragan Stanojevic - Nevidljivi 224751 by: Jasper Bryant-Greene 224752 by: Dragan Stanojevic - Nevidljivi 224753 by: Chris PHP version check 224754 by: Andrew Kachalo Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- Jason Motes wrote: I'm designing a controlled access system in PHP, and it's coming along quite well. It's very simple, and just sets a session varibale, such as $_SESSION['authenticated'] = 1, not a whole lot. Now I run a small sniplet of code on the top of each HTML and PHP file, which checks for this variable, and either allows or denys access to the page. However, how do people protect against the downloading of real files, ones which are not parsed by PHP? .WMV, .MOV, .ZIP, .EXE and so on? I want to protect access to these as well, and if a visitor just types in a URL and is able to access the file because my access control mechanism simply doesn't work on those types of files, what should be the solution here? It's been suggested to use readfile() to accomplish this, by forwarding content from outside of the document root - but this just sounds odd. On top of being (what I think would be) incredibly slow, it just doesn't sound right. I had a similar issue. I ended up using a .htaccess so that you could not open the file directly. If checked for the referrer. This is not the most secure way to do it. I know it can be spoofed. IndexIgnore * SetEnvIfNoCase Referer ^http://example.com/viewer.php; local_ref=1 Order Allow,Deny Allow from env=local_ref Jason Motes php at imotes.com Thanks for the reply, Jason - I'd like to keep the application as portable as possible; thus, I cannot use any kind of htaccess hackery because I want this PHP application to run on IIS, as well. Thanks -dant ---End Message--- ---BeginMessage--- Dan Trainor said the following on 10/27/2005 10:39 AM: Jason Motes wrote: However, how do people protect against the downloading of real files, ones which are not parsed by PHP? .WMV, .MOV, .ZIP, .EXE and so on? I want to protect access to these as well, and if a visitor just types in a URL and is able to access the file because my access control mechanism simply doesn't work on those types of files, what should be the solution here? snip I'd like to keep the application as portable as possible; thus, I cannot use any kind of htaccess hackery because I want this PHP application to run on IIS, as well. Move the files outside the document root so that they aren't available via a direct URL, then create a 'file access page' in php that will check for the session variable and either send or not send the file based on whether the user has access. - Ben ---End Message--- ---BeginMessage--- Ben wrote: Dan Trainor said the following on 10/27/2005 10:39 AM: Jason Motes wrote: However, how do people protect against the downloading of real files, ones which are not parsed by PHP? .WMV, .MOV, .ZIP, .EXE and so on? I want to protect access to these as well, and if a visitor just types in a URL and is able to access the file because my access control mechanism simply doesn't work on those types of files, what should be the solution here? snip I'd like to keep the application as portable as possible; thus, I cannot use any kind of htaccess hackery because I want this PHP application to run on IIS, as well. Move the files outside the document root so that they aren't available via a direct URL, then create a 'file access page' in php that will check for the session variable and either send or not send the file based on whether the user has access. - Ben Ben - I knew this, but it was the
Re: [PHP] PHP version check
Hi Andrew, Friday, October 28, 2005, 7:41:21 AM, you wrote: How can I query for PHP version? phpversion() ! Cheers, Rich -- Zend Certified Engineer http://www.launchcode.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach / unset
This syntax has the work done perfectly for me. 2005/10/28, Niels Ganser [EMAIL PROTECTED]: Why should this be unsafe (whatever the heck that means) in any way? Of course you can do it. Regards, Niels. [sorry for mailing to your private address. wrong button :)] Anyway, can you do *this* safely as a DOCUMENTED FEATURE: foreach($array as $k = $v){ if (...) unset($array[$k]); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using PHP for accsess control, preventing access to static files
Dan Trainor wrote: Hello, all - I'm designing a controlled access system in PHP, and it's coming along quite well. It's very simple, and just sets a session varibale, such as $_SESSION['authenticated'] = 1, not a whole lot. If you do this this, you must make sure you have some sort of session hijacking prevention in place. Now I run a small sniplet of code on the top of each HTML and PHP file, which checks for this variable, and either allows or denys access to the page. However, how do people protect against the downloading of real files, ones which are not parsed by PHP? .WMV, .MOV, .ZIP, .EXE and so on? I want to protect access to these as well, and if a visitor just types in a URL and is able to access the file because my access control mechanism simply doesn't work on those types of files, what should be the solution here? It's been suggested to use readfile() to accomplish this, by forwarding content from outside of the document root - but this just sounds odd. On top of being (what I think would be) incredibly slow, it just doesn't sound right. This works fine for me on one site I maintain, though not with readfile(). When testing readfile() always crapped out at around 2Mb, whereas fopen() and a while loop with fread() working perfectly, even for larger files (up to 200Mb). Not tested this on high traffic, though it all depends on how large you files are. -- Richard Heyes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: How to account for misspellings and alternatives in searching?
James Benson wrote: Not sure about the numbers but soundex could be useful http://php.net/soundex right and maybe its easier to just index thing like '5.11' as '511' - ie just stripping off everything not alphanumeric ... amnd doing the same with whatever people search on. I have used a similar technique to make it easier to search for text/words that contains letters with diacrites (e.g. 'e acute' becomes a plain 'e') and never underestimate a users ability to start writing about eating dessert in the desert, no doubt they had sandcakes. ;-) James Chris W. Parker wrote: Hello, On my site right now if someone searches for 511 (a misspelling of the manufacturer 5.11) they are not presented with the right products because 511 is not found anywhere in the database. I've got a few ideas on how to solve this but I want to find one that requires as little administrative overhead as possible. 1. I could add a field to the db for each product that would be used for associated words for a product as well as misspellings. PROS: Very customizable on an individual product level. CONS: Would need to be updated for each and every product individually. 2. Make a field for each manufacturer's record for alternate spellings/keywords. PROS: Little administrative overhead. CONS: Is only manufacturer name based and could not account for specific products. 3. Both #1 and #2. PROS: Flexible. CONS: Lots of administrative overhead. 4. A one-to-many table that associates individual words with product skus. This one is pretty much the opposite of #1 with one key difference: the interface. It would be probably be easier to enter a desired word and then choose each sku from a multi-select dropdown than it would be to go from product to product entering one word at a time. 5. I'm not sure how this would be accomplished from a technical standpoint but it would be nice to have the program know that when someone types in 511 they really meant 5.11. Or (hopefully this isn't a bad example) if they type in dessert (as in cake and icecream) they really meant desert (as in snakes and sand). In my case that wouldn't be a bad assumption since our site will never contain the word desert unless it's a misspelling. What does everyone think? What other options are out there? Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Decompressing a string with zlib problems
you have another problem - in that all these very specific strings that you are posting could very well be being mangled in someway because of the mail transport. in fact I doubt it comes thru in way that makes it testable at all. it doesn't help that googling for 'dcomzlib' brings up your own posts as the first results. not very helpful. interesting problem - sorry I can't help Graham Anderson wrote: I am having problems decompressing a zlib'd string located in a file. In the file headers, the compression says that it is zlib. But, when I 'gzinflate' the string, I get the error: gzinflate(): data error in b Is the below NOT a zlib or some strange variant ? anyone know ? g ?php $hex=C0636D766403DE789C95533B4E0331109D2408C44FA200125084568212D153 2040A2A02012120D05142636BB26B677659B20B8000D05D7E00674882B7EC1018019 67974D365060E569C76F3CEF4D66BD008D779DA67D0050BA9F707CC2CBFDE43301A07E1A 5003FA956B6433BEDFFB89A87E6CD5011AF3DEB21EC667BE173C1BA567A156D67E7DFEC3 772207C086E0DEE1B32D94F36545AE1B6AEB4673C9308834FFE3BF031C227613AE2CE575 A2ACCBAC6759A6824AADF6BA769259E945B46FA4665EA626EA08948D0E99E14A60597D4A 4B734936B10E36AD188941CF5F61E5ED6D17361C6D98928E6C1606366FAD7DDCA08B92CC 4507CC0F19C0061F18B4B9159743D39923913C7E74FE827ADE74DEF1A133EDBF270A2DE7 C30C8B5C31BF366A7447F91F2C62EE6E909A7928B96E5A79071FDD948B8ADFBB13CCE435 D339B78A10BFF406B04C2F642443510BD1AB9CA77809910CF3057955155FEAE1D5A99264 A6C6DAA07A5915A50EE2CA51BA93CD6BEEE9B6CD1AA605B73A4F9DE7F4FA93BBB1D004E8 302EA21BE993E848F6C58967B1888E2DCD6F2553D7B14EFB5290C40E6A6CE9F0F1CE75FD 6D665243839ACE14BB0DCADFAFDD8C76003C; // Convert the hex to a string $string = pack(H*, $hex); //echo it echo the compressed string is:. \r\n; echo $string; //decompress the string $uncompressed =gzinflate($string); echo the uncompressed string is: .$uncompressed; ? The Output SHOULD look something like this: 8 trak88øá8Animation Media Handlergmhdle Alias Data Handleralis The compressed output is: the compressed string is: ??t?+p??g?M6P`?i?o?Mf??w??}P??p|3?~P??kd3?~l???g?g?V?~}?? w?-??eE??Fs?0?4??v?,?u??ˬgY??J???v?Y?E?o?f^?J`Y}JKsI6?6??A? _a??m6m???l6o?}ܠ???E?Cә#?~t??z?t??3?' -?? ?\1?6jtG?,b?n??y(?nZy 9?L/d$CQ ѫ??x? ߯v?yU_??թ?d?? ڠzY???Q???k?:O?0.??H?ʼng???-?o%SױN?R??jlu?mfRC πnZy›îãäflªÃ‰5”9∑äøÙ∞L/d$CQ—´úßx ë ÛyU_Í·’©íd¶∆⁄†zY• ‚ Q∫ìÕkÓÈ∂Õ¶∑:OùÁÙ˙쪱–Ë0.¢ ÈìËHˆ≈âg±àé-Õo%S◊±N˚RêƒjlÈÒŒu˝mfRCÉöŒª flØ›åv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to account for misspellings and alternatives in searching?
On 10/27/05, Chris W. Parker [EMAIL PROTECTED] wrote: Hello, On my site right now if someone searches for 511 (a misspelling of the manufacturer 5.11) they are not presented with the right products because 511 is not found anywhere in the database. I've got a few ideas on how to solve this but I want to find one that requires as little administrative overhead as possible. You could use the pspell extension; add your manufacturers to your personal word-list and use pspell_check() to check the spelling and pspell_suggest() to suggest alternatives. http://www.php.net/manual/en/ref.pspell.php -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach / unset
Richard Lynch wrote: Somewhere in the manual (damned if I can find it now) it says (or used to say) that you can or can't safely do this: while (list($k, $v) = each($array)){ if (...) unset($array[$k]); } I don't even remember if it's safe or not, but I swear I saw it not that long ago... Anyway, can you do *this* safely as a DOCUMENTED FEATURE: foreach($array as $k = $v){ if (...) unset($array[$k]); } in short: yes. you can unset() in this way till the cows come home and not suffer undue consequences. I'm sure I could test it and maybe find out if it works but is it documented behaviour I can rely on? I'm sure not finding this in the manual now that I go looking for it, though I know I saw it there before. PS I'm being dragged kicking and screaming into using this new-fangled 'foreach' thing instead of while/list/each, and I don't really care for it so far. :-) if while/list/each foreach were women, while/list/each would be selling fish on a market stall foreach would be having her feet massaged while drinking dry martini at 35,000 feet :-) but I guess it's not the done thing to call a language construct sexy ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex and global vars problem
On 10/28/05, Tom Rogers [EMAIL PROTECTED] wrote: I would do it with a small class like this: ?php class mac{ var $mac=''; var $is_valid = false; function mac($mac){ $mac = preg_replace('/[^0-9A-F]/','',strtoupper($mac)); if($this-is_valid = preg_match('/^(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})$/',$mac,$parts)){ array_shift($parts); //lose the first bit $this-mac = implode(':',$parts); } } } //test $mac_list = array(00-aa-11-bb-22-cc,00:aa:11:bb:22:cc,zz:00:11:22:ff:xx,00 aa 11 bb 22 cc); foreach($mac_list as $mac){ $mactest = new mac($mac); echo In:$mac; if($mactest-is_valid){ echo valid $mactest-mac\n; }else{ echo NOT valid\n; } } $mactest = new mac(there are a few gotchas for anyone using this); print $mactest-is_valid ? valid\n : invalid\n; // valid -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mixed PHP/SSI and environment variables
Hello, I have a problem with the persistence of environment variables when mixing PHP and SSI (Apache) and I am not sure if I just made an error or if this approach cannot work at all. So please consider the following files: setvar.shtml - !--#set var=myvar value=myval -- - showvar.php - ?php echo apache_getenv( myvar ); ? - info.shtml - !--#include virtual=setvar.shtml -- !--#include virtual=showvar.php -- - info.php - ?php virtual( setvar.shtml ); echo apache_getenv( myvar ); ? - What I would expect is that you get the same result if you call info.shtml and info.php. What happens when I tried (PHP 4.3.10 with both Apache 1.3.33 and 2.0.53): the shtml shows the variable but the php does not, it seems to forget the variable set in setvar.shtml. Please, can anybody tell me what is going wrong here? Regards, Christoph -- Christoph Freundlhttp://www10.informatik.uni-erlangen.de/~chfreund/ Lehrstuhl für Systemsimulation (Inf. 10), Cauerstr. 6, D-91058 Erlangen The earth is like a tiny grain of sand, only much, much heavier. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP version check
On 28 Oct 2005, at 07:46, Richard Davey wrote: Friday, October 28, 2005, 7:41:21 AM, you wrote: How can I query for PHP version? phpversion() ! While it's true that that will get you a version string, if you're going to actually check it, you need: http://www.php.net/manual/en/function.version-compare.php to do so reliably. Version strings are messy things. Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture [EMAIL PROTECTED] | http://www.synchromedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] regex and global vars problem
Hi, Friday, October 28, 2005, 7:20:58 PM, you wrote: RV On 10/28/05, Tom Rogers [EMAIL PROTECTED] wrote: I would do it with a small class like this: RV $mactest = new mac(there are a few gotchas for anyone using this); print $mactest-is_valid ? valid\n : invalid\n; RV // valid RV -- RV PHP General Mailing List (http://www.php.net/) RV To unsubscribe, visit: http://www.php.net/unsub.php It does reduce to a valid mac address (EE:AE:AF:EC:AF:AE) :) -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] printing from php
Hello, I've been reading up on printing out documents using PHP (using Printer functions calls in the php manual) I'm using a Linux and/or FreeBSD operating system to run my php code on (in apache). However, I am surfing these pages using a Windows XP machine. Has anyone ever tried having a print button (or link) in php that would make Whatever page is being displayed being printed with the above scenario? How might you of gone about it to make it work? (the Linux or FreeBSD box is not configured to have a printer on it, shared or local, does that make a difference? ) Would appreciate any feedback. Thanks! Tom -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.361 / Virus Database: 267.12.5/150 - Release Date: 10/27/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] printing from php
don't post a new question to an existing thread - it lessens your exposure! Tom Cruickshank wrote: Hello, I've been reading up on printing out documents using PHP (using Printer functions calls in the php manual) I'm using a Linux and/or FreeBSD operating system to run my php code on (in apache). However, I am surfing these pages using a Windows XP machine. Has anyone ever tried having a print button (or link) in php that would make Whatever page is being displayed being printed with the above scenario? How might you of gone about it to make it work? (the Linux or FreeBSD box is not configured to have a printer on it, shared or local, does that make a difference? ) either you let the client (browser) print the page - this has nothing to do with php OR you let the server print 'something' (based on a specific request from the user - i.e. he clicked on 'print' link or something) in which case you will _need_ to have access to a printer from the server (i.e. it needs to have a printer configured) basically if the server 'has' no printer it can't print. Would appreciate any feedback. Thanks! Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mixed PHP/SSI and environment variables
Christoph Freundl wrote: Hello, I have a problem with the persistence of environment variables when mixing PHP and SSI (Apache) and I am not sure if I just made an error or if this approach cannot work at all. So please consider the following files: setvar.shtml - !--#set var=myvar value=myval -- - showvar.php - ?php echo apache_getenv( myvar ); ? - info.shtml - !--#include virtual=setvar.shtml -- !--#include virtual=showvar.php -- - info.php - ?php virtual( setvar.shtml ); have yuou tried include/require here instead of virtual() I imagine that the env of the subprocess wouldn't affect the env of the parent process - i.e. to me it makes sense if you say the env var in the subprocess is not available in the parent process. echo apache_getenv( myvar ); ? - What I would expect is that you get the same result if you call info.shtml and info.php. What happens when I tried (PHP 4.3.10 with both Apache 1.3.33 and 2.0.53): the shtml shows the variable but the php does not, it seems to forget the variable set in setvar.shtml. Please, can anybody tell me what is going wrong here? Regards, Christoph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mixed PHP/SSI and environment variables
Am Freitag, 28. Oktober 2005 13:22 schrieb Jochem Maas: info.php - ?php virtual( setvar.shtml ); have yuou tried include/require here instead of virtual() I imagine that the env of the subprocess wouldn't affect the env of the parent process - i.e. to me it makes sense if you say the env var in the subprocess is not available in the parent process. echo apache_getenv( myvar ); ? - Nope, both include and require result that the content of setvar.shtml shows up literally in the output without the SSI having been processed by Apache. -- Christoph Freundlhttp://www10.informatik.uni-erlangen.de/~chfreund/ Lehrstuhl für Systemsimulation (Inf. 10), Cauerstr. 6, D-91058 Erlangen Quiet people aren't the only ones who don't say much. - R. Baalke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mixed PHP/SSI and environment variables
Christoph Freundl wrote: Am Freitag, 28. Oktober 2005 13:22 schrieb Jochem Maas: info.php - ?php virtual( setvar.shtml ); have yuou tried include/require here instead of virtual() I imagine that the env of the subprocess wouldn't affect the env of the parent process - i.e. to me it makes sense if you say the env var in the subprocess is not available in the parent process. echo apache_getenv( myvar ); ? - Nope, both include and require result that the content of setvar.shtml shows up literally in the output without the SSI having been processed by Apache. ok, and if you stick the following in 1 file and call it?: !--#set var=myvar value=myval -- ?php echo apache_getenv( myvar ); ? ... just thinking out loud here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach / unset
The foreach statement works because you are getting the array index ($k) to unset the array item. I think somewhere in the manual it says it's unsafe because some people might think you could just use unset ($v) to unset the array item. Which wouldn't work because $v is more of a temporary variable and not a reference to the array item. On Oct 27, 2005, at 6:18 PM, Richard Lynch wrote: Somewhere in the manual (damned if I can find it now) it says (or used to say) that you can or can't safely do this: while (list($k, $v) = each($array)){ if (...) unset($array[$k]); } I don't even remember if it's safe or not, but I swear I saw it not that long ago... Anyway, can you do *this* safely as a DOCUMENTED FEATURE: foreach($array as $k = $v){ if (...) unset($array[$k]); } I'm sure I could test it and maybe find out if it works but is it documented behaviour I can rely on? I'm sure not finding this in the manual now that I go looking for it, though I know I saw it there before. PS I'm being dragged kicking and screaming into using this new-fangled 'foreach' thing instead of while/list/each, and I don't really care for it so far. :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trouble using DOM component with PHP 4.4.0
And what DOM library, which is compatible with PHP 5.0 and PHP 4.4 can I use to avoid the conflict I currently have? In PHP4 I never used any DOM implementation, I started to use DOM only after the PHP5 release, so I'm not the best to answer your question. :) Anyway I think that there is some implementation in the PEAR repository. Try to search there. Best regards. -- Alessandro 'Aronnax' Rossini web - www.aronnax.it e-mail - [EMAIL PROTECTED] icq - 2442698 ZeroNotice IT Solutions - www.zeronotice.com pgpnYfeAnccWj.pgp Description: PGP signature
Re: [PHP] foreach / unset
Richard Lynch wrote: Somewhere in the manual (damned if I can find it now) it says (or used to say) that you can or can't safely do this: while (list($k, $v) = each($array)){ if (...) unset($array[$k]); } I don't even remember if it's safe or not, but I swear I saw it not that long ago... Anyway, can you do *this* safely as a DOCUMENTED FEATURE: foreach($array as $k = $v){ if (...) unset($array[$k]); } I'm sure I could test it and maybe find out if it works but is it documented behaviour I can rely on? I'm sure not finding this in the manual now that I go looking for it, though I know I saw it there before. I would *think* (just my opinion without much thought on a Friday morning) that this would/could be unsafe _if_ it was a for loop on a numerical indexed array. Of course, my thinking may change after my first bottle of Dew. ;) PS I'm being dragged kicking and screaming into using this new-fangled 'foreach' thing instead of while/list/each, and I don't really care for it so far. :-) For the longest time, I hated foreach. Looked at other people's code who used it, and just wanted to strangle them. However, I was sorta forced into it about 8 months ago, and now I'm in the camp of, Damn, I really like this. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach / unset
John Nichel wrote: Richard Lynch wrote: Somewhere in the manual (damned if I can find it now) it says (or used to say) that you can or can't safely do this: while (list($k, $v) = each($array)){ if (...) unset($array[$k]); } I don't even remember if it's safe or not, but I swear I saw it not that long ago... Anyway, can you do *this* safely as a DOCUMENTED FEATURE: foreach($array as $k = $v){ if (...) unset($array[$k]); } I'm sure I could test it and maybe find out if it works but is it documented behaviour I can rely on? I'm sure not finding this in the manual now that I go looking for it, though I know I saw it there before. I would *think* (just my opinion without much thought on a Friday morning) that this would/could be unsafe _if_ it was a for loop on a numerical indexed array. Of course, my thinking may change after my first bottle of Dew. ;) this function might change your mind (I take it you have had your Dew by now :-): function resolveArgs($args) { $args = array_values($args); for ($i = 0; $i count($args); ++$i) { while (isset($args[$i]) is_array($args[$i])) { array_splice($args,$i,1,array_values($args[$i])); } } return $args; } basically it flattens a multidimensional array - i use it for handling DB query arguments (makes it easier to pass around args whilst build highly dynamic queries) so intrinsically its not unsafe to manipulate the array - only you have the potential to shoot yourserlf in the foot :-) then again both Richard and John have more than enough skills to do that anyway ;-) PS I'm being dragged kicking and screaming into using this new-fangled 'foreach' thing instead of while/list/each, and I don't really care for it so far. :-) new-fangled is putting the boat out a bit thought :-) it's been around since 4.0, I guess your looking forward to being able to use foreach to iterate over php5 object ;-) For the longest time, I hated foreach. Looked at other people's code who used it, and just wanted to strangle them. However, I was sorta forced into it about 8 months ago, and now I'm in the camp of, Damn, I really like this. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Use sqlite with php 4.4 ?
Hi, is it possible to use sqlite with php 4.4 ? What do I have to do ? I could not find and option in ./configure. tks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Use sqlite with php 4.4 ?
On Fri, 28 Oct 2005, mbneto wrote: is it possible to use sqlite with php 4.4 ? What do I have to do ? I could not find and option in ./configure. http://php.net/sqlite -- Greg Donald Zend Certified Engineer MySQL Core Certification http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mixed PHP/SSI and environment variables
Am Freitag, 28. Oktober 2005 13:42 schrieb Jochem Maas: ok, and if you stick the following in 1 file and call it?: !--#set var=myvar value=myval -- ?php echo apache_getenv( myvar ); ? ... just thinking out loud here. Ok, I tried this by configuring Apache such that .php-files are also parsed for Server Side Includes and wrote it the way you suggest. Now I am really confused: the SSI statements are obviously recognized because they do not appear in the resulting file but a) apache_getenv does still not return the value for the variable but b) if I call phpinfo() instead of apache_getenv the variable myvar plus the set value is shown correctly in the Apache Environment and c) an SSI !--#echo var=myvar -- after the php block also gives the correct value Perhaps I return to what I primarily intended to ask: is it really the wanted behaviour of virtual() that changes that are made by the included file do not influence the environment of the including file? Regards, Christoph -- Christoph Freundlhttp://www10.informatik.uni-erlangen.de/~chfreund/ Lehrstuhl für Systemsimulation (Inf. 10), Cauerstr. 6, D-91058 Erlangen Tel: +49-9131-85-28676 | A low voter turnout is an indication of fewer Fax: +49-9131-85-28928 |people going to the polls. - D. Quayle -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Type of form element
Hi, I have some checkboxes on my page which correspond with boolean fields in my database - actually they are TINYINT's in which I store a 0 or 1 in for false and true values respectively. Is it possible to loop through all $_POST values to see if it is a checkbox? If so then for that element if it is equal to 'on' then change it to 1 otherwise change it to 0? Thanks for your advice. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Type of form element
Hello Shaun, Friday, October 28, 2005, 9:00:05 AM, you wrote: Is it possible to loop through all $_POST values to see if it is a checkbox? If so then for that element if it is equal to 'on' then change it to 1 otherwise change it to 0? Yes and no. 1. You can't determine by the POST variable whether it was a checkbox or a text field unless you test for 1/0 or a string, but even then, what if someone types a 0 into a textbox that was supposed to be an address (input validation). The other option is to name the checkbox something like question1_chkbox and do a strstr() to see if the POST variable name contains _chkbox. But you should know what the variable names of your checkboxes are anyways, so I don't know why you'd test to see if it was a checkbox. 2. Only set checkboxes (checked) are passed through POST and GET. This is fine if it's a one time form and you just need to know if they said yes to subscribing to your newsletter, but if it's a form they can go back into to modify settings (i.e. their account) then you need to test to see if they unchecked a box which will not be passed back to you via POST. Basically you'd set all the fields to 1 if the checkbox variable appeared in the POST, and set all the rest of the fields to zero (because if it wasn't in the POST variables, it was unchecked). -- TBUDL/BETA/DEV/TECH Lists Moderator / PGP 0x6C0AB16B __ Geocaching:http://gps.PCWize.com ( ) ( ___)(_ _)( ___) TBUDP Wiki Site: http://www.PCWize.com/thebat/tbudp )(__ )__) _)(_ )__) Roguemoticons Smileys:http://PCWize.com/thebat ()()()(__)PHP Tutorials and snippets:http://www.DevTek.org Some days I feel like I'm just rearranging deck chairs on the Titanic. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Type of form element
Is it possible to loop through all $_POST values to see if it is a checkbox? If so then for that element if it is equal to 'on' then change it to 1 otherwise change it to 0? foreach($_POST as $key = $value){ if ($value=='on'){$_POST[$key]='1';}elseif($value=='off';){$_POST[$key]='0'}; } JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Type of form element
[snip] I have some checkboxes on my page which correspond with boolean fields in my database - actually they are TINYINT's in which I store a 0 or 1 in for false and true values respectively. Is it possible to loop through all $_POST values to see if it is a checkbox? If so then for that element if it is equal to 'on' then change it to 1 otherwise change it to 0? [/snip] Yes. And, if so, yes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Decompressing a string with zlib problems
On 10/28/05, Graham Anderson [EMAIL PROTECTED] wrote: I am having problems decompressing a zlib'd string located in a file. In the file headers, the compression says that it is zlib. But, when I 'gzinflate' the string, I get the error: gzinflate(): data error in b Is the below NOT a zlib or some strange variant ? ?php $hex=C0636D766403DE789C95533B4E [...] Is this thread any help? http://lists.apple.com/archives/QuickTime-java/2003/Sep/msg00038.html Looking at your binary data in a hex editor, you've got what looks like a cmvd header at the start. If the next four bytes are the length of the compressed data, then you've got probably got 990 bytes following that that you should be decompressing. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mixed PHP/SSI and environment variables
Christoph Freundl wrote: Am Freitag, 28. Oktober 2005 13:42 schrieb Jochem Maas: ok, and if you stick the following in 1 file and call it?: !--#set var=myvar value=myval -- ?php echo apache_getenv( myvar ); ? ... just thinking out loud here. I just looked at apache_getenv(): string apache_getenv ( string variable [, bool walk_to_top] ) the second arg maybe something to consider? also does getenv() [http://php.net/getenv] have the same problems? Ok, I tried this by configuring Apache such that .php-files are also parsed for Server Side Includes and wrote it the way you suggest. Now I am really confused: the SSI statements are obviously recognized because they do not appear in the resulting file but a) apache_getenv does still not return the value for the variable but b) if I call phpinfo() instead of apache_getenv the variable myvar plus the set value is shown correctly in the Apache Environment and c) an SSI !--#echo var=myvar -- after the php block also gives the correct value Perhaps I return to what I primarily intended to ask: is it really the wanted behaviour of virtual() that changes that are made by the included file do not influence the environment of the including file? I would say yes because virtual() create a sub-process, with it _own_ env. Regards, Christoph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OCI8
I'm running php5.0.5 and I'm trying to get connected to an oracle server. Pear's DB requires the PHP OCI8 extension. The php website doesn't give 'installation' instructions for getting php_oci8.dll which seems to be required in order to connect to an Oracle server. I've got the oracle instant client downloaded and I have oracle client 8.1 installed already. I just can't seem to figure out how to get php to recognize oracle. Can anybody help out with this? James Kilbride
Re: [PHP] XML-RPC Error:-32300:transport error - could not open socket
It was the version of class-IXR.php, there was a small bug in that library and the fix had just come out, so it was until I went back and download some updates that it worked. On 10/22/05, Richard Lynch [EMAIL PROTECTED] wrote: On Sat, October 22, 2005 10:19 am, Dan McCullough wrote: I'm having any issue finding out why this is happening and how to fix it. Is it a permissions problem between php and the server or something else? Help Go to the command line/shell or even, gak, MS-DOS, and type: telnet XYZ 32000 XYZ should be an IP address like 192.168.1.1 or a domain name. Either the server responds, or it's not working and PHP can't fix it. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: How to account for misspellings and alternatives insearching?
Jochem Maas mailto:[EMAIL PROTECTED] on Friday, October 28, 2005 1:33 AM said: James Benson wrote: Not sure about the numbers but soundex could be useful http://php.net/soundex right and maybe its easier to just index thing like '5.11' as '511' - ie just stripping off everything not alphanumeric ... How do I index thing like '5.11' as '511'? (I know how to strip off the characters. It's the indexing part that I'm not sure about.) and never underestimate a users ability to start writing about eating dessert in the desert, no doubt they had sandcakes. ;-) Better yet! Icecream flavored snakes! Thanks, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] calling static method within class
I have a class that won't be instantiated...so basically just a bunch of static methods. How do I call one of the class' static methods from within another method? Can't use this, and self doesn't work...this is php4. Thanks. Class Foo{ function getMe(){ return me; } function getUs(){ $us=xxx::getMe(); $us.= me; } } echo Foo::getUs(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calling static method within class
On Fri, 28 Oct 2005, blackwater dev wrote: I have a class that won't be instantiated...so basically just a bunch of static methods. How do I call one of the class' static methods from within another method? Can't use this, and self doesn't work...this is php4. Same way you do it outside the class: Foo::getMe(); -- Greg Donald Zend Certified Engineer MySQL Core Certification http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Type of form element
If you have a checkbox you just test if the value is set with isset() if it's not set they never selected the checkbox. Or if thats not what you mean maybe this could help http://php.net/variables.external Shaun wrote: Hi, I have some checkboxes on my page which correspond with boolean fields in my database - actually they are TINYINT's in which I store a 0 or 1 in for false and true values respectively. Is it possible to loop through all $_POST values to see if it is a checkbox? If so then for that element if it is equal to 'on' then change it to 1 otherwise change it to 0? Thanks for your advice. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Type of form element
On Fri, 28 Oct 2005, James Benson wrote: If you have a checkbox you just test if the value is set with isset() if it's not set they never selected the checkbox. I have some checkboxes on my page which correspond with boolean fields in my database - actually they are TINYINT's in which I store a 0 or 1 in for false and true values respectively. Is it possible to loop through all $_POST values to see if it is a checkbox? If so then for that element if it is equal to 'on' then change it to 1 otherwise change it to 0? I usually place a hidden field with the same name as the checkbox field before the actual checkbox field. I store my 'false' value in there. If the checkbox is checked the hidden field is overridden. ?php error_reporting( E_ALL ); if( isset( $_POST[ 'submit' ] ) ) { echo 'pre'; print_r( $_POST ); echo '/pre'; } echo EOF form method='post' action='$_SERVER[PHP_SELF]' input type='hidden' value='0' name='blah' input type='checkbox' value='1' name='blah' Blah? input type='submit' name='submit' /form EOF; ? -- Greg Donald Zend Certified Engineer MySQL Core Certification http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] calling static method within class
If you're expecting the statement Echo Foo::getUs(); To echo me me it will not because you never returned $us from the getUs() method. I'm assuming also that xxx is a variable to mean some class library correct? Carlo Razzeto Programmer Mortgage Information Services Phone: (216) 514-1025 ex. 1212 -Original Message- From: blackwater dev [mailto:[EMAIL PROTECTED] Sent: Friday, October 28, 2005 1:13 PM To: php-general@lists.php.net Subject: [PHP] calling static method within class I have a class that won't be instantiated...so basically just a bunch of static methods. How do I call one of the class' static methods from within another method? Can't use this, and self doesn't work...this is php4. Thanks. Class Foo{ function getMe(){ return me; } function getUs(){ $us=xxx::getMe(); $us.= me; } } echo Foo::getUs(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Disclaimer: This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message. Any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach / unset
On Fri, October 28, 2005 8:47 am, Jochem Maas wrote: John Nichel wrote: Richard Lynch wrote: Somewhere in the manual (damned if I can find it now) it says (or used to say) that you can or can't safely do this: while (list($k, $v) = each($array)){ if (...) unset($array[$k]); } I don't even remember if it's safe or not, but I swear I saw it not that long ago... Anyway, can you do *this* safely as a DOCUMENTED FEATURE: foreach($array as $k = $v){ if (...) unset($array[$k]); } I'm sure I could test it and maybe find out if it works but is it documented behaviour I can rely on? I'm sure not finding this in the manual now that I go looking for it, though I know I saw it there before. I would think it would be just fine *EXCEPT* that the internal pointer of the original array is being incremented in parallel with the copied array key/values, so it ends up at the end after the foreach So, unless it's a DOCUMENTED FEATURE rather than an implementation detail, I don't really want to rely on unset($original[$k]) working because who knows what might change in PHP6 with the internal pointer and unsetting the current entry it points to, or, rather, the entry it previously pointed to. I know for sure that while/list/each and an integer-indexed array and (unset($array[$k + 1])) is a big mistake :-) I would *think* (just my opinion without much thought on a Friday morning) that this would/could be unsafe _if_ it was a for loop on a numerical indexed array. Of course, my thinking may change after my first bottle of Dew. ;) I think it's always been okay to unset the *CURRENT* element, but if you started dinking with other elements, in some sort of poor-man's relational algorithm, you'd be in trouble. foreach doesn't DOCUMENT unset-ing either way... PS I'm being dragged kicking and screaming into using this new-fangled 'foreach' thing instead of while/list/each, and I don't really care for it so far. :-) new-fangled is putting the boat out a bit thought :-) it's been around since 4.0, I guess your looking forward to being able to use foreach to iterate over php5 object ;-) For me, who started in PHP 3.0 RC 2, PHP 4.0 *is* new-fangled. PHP 5 is just *more* new-fangled. I suppose by PHP6 I'll be just plain obsolete and have to start looking for a new language. :-v For the longest time, I hated foreach. Looked at other people's code who used it, and just wanted to strangle them. However, I was sorta forced into it about 8 months ago, and now I'm in the camp of, Damn, I really like this. I don't like it precisely because it's not documented what if... while/list/each actually HAD documentation at one point that it was kosher to unset() the current element, but no other. Though that also seems to have gone missing from the manual, possibly in the Great Purge of not so long ago (from a PHP3.0rc2 persepctive of time). I also just don't care for the clever crammed syntax and the as keyword. It just doesn't go through my brain easily, no matter how many times I see it. I guess I'm just so used to assignments being left - right, where foreach has it right - left for what's being assigned to what... How about: eachfrom([$k = ] $v = $array){ } Now, see, that would make perfect sense to me... [shrug] DSFDF -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] UTF-8 to ISO-8859-1
So, I'm parsing some XML and dumping some stuff to a web-site. The character-encoding for the HTML of the output has already been set by headers() to ISO-8859-1 for me, and I'm stuck with that. So be it. The XML has this at the top: ?xml version=1.0 encoding=UTF-8 standalone=yes? We don't (and won't soon) have recode nor iconv installed, but utf8_recode() is there. So, my question is: Can I just: utf8_recode($all_the_xml_file); Or do I have to utf8_recode() every single chunk of data between the tags? Ugh. Oh well. At least I had fun writing the parallel XML feed reader, which sped things up by about 40% over sequential file_get_contents-es :-) I should find out if I can OS that class. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OCI8
On Fri, October 28, 2005 10:19 am, Kilbride, James wrote: I'm running php5.0.5 and I'm trying to get connected to an oracle server. Pear's DB requires the PHP OCI8 extension. The php website doesn't give 'installation' instructions for getting php_oci8.dll which seems to be required in order to connect to an Oracle server. I've got the oracle instant client downloaded and I have oracle client 8.1 installed already. I just can't seem to figure out how to get php to recognize oracle. Can anybody help out with this? php_oci8.dll is the extension of PHP which connects PHP and the Oracle instant client you already downloaded. Or, possibly, has that client already embedded within it, and with PHP wrappers around it. That doesn't tell you where it is, but at least you know WHAT it is that you are missing. If it's not in the php.zip file you downloaded, you can google for php_oci8.dll and maybe come up with a trusted source, and check for more downloads in http://php.net/ to see if maybe it's packaged separately. Hope that helps at least a little. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Decompressing a string with zlib problems
Well, maybe QT has a very wacked out version of zLib ? This is what I sent to the Quicktime API list: //-- -- Ok, here we go :) Isn't looking through reams of hex data a blast ? Kind of like a hot poker in the eye ;) curl -l -i http://www.siren.cc/siren/reel/Library/php/zlib.php; Here are two versions of the SAME test movie exported from Livestage: One version has compressed movie headers The other version has uncompressed movie headers With zLib, I am using gzcompress at compression level 6, and gzuncompress. All the string data below was converted from hex with the pack() function. The actual php script I wrote for this test is way way below. The upshot: 1)Using zlib to compress and decompress a movie header seems to work fine :) 2)Attempting to 'gzuncompress' a movie header that was compressed in Livestage gives an error. I doubt this is fault of Livestage which I assume is simply calling DataCodecCompress or an equivalent function, no ? 3) The Livestage'd compressed movie header output IS NOT THE SAME as a the zLib'd compressed movie header output Maybe I am not starting at the correct point in the compressed movie header string? hopefully, this is enough to start a dialog. here is the output: //- The uncompressed movie header string is: [EMAIL PROTECTED] mdhd??7???7?XXH?hdlrmhlrsprtappl? Sprite Animation Media Handlerminf [EMAIL PROTECTED] Apple Alias Data Handler$dinfdref alis?stbl,stsdzlibsttsXstscstszstco? code?sean emk hjkedtligudta namedrm]udta#?swrMade with LiveStage Proplugmoviename=drm.mov ctypnone play //- Compressed in Livestage: the compressed movie header string is: ?cmvd?x??S?n1?l?P?H ՂV[EMAIL PROTECTED] [EMAIL PROTECTED]| ?=??9???[?o??~4???k??e?soo?C7? ??P???7?Fs???4?ǻ? ?,?ugU?K?s?ꬲҋld?f^?;HJ`Z?PK3#?\?A?? Mͷa???oe8?0%???*J2?3??!?܊Y?;?D??O??7?;??;?Vr??C??m?R? ӂ[Cߢ??o???8a\dK??\?3?r??Z?ߋJ??\HA?ԯ*Sj?A??*0?F?] 9 c?8×?oZ6f p?;-?hM??fb?A?!?O?9 //- The zlib version of the uncompressed movie header using gzcompress at level 6 is: [EMAIL PROTECTED]@??T?U?m?EU??`?HHٰ??!3??̌??I9K?-8E?8??H?s?qb?EG? 4o???=??:?:ϧ??4?ß?/D??k??.-?o[6F?̏K?N?Y?յ??Ѝ???P??? 撡?h?̻#?g\Y??LYWXϊB?,Qt?~XX?Erd?f^??M???J`Y?BKsA2?.ez):=Z?p?aJ:? [EMAIL PROTECTED] ??'?_??7':S??{Η3?b1Z?/?c?p??? o;ʹh??̄h??]?Z??bFd??(87ɷ???4?$?ZmP?l?Ri#uѝpO_?kô?V? Я??p?.-t???R?,?)?b?Y*?K??-?$??T u??n??UarC??,??t_ //- the uncompressed zlib movie header string using gzuncompress is: [EMAIL PROTECTED] mdhd??7???7?XXH?hdlrmhlrsprtappl? Sprite Animation Media Handlerminf [EMAIL PROTECTED] Apple Alias Data Handler$dinfdref alis?stbl,stsdzlibsttsXstscstszstco? code?sean emk hjkedtligudta namedrm]udta#?swrMade with LiveStage Proplugmoviename=drm.mov ctypnone play //- Here is the attempt to use gzuncompress with the movieheader compressed in Livestage: br / bWarning/b: gzuncompress(): data error in b/home/www/siren/ siren/reel/Library/php/zlib.php/b on line b34/bbr / Here is the PHP script: ?php $uncompressed_movieheader_hex=03DE6D6F6F76006C6D766864B F883792BF88379202580258000101010 0014 2580002030D7472616B005C7 46B68640003BF883792BF88379200010258F FFE000100010 00040020002002465647473001C656C73740 00102580001026E6D64696100206D646864B F883792BF883792025802580048003F68646C726D686C727 37072746170706C0001000101C11E53707269746520416E696D6174696F6E204D656 469612048616E646C657202076D696E660020676D68640018676D696E000 00040003968646C7264686C72616C6973617 0706C1001000101D2184170706C6520416C69617320446174612048616E646C65720
[PHP] Re: DataCodecCompress and zLib problem (solved)
DOH! OK, I was starting at the wrong place in the hex I misread the QTFF docs which include two more atoms on the next page: Four-character code Atom type 'cmvd'Compressed movie data Uncompressed size32-bit integer The correct output is now: //- The uncompressed movie header string is: [EMAIL PROTECTED] mdhd??7???7?XXH?hdlrmhlrsprtappl? Sprite Animation Media Handlerminf [EMAIL PROTECTED] Apple Alias Data Handler$dinfdref alis?stbl,stsdzlibsttsXstscstszstco? code?sean emk hjkedtligudta namedrm]udta#?swrMade with LiveStage Proplugmoviename=drm.mov ctypnone play //- Compressed in Livestage: the compressed movie header string is: x??S?n1?l?P?H ՂV[EMAIL PROTECTED]@? Z???^w?| ?=??9???[?o??~4???k??e?soo?C7? ??P???7?Fs???4?ǻ? ?,?ugU?K?s?ꬲҋld?f^?;HJ`Z?PK3#?\?A?? Mͷa???oe8?0%???*J2?3??!?܊Y?;?D??O??7?;??;?Vr??C??m?R? ӂ[Cߢ??o???8a\dK??\?3?r??Z?ߋJ??\HA?ԯ*Sj?A??*0? F?] c?8×?oZ6f p?;-?hM??fb?A?!?O?9 //- The zlib version of the uncompressed movie header using gzcompress at level 6 is: [EMAIL PROTECTED]@??T?U?m?EU??`?HHٰ??!3??̌??I9K?-8E?8??H?s?qb?EG? 4o???=??:?:ϧ??4?ß?/D??k??.-?o[6F?̏K?N?Y?յ??Ѝ???P??? 撡?h?̻#?g\Y??LYWXϊB?,Qt?~XX?Erd?f^??M???J`Y?BKsA2?.ez):=Z?p?aJ:? [EMAIL PROTECTED] ??'?_??7':S??{Η3?b1Z?/?c?p??? o;ʹh??̄h??]?Z??bFd??(87ɷ???4?$?ZmP?l?Ri#uѝpO_?kô?V? Я??p?.-t???R?,?)?b?Y*?K??-?$??T u??n??UarC??,??t_ //- the uncompressed zlib movie header string using gzuncompress is: [EMAIL PROTECTED] mdhd??7???7?XXH?hdlrmhlrsprtappl? Sprite Animation Media Handlerminf [EMAIL PROTECTED] Apple Alias Data Handler$dinfdref alis?stbl,stsdzlibsttsXstscstszstco? code?sean emk hjkedtligudta namedrm]udta#?swrMade with LiveStage Proplugmoviename=drm.mov ctypnone play //- Here is the attempt to use gzuncompress with the movieheader compressed in Livestage: [EMAIL PROTECTED] mdhd??7???7?XXH?hdlrmhlrsprtappl? Sprite Animation Media Handlerminf [EMAIL PROTECTED] Apple Alias Data Handler$dinfdref alis?stbl,stsdzlibsttsXstscstszstcoe? code?sean emk hjkedtligudta namedrm]udta#?swrMade with LiveStage Proplugmoviename=drm.mov ctypnone play On Oct 28, 2005, at 2:26 PM, Graham Anderson wrote: Ok, here we go :) Isn't looking through reams of hex data a blast ? Kind of like a hot poker in the eye ;) curl -l -i http://www.siren.cc/siren/reel/Library/php/zlib.php; Here are two versions of the SAME test movie exported from Livestage: One version has compressed movie headers The other version has uncompressed movie headers With zLib, I am using gzcompress at compression level 6, and gzuncompress. All the string data below was converted from hex with the pack() function. The actual php script I wrote for this test is way way below. The upshot: 1)Using zlib to compress and decompress a movie header seems to work fine :) 2)Attempting to 'gzuncompress' a movie header that was compressed in Livestage gives an error. I doubt this is fault of Livestage which I assume is simply calling DataCodecCompress or an equivalent function, no ? 3) The Livestage'd compressed movie header output IS NOT THE SAME as a the zLib'd compressed movie header output Maybe I am not starting at the correct point in the compressed movie header string? hopefully, this is enough to start a dialog. here is the output: //- The uncompressed movie header string is: [EMAIL PROTECTED] mdhd??7???7?XXH? hdlrmhlrsprtappl?Sprite Animation Media Handlerminf [EMAIL PROTECTED] 9hdlrdhlralisappl?Apple Alias Data Handler$dinfdref
[PHP] Re: DataCodecCompress and zLib problem (solved)
DOH! OK, I was starting at the wrong place in the hex I misread the QTFF docs which include two more atoms on the NEXT page: Four-character code Atom type 'cmvd'Compressed movie data Uncompressed size32-bit integer The correct output is now: //- The uncompressed movie header string is: [EMAIL PROTECTED] mdhd??7???7?XXH?hdlrmhlrsprtappl? Sprite Animation Media Handlerminf [EMAIL PROTECTED] Apple Alias Data Handler$dinfdref alis?stbl,stsdzlibsttsXstscstszstco? code?sean emk hjkedtligudta namedrm]udta#?swrMade with LiveStage Proplugmoviename=drm.mov ctypnone play //- Compressed in Livestage: the compressed movie header string is: x??S?n1?l?P?H ՂV[EMAIL PROTECTED]@? Z???^w?| ?=??9???[?o??~4???k??e?soo?C7? ??P???7?Fs???4?ǻ? ?,?ugU?K?s?ꬲҋld?f^?;HJ`Z?PK3#?\?A?? Mͷa???oe8?0%???*J2?3??!?܊Y?;?D??O??7?;??;?Vr??C??m?R? ӂ[Cߢ??o???8a\dK??\?3?r??Z?ߋJ??\HA?ԯ*Sj?A??*0? F?] c?8×?oZ6f p?;-?hM??fb?A?!?O?9 //- The zlib version of the uncompressed movie header using gzcompress at level 6 is: [EMAIL PROTECTED]@??T?U?m?EU??`?HHٰ??!3??̌??I9K?-8E?8??H?s?qb?EG? 4o???=??:?:ϧ??4?ß?/D??k??.-?o[6F?̏K?N?Y?յ??Ѝ???P??? 撡?h?̻#?g\Y??LYWXϊB?,Qt?~XX?Erd?f^??M???J`Y?BKsA2?.ez):=Z?p?aJ:? [EMAIL PROTECTED] ??'?_??7':S??{Η3?b1Z?/?c?p??? o;ʹh??̄h??]?Z??bFd??(87ɷ???4?$?ZmP?l?Ri#uѝpO_?kô?V? Я??p?.-t???R?,?)?b?Y*?K??-?$??T u??n??UarC??,??t_ //- the uncompressed zlib movie header string using gzuncompress is: [EMAIL PROTECTED] mdhd??7???7?XXH?hdlrmhlrsprtappl? Sprite Animation Media Handlerminf [EMAIL PROTECTED] Apple Alias Data Handler$dinfdref alis?stbl,stsdzlibsttsXstscstszstco? code?sean emk hjkedtligudta namedrm]udta#?swrMade with LiveStage Proplugmoviename=drm.mov ctypnone play //- Here is the attempt to use gzuncompress with the movieheader compressed in Livestage: [EMAIL PROTECTED] mdhd??7???7?XXH?hdlrmhlrsprtappl? Sprite Animation Media Handlerminf [EMAIL PROTECTED] Apple Alias Data Handler$dinfdref alis?stbl,stsdzlibsttsXstscstszstcoe? code?sean emk hjkedtligudta namedrm]udta#?swrMade with LiveStage Proplugmoviename=drm.mov ctypnone play -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] calling static method within class
Hi, Saturday, October 29, 2005, 5:42:15 AM, you wrote: CR If you're expecting the statement CR Echo Foo::getUs(); CR To echo me me it will not because you never returned $us from the CR getUs() method. I'm assuming also that xxx is a variable to mean some CR class library correct? CR Carlo Razzeto CR Programmer CR Mortgage Information Services CR Phone: (216) 514-1025 ex. 1212 CR -Original Message- CR From: blackwater dev [mailto:[EMAIL PROTECTED] CR Sent: Friday, October 28, 2005 1:13 PM CR To: php-general@lists.php.net CR Subject: [PHP] calling static method within class CR I have a class that won't be instantiated...so basically just a bunch CR of static methods. CR How do I call one of the class' static methods from within another CR method? Can't use this, and self doesn't work...this is php4. CR Thanks. CR Class Foo{ CRfunction getMe(){ CR return me; CR } CR function getUs(){ CR$us=xxx::getMe(); CR$us.= me; CR } CR } CR echo Foo::getUs(); Just use the class name Foo::getMe() Class Foo{ function getMe(){ return me; } function getUs(){ $us=Foo::getMe(); $us.= me; } } -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php