[PHP] WDDX and binary data
Despite the fact that PHP's WDDX functions don't support a binary type, most binary data comes through just fine, and in fact, the WDDX serialize function can encode certain types of binary data, such as a null character: char code='00'/ But the deserialize process dos not retain these characters. Is this a bug in PHP's implementation of WDDX, or is there perhaps a workaround available? Here's some example code that shows a WDDX packet of encoded binary data. The packet itself contains all of the binary data, including null characters, etc. The deserialized() string, however, does not. ?php $fp = fopen(http://www.php.net/gifs/php_logo.gif,r;); while (!feof($fp)) { $str .= fread($fp, 4096); } $packet = wddx_serialize_value($str, php_logo.gif); Header(Content-Type: image/gif); $str = wddx_deserialize($packet); echo $str; ? -- /chris/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Storing serialized classes in database
When you serialize() an object in PHP, it only stores the properties, not the methods. This way you can change any of the methods in your class definitions, or add new properties, and when the data is unserialize()d, it will fit into the new class definition. The latest (development) version of Pecos (http://pecos.screwdriver.net/) (which should, incidentally, be released later today or tomorrow) has moved from using entirely serialized() data to having a seperate table for storing properties. Basically, we loop through the object using get_object_vars() and store each property (serialized() only if it was an array or another object) seperately in a seperate field. This approach allows you to search by property rather than having to do a full-text search of the serialize()d data (or even worse, loading up each object and searching through it manually). -- /chris/ On Monday, July 9, 2001, at 10:58 AM, Michael Champagne wrote: We are writing a series of applications which will store a user 'profile' between sessions as a serialized object in our Oracle database. We're storing data like the output format a user prefers file downloads in and things like that. If have to add certain things to this class, I'm assuming the serialized objects in the database become unusable. Does anyone have a good solution for this? I suppose we could go through the database and somehow convert these serialized 'profiles' to meet the new class spec. How much of a hassle is that? Thanks in advance for any responses, Michael Champagne, Software Engineer Capital Institutional Services, Inc. wk: [EMAIL PROTECTED] hm: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Zeev via Babelfish
I quite enjoyed the interview at http://www.dynamicwebpages.de/90.interview-zeev-suraski-linuxtag2001.php translated via babelfish. A tasty morsel: Also the attempt to make PHP the egg-laying woolly milch sow is not my opinion after the actual target for PHP. -- Zeev Suraski (translated from German to English via babelfish) I'm sure that I agree wholeheartedly. Maybe. -- /chris/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Printable Report Generator
If the browser supports CSS, you can define pagebreaks when it is printed. There is an excellent article at: http://www.stars.com/Authoring/Languages/XML/BeginningXHTML/printing.html It won't work in all browsers, but it gets the job done often enough. On Sunday, July 8, 2001, at 10:04 AM, Keyser Soze wrote: Hi!! I'm new on this listand already have a problem :) I need to create a report to send it to printer based on datas from my database.firstly I tried pdf, but it's too hard to manage and it generate big sized archives. Any suggestions There's any way to do it in plain html with line breaks and page breaks?? There's any free tool out there?? Thx, Keyser Soze -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Is there a better way to do this
on 5/16/01 5:10 PM, Richard Kurth at [EMAIL PROTECTED] wrote: Is there a better way to do thisI want it to look and see if the userdata file is there and if true the bypass everything else run rest of code. If is not then check to see if userdat1 is and if it is change it's name to userdata the run rest of code. If none of the are there then gust shut down. if(file_exists(userdata)) { end; } elseif(file_exists(userdata1)) { copy('userdata1','userdata') ; system(rm userdata1); end; } else { exit; } rest of code if (!file_exists(userfile)) { if (file_exists(userdata1) { unlink(userfile1); } else { exit; } } is a bit cleaner. I'd use unlink(userfile1) rather than system(rm userfile1) just to be pretty. -- /chris/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] - Hard return in readfile
on 5/16/01 8:38 PM, Ray Iftikhar at [EMAIL PROTECTED] wrote: I have many text files stored on my server. I call them use using the readfile function. While that works great, it seems to over-write the hard returns. This has hurt the format and readability of my information. ie. text file: This is a test output: This is a test is there someway to get readfile to recognize returns in the file? Thanks in Advance.. Ray Sounds like you are displaying the text as HTML. You can either surround the data with pre tags, or use the nl2br() function to convert each new line to a br tag. -- /chris/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Escaping from
on 5/16/01 9:12 PM, Augusto Cesar Castoldi at [EMAIL PROTECTED] wrote: I'm tring to print the variable tmp, but the echo is just printing abcd, the rest he can't print. Why? regards, Augusto $tmp=abcdefg; echo $tmp.br; echo br; $tmp=addslashes($tmp); echo $tmp.br; echo br; $tmp=stripslashes($tmp); echo $tmp.br; Try htmlspecialchars() instead of addslashes(); $tmp=abcdefg; echo htmlspecialchars($tmp); -- /chris/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Uptime script?
On Wednesday, May 16, 2001, at 09:47 PM, Ryan Christensen wrote: No.. as I said in my original post, this is on Linux.. so I was actually wondering how it would be a risk in Linux.. not win.. If you want to get the current uptime in Linux without a system() call, you should be able to fopen() the /proc/uptime file. The first number is the number of seconds the machine has been up, the second is the number of seconds the machine's processes have been idle. -- /chris/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]