Re: [PHP] fopen
John Taylor-Johnston wrote: It does what I want, but I worry 4096 may not be big enough. Possible? 4096 is the number of bytes fgets() will get, but the fgets() call is inside a while loop which keeps running until the 'filepointer' (as denoted by the handle $dataFile) in question has reached the end of the given file. so if 4096 is not big enough the loop merely grabs another 4096 bytes until its grabbed it all. so actually you have a handy bit of code which will allow you to 'eat' through massive files without the requirement of being able to store the whole file in memory. Is there a way to detect the filesize and insert a value for 4096? filesize() $buffer = fgets($dataFile, $filesize); Is this what it is for? John http://ca3.php.net/fopen $filename = "/var/www/html2/assets/about.htm" ; $dataFile = fopen( $filename, "r" ) ; while (!feof($dataFile)) { $buffer = fgets($dataFile, 4096); echo $buffer; } $sql = "insert into table ... $buffer"; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] zipped files
Hi does any one have code/examples for unzipping a file thats been uploaded to a server. I would prefer a class rather than something that uses zip.lib as it may not be configured on the server. clive -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: fopen
Hi, yes, there could be some problem with your code. But it depends on what are you trying to archieve. If you are trying to put whole file to database, there is no reason to use fgets function. Just use $buffer=file_get_contents($filename); and put the buffer into SQL. No reason to read it line by line using fgets. The whole file will end in memory in the SQL section, so it doesn't matter ho you read it. If you want to process huge file line by line, it's really good idea to not put whole file to memory (using file_get_contents) but to read it line by line using fgets, process every line and forgot it. The file could be very large and you still need only very small memory amount. And there can be problem you are saying. What if there is some line longer than 4096 bytes (or some bigger limit)?? You can solve it simply using code like this: $dataFile = fopen( $filename, "r" ) ; $buffer = ""; while (!feof($dataFile)) { $buffer .= fgets($dataFile, 4096); if (strstr($buffer, "\n") === false && !feof($dataFile)) { // long line continue; } echo $buffer; $buffer = ""; } Petr John Taylor-Johnston wrote: It does what I want, but I worry 4096 may not be big enough. Possible? Is there a way to detect the filesize and insert a value for 4096? $buffer = fgets($dataFile, $filesize); Is this what it is for? John http://ca3.php.net/fopen $filename = "/var/www/html2/assets/about.htm" ; $dataFile = fopen( $filename, "r" ) ; while (!feof($dataFile)) { $buffer = fgets($dataFile, 4096); echo $buffer; } $sql = "insert into table ... $buffer"; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Perl style
Hi guys I would like to convert this .. $tmparray = split(',', $csvstring); $element5 = $tmparray[5]; . to something like this: $element5 = (split(',', $csvstring))[5]; . but I just can't find the correct syntax. It is Perl style - i know, but I just love this syntax. :-) Does anyonw know the correct syntax? -- Regards Søren Schimkat www.schimkat.dk --- www.dyrenes-venner.dk/densorteliste.asp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: zipped files
Try something from here http://www.phpclasses.org/browse/class/42.html Sincerely, Rosty Kerei <[EMAIL PROTECTED]> "Clive" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi > > does any one have code/examples for unzipping a file thats been uploaded > to a server. I would prefer a class rather than something that uses > zip.lib as it may not be configured on the server. > > clive -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] GUID or any other unique IDs
Hello Ben, > While not ideal, you could do a select on a db. MS SQL and MySQL both have > functions to generate unique id's and I imagine the other databases do as > well. While running a "SELECT uuid()" and hitting the database for each > one of these things is annoying, it is one possible pseudo-solution. Finally I have come to the same solution since the generated UUIDs/GUIDs are intended to be saved into a DB after performing some actions. I was also suggested to use a PECL extension for this but I have no idea how to make it work under Win32 (since it uses *nix's libuuid). Many thanks to all contributors! Have a great day, Denis S Gerasimov Web Developer Team Force LLC Web: www.team-force.org RU & Int'l: +7 8362-468693 email:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Perl style
[snip] $tmparray = split(',', $csvstring); $element5 = $tmparray[5]; . to something like this: $element5 = (split(',', $csvstring))[5]; [/snip] The syntax is correct in your first example, AFAIK the PERL syntax you describe cannot be done straight up in PHP unless you write a function to handle it. You could always write a PHP extension. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Perl style
Søren Schimkat wrote: Hi guys I would like to convert this .. $tmparray = split(',', $csvstring); don't use split() here - there is no need for regexp. use explode() instead. $element5 = $tmparray[5]; . to something like this: $element5 = (split(',', $csvstring))[5]; $csvstring = "1,2,3,4,5,6"; echo "route "; // humor me echo $element5 = current(array_reverse(array_slice(explode(",", $csvstring), 0, 6))); echo $element5 = end(array_slice(explode(",", $csvstring), 0, 6)); not as short as perl - unfortunately there is no valid syntax that allows dereferenced access to array elements (AFAIK). . but I just can't find the correct syntax. It is Perl style - i know, but I just love this syntax. :-) Does anyonw know the correct syntax? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Perl style
Simpler(?) approach: $element5 = current(array_splice(split(',',$csvstring),5,1)); This is fun! -Stathis On Wednesday 26 October 2005 17:08, Jochem Maas wrote: > Sψren Schimkat wrote: > > Hi guys > > > > I would like to convert this .. > > > > > > $tmparray = split(',', $csvstring); > > don't use split() here - there is no need for regexp. > use explode() instead. > > > $element5 = $tmparray[5]; > > > > > > . to something like this: > > > > > > $element5 = (split(',', $csvstring))[5]; > > $csvstring = "1,2,3,4,5,6"; > echo "route "; // humor me > echo $element5 = current(array_reverse(array_slice(explode(",", > $csvstring), 0, 6))); echo $element5 = end(array_slice(explode(",", > $csvstring), 0, 6)); > > not as short as perl - unfortunately there is no valid > syntax that allows dereferenced access to array elements (AFAIK). > > > . but I just can't find the correct syntax. It is Perl style - i know, > > but I just love this syntax. :-) > > > > Does anyonw know the correct syntax? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] zipped files
This is the class I use: http://www.phpconcept.net/pclzip/man/en/index.php On 10/26/05, Clive <[EMAIL PROTECTED]> wrote: > > Hi > > does any one have code/examples for unzipping a file thats been uploaded > to a server. I would prefer a class rather than something that uses > zip.lib as it may not be configured on the server. > > clive > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
[PHP] MySql connection error on win XP for script that works on Freebsd 5.3
I have just installed MySql on Win XP and am attempting to run a php script to create some databases. The script works fine on FreeBSD 5.3 running mysql-client-5.0.11 and mysql-server-5.0.11. MySQL has been installed on windows XP using a download of mysql-5.0.13-rc-win32.zip. Test.php reports php version 4.3.1.0 and is installed with ZendStudio which I am currently testing on win XP as I cannot yet get any version of Zend later than 3.x to run on FreeBSD. The username for mysql is 10 chars with a password of 8 chars and is able to login successfully from the command line. However when attempting to login via the script I get the following error: "Error while connecting to MySQL: Client does not support authentication protocol requested by server; consider upgrading MySQL client." I have searched the mysql website and located an article which shows reference to this error indicating that the client may need to be upgraded but as I am using the mysql-5.0.13-rc-win32.zip package I am cautious about assuming that that is the actual cause. I am curious whether it is something to do with the php version. Does anyone know how I can fix this? Please ask for additional information you think might be helpful Thanks in advance david -- 40 yrs navigating and computing in blue waters. English Owner & Captain of British Registered 60' bluewater Ketch S/V Taurus. Currently in San Diego, CA. Sailing bound for Europe via Panama Canal after completing engineroom refit. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySql connection error on win XP for script that works on Freebsd 5.3
[snip] I have searched the mysql website and located an article which shows reference to this error indicating that the client may need to be upgraded but as I am using the mysql-5.0.13-rc-win32.zip package I am cautious about assuming that that is the actual cause. [/snip] http://us3.php.net/mysqli "The mysqli extension allows you to access the functionality provided by MySQL 4.1 and above." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: MySql connection error on win XP for script that works on Freebsd 5.3
Hi See this http://dev.mysql.com/doc/refman/5.0/en/old-client.html Best regards "Vizion" <[EMAIL PROTECTED]> escreveu na mensagem news:[EMAIL PROTECTED] >I have just installed MySql on Win XP and am attempting to run a php script >to > create some databases. The script works fine on FreeBSD 5.3 running > mysql-client-5.0.11 and mysql-server-5.0.11. > > MySQL has been installed on windows XP using a download of > mysql-5.0.13-rc-win32.zip. Test.php reports php version 4.3.1.0 and is > installed with ZendStudio which I am currently testing on win XP as I > cannot > yet get any version of Zend later than 3.x to run on FreeBSD. > > The username for mysql is 10 chars with a password of 8 chars and is able > to > login successfully from the command line. > > However when attempting to login via the script I get the following error: > > "Error while connecting to MySQL: Client does not support authentication > protocol requested by server; consider upgrading MySQL client." > > I have searched the mysql website and located an article which shows > reference > to this error indicating that the client may need to be upgraded but as I > am > using the mysql-5.0.13-rc-win32.zip package I am cautious about assuming > that > that is the actual cause. > > I am curious whether it is something to do with the php version. > > Does anyone know how I can fix this? > > Please ask for additional information you think might be helpful > Thanks in advance > > david > > > -- > 40 yrs navigating and computing in blue waters. > English Owner & Captain of British Registered 60' bluewater Ketch S/V > Taurus. > Currently in San Diego, CA. Sailing bound for Europe via Panama Canal > after > completing engineroom refit. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Decompress a zlib'd string in PHP
How do you decompress a zlib'd string located in a file with php ? I need to dynamically write a password string into a movie file. It appears that in QuickTime movie API, all sprite variables/values are zlib'd inside the movie file So I need to: find the string decompress a zlib'd string inside a file. change its value => password=new_password recompress the new value write the zlib'd string back to the file I'm sure if I can decompress the string, then it will not be too hard to do the rest :) many thanks g -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Decompress a zlib'd string in PHP
On Wed, October 26, 2005 11:07 am, Graham Anderson wrote: > How do you decompress a zlib'd string located in a file with php ? http://www.php.net/zlib > I need to dynamically write a password string into a movie file. > It appears that in QuickTime movie API, all sprite variables/values > are zlib'd inside the movie file There will maybe be references to size of the string in other places in the file that you will need to update... -- 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] Re: Decompress a zlib'd string in PHP
Graham Anderson said the following on 10/26/2005 09:07 AM: I'm sure if I can decompress the string, then it will not be too hard to do the rest :) To decompress the string you'll want gzuncompress. More on zlib & php: http://ca.php.net/manual/en/ref.zlib.php The on-line manual is your friend :-). - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] zipped files
On Wed, October 26, 2005 5:44 am, Clive wrote: > does any one have code/examples for unzipping a file thats been > uploaded > to a server. I would prefer a class rather than something that uses > zip.lib as it may not be configured on the server. $path = "/full/path/to/uploaded/file.zip"; exec("/full/path/to/bin/unzip $path", $output, $error); if ($error){ die("OS Error: $error\n" . nl2br($output)); } $unzipped = str_replace(".zip", '', $path); $file = file_get_contents($unzipped); -- 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] regex and global vars problem
I am having a problem with a couple of function I have written to check for a type of string, attempt to fix it and pass it back to the main function. Any help is appreciated. if( ( eregi( "^[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}$", $mac ) ) || ( !eregi( "^[0-9a-fA-F]$", $mac ) ) { return 0; } else { return 1; } } /* * check validity of MAC & do replacements if necessary */ function fix_mac( $mac ) { global $mac; if( eregi( "^[0-9A-Fa-f-\:]$", $mac ) ) { $mac1 = $mac; echo "MAC: $mac1"; } /* strip the dash & replace with a colon */ if( eregi( "^[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}$", $mac ) ) { $mac1 = preg_replace( "/\-/", ":", $mac ); echo "MAC: $mac1"; } /* add a colon for every two characters */ if( eregi( "^[0-9A-Fa-f]{12}$", $mac ) ) { /* split up the MAC and assign new var names */ @list( $mac_1, $mac_2, $mac_3, $mac_4, $mac_5, $mac_6 ) = @str_split( $mac, 2 ); /* put it back together with the required colons */ $mac1 = $mac_1 . ":" . $mac_2 . ":" . $mac_3 . ":" . $mac_4 . ":" . $mac_5 . ":" . $mac_6; echo "MAC: $mac1"; } return $mac1; } // do our checks to make sure we are using these damn things right $mac1 = "00aa11bb22cc"; $mac2 = "00-aa-11-bb-22-cc"; $mac3 = "00:aa:11:bb:22:cc"; $mac4 = "zz:00:11:22:ff:xx"; if( chk_mac( $mac1 ) != 0 ) { $mac = fix_mac( $mac1 ); echo $mac1 . " converted to " . $mac . ""; } else { echo "$mac1 is valid."; } if( chk_mac( $mac2 ) != 0 ) { $mac = fix_mac( $mac2 ); echo $mac2 . " converted to " . $mac . ""; } else { echo "$mac2 is valid."; } if( chk_mac( $mac3 ) != 0 ) { $mac = fix_mac( $mac3 ); echo $mac3 . " converted to " . $mac . ""; } else { echo "$mac3 is valid."; } if( chk_mac( $mac4 ) != 0 ) { $mac = fix_mac( $mac4 ); echo $mac4 . " converted to " . $mac . ""; } else { echo "$mac4 is valid."; } ?> -- Jason Gerfen "My girlfriend threated to leave me if I went boarding... I will miss her." ~ DIATRIBE aka FBITKK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Decompress a zlib'd string in PHP
Just to show I am not a total leech, I did consult the manual before I posted the question :) The compressor in the file data says: dcomzlib I tried the below with gzinflate and with gzuncompress. Both give errors: gzinflate(): data error gzuncompress(): data error The below is the copy/pasted hex of the compressed movie header in the Quicktime Movie File FYI ,I did not compress the string myself...it is compressed automatically when a Quicktime movie is exported. $compressed = "DE789CB552BF6F133114F65D2852A50A7568E14041B2A00B120CB081549514860CA9545 15431743167E7CE8AED3B9D9D2B65E9D4FF0484F8079810EC8C0C8CFC2BE1D9E7FB91A4A 008C44B7CF67B7EFEDE67BF0FA1B59F32CB4A849090654A61465F2FD21B762014BE72234 0F6DFDA9CB3EC3F6D56F6FC92F520FEC1146402EB133371357B6DCD1AAD3D3B9BAD5E37B 09F07CEDD61D46898FB4C68D39EF0B8EE6CB8262927B0C092FEE6EE080D613C4EA928ECB E4C4561D81B43F2FC914309822FD120CF05C32F218C0F1800E2215154303810BC935C8D2 171944857204A2050B19D39F3C4EE5BD0151FB62143810C115C0319B15991F9EEC90C042 71A3F27A64306EDD08A4C9F166CDC29B16141FCFA9336AF05CC2FB4D1B493B3EF082ED09 ABB42659BB6BF16B372AF264CB1D23E318AB471FDA811EA5EF4A1523C1F6FC616ECBDF57 B7B6D2CCEDAFCF007CCBB7146D9C2E3DDD38CA80E96B5ED098862F1616F4DA9B10CAF292 299EBE2C36A234CFE20D3D0E734323DFF3B99462223B4835567AF20DFE0FD8AF27DD2956 FC929F38A0188E0F3CD4A31C710CE96F4FBCCEB77ABACF41B7474FB5F75F8CDEB70BCA0C 3E302501B1F7EB668E55E818780B60CFDA55DC6FA4071490CCF14BADCB0BBCABF6AF336B A549BBD6D98EF78795DB7F21A1D1DE27D124F92229BAAFA5E273EE3EE477D5A2068DE01A 10C9F7293E2112FD9912109C38785058E72314D64567266D17653809256F81BB139CB55A 6EC7A3D17E4CC01FF027425F9B1"; $string = pack("H*", $compressed); $uncompressed = gzinflate($string); //$uncompressed = gzuncompress($string); echo $uncompressed; ?> On Oct 26, 2005, at 10:20 AM, Jochem Maas wrote: Graham Anderson wrote: How do you decompress a zlib'd string located in a file with php ? I need to dynamically write a password string into a movie file. It appears that in QuickTime movie API, all sprite variables/ values are zlib'd inside the movie file So I need to: find the string decompress a zlib'd string inside a file. change its value => password=new_password recompress the new value write the zlib'd string back to the file I'm sure if I can decompress the string, then it will not be too hard to do the rest :) I'm sure if you spent 5 seconds searching the manual you would find this page: http://php.net/manual/en/function.gzuncompress.php and this one: http://php.net/manual/en/function.gzcompress.php (HINT: I typed http://php.net/zlib into the address bar to find them) 'the rest' involves find your substring's beginning and ending offset and then using those values to 'splice' the new substring (aka password) into the file/stream, I can visualize how ot do it but have never actually needed to do something like that ... I would say the compress/decompress is the easier part personally ... buy hey as long as you get it working :-) many thanks back at ya, I learnt some stuff answering (hopefully) you question ;-) g -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Decompress a zlib'd string in PHP
Graham Anderson wrote: How do you decompress a zlib'd string located in a file with php ? I need to dynamically write a password string into a movie file. It appears that in QuickTime movie API, all sprite variables/values are zlib'd inside the movie file So I need to: find the string decompress a zlib'd string inside a file. change its value => password=new_password recompress the new value write the zlib'd string back to the file I'm sure if I can decompress the string, then it will not be too hard to do the rest :) I'm sure if you spent 5 seconds searching the manual you would find this page: http://php.net/manual/en/function.gzuncompress.php and this one: http://php.net/manual/en/function.gzcompress.php (HINT: I typed http://php.net/zlib into the address bar to find them) 'the rest' involves find your substring's beginning and ending offset and then using those values to 'splice' the new substring (aka password) into the file/stream, I can visualize how ot do it but have never actually needed to do something like that ... I would say the compress/decompress is the easier part personally ... buy hey as long as you get it working :-) many thanks back at ya, I learnt some stuff answering (hopefully) you question ;-) g -- 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 Wed, 2005-10-26 at 11:15 -0600, Jason Gerfen wrote: > I am having a problem with a couple of function I have written to check > for a type of string, attempt to fix it and pass it back to the main > function. Any help is appreciated. [snip] Would you mind telling us what the problem was? -- Jasper Bryant-Greene General Manager Album Limited e: [EMAIL PROTECTED] w: http://www.album.co.nz/ p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 a: PO Box 579, Christchurch 8015, New Zealand -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex and global vars problem
Um I did actually, but I will re-interate the problem with more detail. the vars $mac1, $mac2, & $mac3 are to get passed to the chk_mac() function which determines if it is a valid hex representation of a h/w address, if it does not meet the criteria of having a ":" separating every two characters it then passes the var to the fix_mac() function which attempts to fix the string or h/w address by either replacing any "-" with a ":" or to break the h/w address up and insert a ":" every two characters. I also believe this is the one you should be playing with as the last post I added a new regex which wasn't working. Any help is appreciated. if( ( eregi( "^[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}$", $mac ) ) { return 0; } else { return 1; } } /* * check validity of MAC & do replacements if necessary */ function fix_mac( $mac ) { global $mac; if( eregi( "^[0-9A-Fa-f-\:]$", $mac ) ) { $mac1 = $mac; echo "MAC: $mac1"; } /* strip the dash & replace with a colon */ if( eregi( "^[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}$", $mac ) ) { $mac1 = preg_replace( "/\-/", ":", $mac ); echo "MAC: $mac1"; } /* add a colon for every two characters */ if( eregi( "^[0-9A-Fa-f]{12}$", $mac ) ) { /* split up the MAC and assign new var names */ @list( $mac_1, $mac_2, $mac_3, $mac_4, $mac_5, $mac_6 ) = @str_split( $mac, 2 ); /* put it back together with the required colons */ $mac1 = $mac_1 . ":" . $mac_2 . ":" . $mac_3 . ":" . $mac_4 . ":" . $mac_5 . ":" . $mac_6; echo "MAC: $mac1"; } return $mac1; } // do our checks to make sure we are using these damn things right $mac1 = "00aa11bb22cc"; $mac2 = "00-aa-11-bb-22-cc"; $mac3 = "00:aa:11:bb:22:cc"; $mac4 = "zz:00:11:22:ff:xx"; if( chk_mac( $mac1 ) != 0 ) { $mac = fix_mac( $mac1 ); echo $mac1 . " converted to " . $mac . ""; } else { echo "$mac1 is valid."; } if( chk_mac( $mac2 ) != 0 ) { $mac = fix_mac( $mac2 ); echo $mac2 . " converted to " . $mac . ""; } else { echo "$mac2 is valid."; } if( chk_mac( $mac3 ) != 0 ) { $mac = fix_mac( $mac3 ); echo $mac3 . " converted to " . $mac . ""; } else { echo "$mac3 is valid."; } if( chk_mac( $mac4 ) != 0 ) { $mac = fix_mac( $mac4 ); echo $mac4 . " converted to " . $mac . ""; } else { echo "$mac4 is valid."; } ?> Jasper Bryant-Greene wrote: On Wed, 2005-10-26 at 11:15 -0600, Jason Gerfen wrote: I am having a problem with a couple of function I have written to check for a type of string, attempt to fix it and pass it back to the main function. Any help is appreciated. [snip] Would you mind telling us what the problem was? -- Jason Gerfen "My girlfriend threated to leave me if I went boarding... I will miss her." ~ DIATRIBE aka FBITKK -- 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 Wed, 2005-10-26 at 12:07 -0600, Jason Gerfen wrote: > Um I did actually, but I will re-interate the problem with more detail. > > the vars $mac1, $mac2, & $mac3 are to get passed to the chk_mac() > function which determines if it is a valid hex representation of a h/w > address, if it does not meet the criteria of having a ":" separating > every two characters it then passes the var to the fix_mac() function > which attempts to fix the string or h/w address by either replacing any > "-" with a ":" or to break the h/w address up and insert a ":" every two > characters. I also believe this is the one you should be playing with > as the last post I added a new regex which wasn't working. OK, you've told us what your code does. Now can you explain what the problem is? "A new regex which wasn't working" is a bit vague. * Does it throw an error? - If so, can we have the error message? * Does it mark invalid strings as valid? - Or vice versa? Just posting a pile of code with an explanation of what it does and leaving the rest of us to figure out what the problem is, is not helping us to help you. -- Jasper Bryant-Greene General Manager Album Limited e: [EMAIL PROTECTED] w: http://www.album.co.nz/ p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 a: PO Box 579, Christchurch 8015, New Zealand -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex and global vars problem
The code I just showed you is supposed to do the following, the chk_mac() returns a true or false on the vars $mac1, $mac2 and $mac3. $mac3 is the only var that should not be thrown into the fix_mac() function which is working correctly. The problem is when $mac1 and $mac2 get put into the fix_mac() function nothing is being returned. I am not recieving any error codes, just an empty var. Sample output: 00aa11bb22cc converted to 00-aa-11-bb-22-cc converted to 00:aa:11:bb:22:cc is valid. As you can see $mac3 is a valid example of a h/w address where $mac1 & $mac2 were returned from the fix_mac() function as an empty string. Jasper Bryant-Greene wrote: On Wed, 2005-10-26 at 12:07 -0600, Jason Gerfen wrote: Um I did actually, but I will re-interate the problem with more detail. the vars $mac1, $mac2, & $mac3 are to get passed to the chk_mac() function which determines if it is a valid hex representation of a h/w address, if it does not meet the criteria of having a ":" separating every two characters it then passes the var to the fix_mac() function which attempts to fix the string or h/w address by either replacing any "-" with a ":" or to break the h/w address up and insert a ":" every two characters. I also believe this is the one you should be playing with as the last post I added a new regex which wasn't working. OK, you've told us what your code does. Now can you explain what the problem is? "A new regex which wasn't working" is a bit vague. * Does it throw an error? - If so, can we have the error message? * Does it mark invalid strings as valid? - Or vice versa? Just posting a pile of code with an explanation of what it does and leaving the rest of us to figure out what the problem is, is not helping us to help you. -- Jason Gerfen "My girlfriend threated to leave me if I went boarding... I will miss her." ~ DIATRIBE aka FBITKK -- 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 Wed, 2005-10-26 at 12:24 -0600, Jason Gerfen wrote: > The code I just showed you is supposed to do the following, the > chk_mac() returns a true or false on the vars $mac1, $mac2 and $mac3. > $mac3 is the only var that should not be thrown into the fix_mac() > function which is working correctly. The problem is when $mac1 and > $mac2 get put into the fix_mac() function nothing is being returned. > > I am not recieving any error codes, just an empty var. > > Sample output: > > 00aa11bb22cc converted to > 00-aa-11-bb-22-cc converted to > 00:aa:11:bb:22:cc is valid. > > As you can see $mac3 is a valid example of a h/w address where $mac1 & > $mac2 were returned from the fix_mac() function as an empty string. OK, thanks for that. I've rewritten your function below in much cleaner code. Some of the situations you've used regexps in, string functions would work fine. They're also much faster. The below function works fine in my testing. I removed the special-case for a valid MAC address at the start since your regexp was throwing errors and there was no need since you already checked if it was valid with chk_mac() (which by the way should return true or false, not 1 or 0, but meh). -- Jasper Bryant-Greene General Manager Album Limited e: [EMAIL PROTECTED] w: http://www.album.co.nz/ p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 a: PO Box 579, Christchurch 8015, New Zealand -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] str_split() and errors?
I am recieving this error in the logs when attempting to split strings with str_split(). I am not sure but isn't this a default function for PHP, as in there aren't any dependant packages involved during the ./confgure time? Errors: PHP Fatal error: Call to undefined function: str_split() in file.php on line 21 -- Jason Gerfen "My girlfriend threated to leave me if I went boarding... I will miss her." ~ DIATRIBE aka FBITKK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Decompress a zlib'd string in PHP
Graham Anderson wrote: Just to show I am not a total leech, I did consult the manual before I posted the question :) ack. The compressor in the file data says: dcomzlib I tried the below with gzinflate and with gzuncompress. Both give errors: gzinflate(): data error gzuncompress(): data error The below is the copy/pasted hex of the compressed movie header in the Quicktime Movie File FYI ,I did not compress the string myself...it is compressed automatically when a Quicktime movie is exported. $compressed = "DE789CB552BF6F133114F65D2852A50A7568E14041B2A00B120CB081549514860CA9545 15431743167E7CE8AED3B9D9D2B65E9D4FF0484F8079810EC8C0C8CFC2BE1D9E7FB91A4A 008C44B7CF67B7EFEDE67BF0FA1B59F32CB4A849090654A61465F2FD21B762014BE72234 0F6DFDA9CB3EC3F6D56F6FC92F520FEC1146402EB133371357B6DCD1AAD3D3B9BAD5E37B 09F07CEDD61D46898FB4C68D39EF0B8EE6CB8262927B0C092FEE6EE080D613C4EA928ECB E4C4561D81B43F2FC914309822FD120CF05C32F218C0F1800E2215154303810BC935C8D2 171944857204A2050B19D39F3C4EE5BD0151FB62143810C115C0319B15991F9EEC90C042 71A3F27A64306EDD08A4C9F166CDC29B16141FCFA9336AF05CC2FB4D1B493B3EF082ED09 ABB42659BB6BF16B372AF264CB1D23E318AB471FDA811EA5EF4A1523C1F6FC616ECBDF57 B7B6D2CCEDAFCF007CCBB7146D9C2E3DDD38CA80E96B5ED098862F1616F4DA9B10CAF292 299EBE2C36A234CFE20D3D0E734323DFF3B99462223B4835567AF20DFE0FD8AF27DD2956 FC929F38A0188E0F3CD4A31C710CE96F4FBCCEB77ABACF41B7474FB5F75F8CDEB70BCA0C 3E302501B1F7EB668E55E818780B60CFDA55DC6FA4071490CCF14BADCB0BBCABF6AF336B A549BBD6D98EF78795DB7F21A1D1DE27D124F92229BAAFA5E273EE3EE477D5A2068DE01A 10C9F7293E2112FD9912109C38785058E72314D64567266D17653809256F81BB139CB55A 6EC7A3D17E4CC01FF027425F9B1"; $string = pack("H*", $compressed); ok I don't understand pack() very well at all, but why are you using it here? as far as I can tell gzinflate()/gzuncompress() don't work on binary strings. what happens is you don't use pack()? $uncompressed = gzinflate($string); //$uncompressed = gzuncompress($string); echo $uncompressed; ?> On Oct 26, 2005, at 10:20 AM, Jochem Maas wrote: Graham Anderson wrote: How do you decompress a zlib'd string located in a file with php ? I need to dynamically write a password string into a movie file. It appears that in QuickTime movie API, all sprite variables/ values are zlib'd inside the movie file So I need to: find the string decompress a zlib'd string inside a file. change its value => password=new_password recompress the new value write the zlib'd string back to the file I'm sure if I can decompress the string, then it will not be too hard to do the rest :) I'm sure if you spent 5 seconds searching the manual you would find this page: http://php.net/manual/en/function.gzuncompress.php and this one: http://php.net/manual/en/function.gzcompress.php (HINT: I typed http://php.net/zlib into the address bar to find them) 'the rest' involves find your substring's beginning and ending offset and then using those values to 'splice' the new substring (aka password) into the file/stream, I can visualize how ot do it but have never actually needed to do something like that ... I would say the compress/decompress is the easier part personally ... buy hey as long as you get it working :-) many thanks back at ya, I learnt some stuff answering (hopefully) you question ;-) g -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: str_split() and errors?
Jason Gerfen said the following on 10/26/2005 12:12 PM: I am recieving this error in the logs when attempting to split strings with str_split(). I am not sure but isn't this a default function for PHP, as in there aren't any dependant packages involved during the ./confgure time? Errors: PHP Fatal error: Call to undefined function: str_split() in file.php on line 21 Did you read the second comment on the str_split manual page? I suspect you're using php4. http://ca.php.net/manual/en/function.str-split.php - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Decompress a zlib'd string in PHP
If I remove pack, I get the error: gzuncompress(): data error $uncompressed = gzuncompress($the_string); echo $uncompressed; in my hex editor, the movie header contains: ftypqt qt Pmoov Hcmov dcomzlib 4cmvd From the Quicktime Docs, 'dcomzlib' is supposed to be the compression method for the below string: fixúµRøo1ˆ](R• [EMAIL PROTECTED]∞ÅTïÜ©TQT1t1gÁŒäÌ;ùù+eÈ‘ˇÑ¯òÏåå¸+·ŸÁ˚맆ƒK|ˆ{~˛figø° ...and so on has anyone had experience with this ? g On Oct 26, 2005, at 12:15 PM, Jochem Maas wrote: Graham Anderson wrote: Just to show I am not a total leech, I did consult the manual before I posted the question :) ack. The compressor in the file data says: dcomzlib I tried the below with gzinflate and with gzuncompress. Both give errors: gzinflate(): data error gzuncompress(): data error The below is the copy/pasted hex of the compressed movie header in the Quicktime Movie File FYI ,I did not compress the string myself...it is compressed automatically when a Quicktime movie is exported. $compressed = "DE789CB552BF6F133114F65D2852A50A7568E14041B2A00B120CB081549514860CA9 545 15431743167E7CE8AED3B9D9D2B65E9D4FF0484F8079810EC8C0C8CFC2BE1D9E7FB91 A4A 008C44B7CF67B7EFEDE67BF0FA1B59F32CB4A849090654A61465F2FD21B762014BE72 234 0F6DFDA9CB3EC3F6D56F6FC92F520FEC1146402EB133371357B6DCD1AAD3D3B9BAD5E 37B 09F07CEDD61D46898FB4C68D39EF0B8EE6CB8262927B0C092FEE6EE080D613C4EA928 ECB E4C4561D81B43F2FC914309822FD120CF05C32F218C0F1800E2215154303810BC935C 8D2 171944857204A2050B19D39F3C4EE5BD0151FB62143810C115C0319B15991F9EEC90C 042 71A3F27A64306EDD08A4C9F166CDC29B16141FCFA9336AF05CC2FB4D1B493B3EF082E D09 ABB42659BB6BF16B372AF264CB1D23E318AB471FDA811EA5EF4A1523C1F6FC616ECBD F57 B7B6D2CCEDAFCF007CCBB7146D9C2E3DDD38CA80E96B5ED098862F1616F4DA9B10CAF 292 299EBE2C36A234CFE20D3D0E734323DFF3B99462223B4835567AF20DFE0FD8AF27DD2 956 FC929F38A0188E0F3CD4A31C710CE96F4FBCCEB77ABACF41B7474FB5F75F8CDEB70BC A0C 3E302501B1F7EB668E55E818780B60CFDA55DC6FA4071490CCF14BADCB0BBCABF6AF3 36B A549BBD6D98EF78795DB7F21A1D1DE27D124F92229BAAFA5E273EE3EE477D5A2068DE 01A 10C9F7293E2112FD9912109C38785058E72314D64567266D17653809256F81BB139CB 55A 6EC7A3D17E4CC01FF027425F9B1"; $string = pack("H*", $compressed); ok I don't understand pack() very well at all, but why are you using it here? as far as I can tell gzinflate()/gzuncompress() don't work on binary strings. what happens is you don't use pack()? $uncompressed = gzinflate($string); //$uncompressed = gzuncompress($string); echo $uncompressed; ?> On Oct 26, 2005, at 10:20 AM, Jochem Maas wrote: Graham Anderson wrote: How do you decompress a zlib'd string located in a file with php ? I need to dynamically write a password string into a movie file. It appears that in QuickTime movie API, all sprite variables/ values are zlib'd inside the movie file So I need to: find the string decompress a zlib'd string inside a file. change its value => password=new_password recompress the new value write the zlib'd string back to the file I'm sure if I can decompress the string, then it will not be too hard to do the rest :) I'm sure if you spent 5 seconds searching the manual you would find this page: http://php.net/manual/en/function.gzuncompress.php and this one: http://php.net/manual/en/function.gzcompress.php (HINT: I typed http://php.net/zlib into the address bar to find them) 'the rest' involves find your substring's beginning and ending offset and then using those values to 'splice' the new substring (aka password) into the file/stream, I can visualize how ot do it but have never actually needed to do something like that ... I would say the compress/decompress is the easier part personally ... buy hey as long as you get it working :-) many thanks back at ya, I learnt some stuff answering (hopefully) you question ;-) g -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex and global vars problem
gonna jump on your thread there Jasper, I would like to comment on your function and ask you a question: which is 'better' (for what), preg_*() or ereg[i]*()? Jasper Bryant-Greene wrote: On Wed, 2005-10-26 at 12:24 -0600, Jason Gerfen wrote: The code I just showed you is supposed to do the following, the chk_mac() returns a true or false on the vars $mac1, $mac2 and $mac3. $mac3 is the only var that should not be thrown into the fix_mac() function which is working correctly. The problem is when $mac1 and $mac2 get put into the fix_mac() function nothing is being returned. I am not recieving any error codes, just an empty var. Sample output: 00aa11bb22cc converted to 00-aa-11-bb-22-cc converted to 00:aa:11:bb:22:cc is valid. As you can see $mac3 is a valid example of a h/w address where $mac1 & $mac2 were returned from the fix_mac() function as an empty string. OK, thanks for that. I've rewritten your function below in much cleaner code. Some of the situations you've used regexps in, string functions would work fine. They're also much faster. The below function works fine in my testing. I removed the special-case for a valid MAC address at the start since your regexp was throwing errors and there was no need since you already checked if it was valid with chk_mac() (which by the way should return true or false, not 1 or 0, but meh). this string concatenation looks a bit naff. although on second thoughts I can see why you did it this way. down to personal choice :-). the use of double quotes means strictly speaking you should be escaping the backslash and dollar sign (and the parentheseses?) although i would recommend single quotes. I would have used preg_match(), something like (I'm using double quotes because of the php -r '' btw :-): php -r ' $d = "([0-9A-Fa-f]{2})"; $q = "{$d}[\\-:]?"; $re = "#^{$q}{$q}{$q}{$q}{$q}{$d}\$#"; foreach(array("900030ABAB0C", "90-00-30-AB-AB-0C", "90:00:30:AB:AB:0C", "90-00-30:AB:AB-0C", "90:JJ:30:AB:AB-0C") as $str) { $matches = array(); if (preg_match($re, $str, $matches)) { $mac = join(":", array_slice($matches, 1)); echo "good mac: $mac\n"; } else { echo "bad mac: $str\n"; } } // and as a function: function getMAC($str) { static $re; if (!isset($re)) { $d = "([0-9A-Fa-f]{2})"; $q = "{$d}[\\-:]?"; $re = "#^{$q}{$q}{$q}{$q}{$q}{$d}\$#"; } return (preg_match($re, $str, $matches)) ? join(":", array_slice($matches, 1)) : null; } foreach(array("900030ABAB0C", "90-00-30-AB-AB-0C", "90:00:30:AB:AB:0C", "90-00-30:AB:AB-0C", "90:JJ:30:AB:AB-0C") as $str) { if ($mac = getMAC($str)) { echo "good mac: $mac\n"; } else { echo "bad mac: $str\n"; } } ' $mac ) ) { $mac_final = str_replace( '-', ':', $mac ); } else if( eregi( "^[0-9A-Fa-f]{12}$", $mac ) ) { $mac_array = str_split( $mac, 2 ); $mac_final = implode( ':', $mac_array ); } else { return false; } echo "MAC: $mac_final"; return $mac_final; white space is nice but too many blank lines lead to overscroll ;-) } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: str_split() and errors?
If you want to use this function in PHP4, you can use the PEAR package PHP_Compat from http://pear.php.net/ On Wed, 2005-10-26 at 12:19 -0700, Ben wrote: > Jason Gerfen said the following on 10/26/2005 12:12 PM: > > I am recieving this error in the logs when attempting to split strings > > with str_split(). I am not sure but isn't this a default function for > > PHP, as in there aren't any dependant packages involved during the > > ./confgure time? > > > > Errors: > > PHP Fatal error: Call to undefined function: str_split() in file.php > > on line 21 > > > > Did you read the second comment on the str_split manual page? I suspect > you're using php4. > > http://ca.php.net/manual/en/function.str-split.php > > - Ben > -- === James T. Richardson, Jr. eXcellence in IS Solutions, Inc. [EMAIL PROTECTED] --- Office: 713-862-9200 Voicemail: 713-339-7226 Fax: 713-586-3224 === -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Windows XP installation confusion.
Hi In Install.text for php 5.0.5 on Page 3: Heading Manual Installation Steps "Previous editions of the manual suggest moving various ini and DLL files into your SYSTEM folder..we advise remove all these files (like php.ini and PHP related DLLs from the Windows System folder..." While some files in the Windows folder are clearly php related in that they are of the form php*.* other files are not so easily distinguished. I wonder if someone has a list of the files that should be deleted bearing in mind I have just removed an installation of php 4.3.10 and php 5.0.5. I would like to make sure that the windows system32 folder is clean! It would be nice if such a list was added to install.txt thanks david -- 40 yrs navigating and computing in blue waters. English Owner & Captain of British Registered 60' bluewater Ketch S/V Taurus. Currently in San Diego, CA. Sailing bound for Europe via Panama Canal after completing engineroom refit. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySql connection error on win XP for script that works on Freebsd 5.3
On Wednesday 26 October 2005 08:35, the author Jay Blanchard contributed to the dialogue on- RE: [PHP] MySql connection error on win XP for script that works on Freebsd 5.3: >[snip] >I have searched the mysql website and located an article which shows >reference >to this error indicating that the client may need to be upgraded but as I am > >using the mysql-5.0.13-rc-win32.zip package I am cautious about assuming >that >that is the actual cause. >[/snip] > >http://us3.php.net/mysqli > >"The mysqli extension allows you to access the functionality provided by >MySQL 4.1 and above." Thanks for that -- I have decided to upgrade to 5.0.5 - I did see that file before posting but I think I must have got the wrong impression on first read thanks again david -- 40 yrs navigating and computing in blue waters. English Owner & Captain of British Registered 60' bluewater Ketch S/V Taurus. Currently in San Diego, CA. Sailing bound for Europe via Panama Canal after completing engineroom refit. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Windows XP installation confusion.
On Wed, October 26, 2005 6:42 pm, Vizion wrote: > your SYSTEM folder..we advise remove all these files (like php.ini > and > PHP related DLLs from the Windows System folder..." > I wonder if someone has a list of the files that should be deleted > bearing in > mind I have just removed an installation of php 4.3.10 and php 5.0.5. > I would > like to make sure that the windows system32 folder is clean! It would > be nice > if such a list was added to install.txt If all else fails, you could just download the PHP .zip files and open them up, without un-zipping, and see the list of files. Errrm, not in that wack wizard mode, but classic mode of WinZip. -- 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] str_split() and errors?
On Wed, October 26, 2005 2:12 pm, Jason Gerfen wrote: > I am recieving this error in the logs when attempting to split strings > with str_split(). I am not sure but isn't this a default function for > PHP, as in there aren't any dependant packages involved during the > ./confgure time? > > Errors: > PHP Fatal error: Call to undefined function: str_split() in file.php > on line 21 The (PHP 5) notion near the top of this page: http://php.net/str_split was intended to inform you that it was added in, and is available only in, PHP 5 and later. There may be a backwards-compatible function written in code in PECL or PEAR. The User-Contributed notes at the above link may also have a function to duplicate functionality in earlier versions. Or you could upgrade, of course. And, of course, in future you'll know to check the version info in the manual so you'll know right off what's going on. It's a VERY nice feature of the on-line manual, I must say. -- 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] Decompress a zlib'd string in PHP
On Wed, October 26, 2005 12:34 pm, Graham Anderson wrote: > The compressor in the file data says: dcomzlib Okay, now we are getting somewhere. dcomzlib is, most likely, not the same as zlib. > I tried the below with gzinflate and with gzuncompress. > Both give errors: > gzinflate(): data error > gzuncompress(): data error And this pretty much clinches it, mostly, assuming you passed in the right data. "DE789CB552BF6F133114F65D2852A50A7568E14041B2A00B120CB081549514860CA9545 And this is just "data" with not much we can do to guess about its format. However, I surfed to http://info.com/dcomzlib and the very first link (also the only one in English) was to: http://sourceforge.net/mailarchive/forum.php?forum_id=9050&max_rows=25&style=nested&viewmonth=200205 where somebody pretty much tells you how to decompress this, I think. (I didn't read the WHOLE thing, mind you) S/He also raises the question of the legality of doing this, which you may also wish to consider before proceeding. -- 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] Re: moving website from windows to linux hosting
pedro mpa schrieb: > (Like changing directory paths from \ to / ). Ahem... shouldn't you havee used "/" on the Windows machine, too? The "\" comes from the DOS era of the Windows OS, but the "/" is the world standard and Windows Servers perfectly work with "/". Even the Windows explorer is able to translate "/" to "\". OLLi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Decompress a zlib'd string in PHP
Hi Richard :) Looks like all he did was change a couple of atoms names...BEFORE the compressed movie header stuff :( All in all is all pretty basic stuff. I am more interested in what comes AFTER dcomzlib. Quicktime automatically decompressed the movie header when it plays a file, so there has to be way to decompress it? As far as legality, I am hacking my own files :) Ultimately, I want to write a password variable into the Quicktime file My hope is that all movie variables are also compressed with dcomzlib...as they are no where to be found by looking at the hex :( If I can find the variables, then I can rewrite them :) I know several members of the Quicktime Engineering team, and no one has made a peep. But, they will not tell me the answer either ;) Maybe they are waiting to sue me the moment I figure it out ;) Here is a 'test' movie I created: These two examples are the SAME file...One has a compressed movie header. The other is uncompressed So...one has dcomzlib, and one is not Uncompressed Movie Header: ftypqt qt fimoov lmvhdøÜ bøÜ [EMAIL PROTECTED] ßtrak \tkhd øÜ bøÜ [EMAIL PROTECTED]@ - $edts elst X mdia mdhdøÜ bøÜ b X X H 9hdlrmhlrtextapp2 æApple Text Media [EMAIL PROTECTED],text Compressed Movie Header ftypqt qt Pmoov Hcmov dcomzlib 4cmvd fixúµRøo1ˆ](R•Ç:¥p† Y–[EMAIL PROTECTED] CÜT™(™∫ò≥sg≈ˆùŒŒïva„/!˛&;##ˇJxˆ˘~$)(Òü˝ûüø˜=˚ChÌßÃ≤!$dôRò— ◊∑W§Ö/›ê˝∑6Á,˚{Õ û_≤ƒ?òÇL`}b&ÆfØ≠Y£µgg≥’Έsflπ;å süm⁄◊ù ◊$ÂX“flÙé–∆£îä¬ÓÀTÜΩ6$œ:î ¯ Ú\0¸¬¯Ä EÉ¡;[EMAIL PROTECTED]:d– ≠»Ùi¡∆ùƒØ?iÛJ¿¸\M;9˚é‡≠π*€¥Ôk1+˜r¬+Ì£H˜5B˝}®œ«õ± {Á~ÔIã≥6?¸ÛnúQ∂pyw5#™Éem{¢XºÿõSj,√´äHÊ^ does this provide any clues ? g Hi, On the MPlayer samples FTP, there is an example of a MOV file that is presumably "protected" in: ftp://ftp.mplayerhq.hu/MPlayer/samples/MOV/protected_mov/ Has anyone looked closely at the file? I was trying to figure out what was protected about it. The first 32 bytes are: 00 00 22 B6 68 24 2E 6D 00 00 22 AE 62 30 72 29 ..".h$.m..".b0r) 00 00 00 0C 64 63 6F 6D 7A 6C 69 62 00 00 22 9A dcomzlib..". The "dcomzlib" tag looks familiar. I had a hunch and changed a few of the bytes to: 00 00 22 B6 6D 6F 6F 76 00 00 22 AE 63 6D 6F 76 ..".moov..".cmov 00 00 00 0C 64 63 6F 6D 7A 6C 69 62 00 00 22 9A dcomzlib..". And then I was able to parse the file with a custom QT parser I assembled: On Oct 26, 2005, at 7:53 PM, Richard Lynch wrote: On Wed, October 26, 2005 12:34 pm, Graham Anderson wrote: The compressor in the file data says: dcomzlib Okay, now we are getting somewhere. dcomzlib is, most likely, not the same as zlib. I tried the below with gzinflate and with gzuncompress. Both give errors: gzinflate(): data error gzuncompress(): data error And this pretty much clinches it, mostly, assuming you passed in the right data. "DE789CB552BF6F133114F65D2852A50A7568E14041B2A00B120CB081549514860CA95 45 And this is just "data" with not much we can do to guess about its format. However, I surfed to http://info.com/dcomzlib and the very first link (also the only one in English) was to: http://sourceforge.net/mailarchive/forum.php? forum_id=9050&max_rows=25&style=nested&viewmonth=200205 where somebody pretty much tells you how to decompress this, I think. (I didn't read the WHOLE thing, mind you) S/He also raises the question of the legality of doing this, which you may also wish to consider before proceeding. -- 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