php-general Digest 11 Feb 2011 09:54:40 -0000 Issue 7176
php-general Digest 11 Feb 2011 09:54:40 - Issue 7176 Topics (messages 311241 through 311244): Re: Turning off magic_quotes_gpc? 311241 by: Bob McConnell 311242 by: knl.bitflop.com ob_flush, does it cause data to be sent over the wire immediately? 311243 by: Tolas Anon Bar Charts in PDFs 311244 by: Tom Barrett Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- From: Michael Stroh I'm maintaining various php scripts on a server that was originally configured to have magic_quotes_gpc turned on. The installed php version is 5.2.6. I've read that magic_quotes_gpc is deprecated in 5.3 and continuing to use it is highly discouraged. I've ran into a few fields that I believe this is causing issues with so I'm considering turning it off but am wondering what steps should I take to make sure that nothing breaks and what should I look out for? Also, is it still a good idea to turn off since this installation isn't yet at 5.3? It's a good idea to turn it off as soon as possible. However, you need to test your site to make sure it won't broke something first. There is a way to undo the results of magic quotes. We have implemented it on a number of sites so that we won't care when it gets turned off. Early in the script we have the following code: // If magic quotes is on, we want to remove slashes if (get_magic_quotes_gpc()) { // Magic quotes is on $response = stripslashes($_GET[$key]); } Bob McConnell ---End Message--- ---BeginMessage--- On Thu, 10 Feb 2011 14:52:26 -0500 Bob McConnell r...@cbord.com wrote: It's a good idea to turn it off as soon as possible. However, you need to test your site to make sure it won't broke something first. You have to test not only your site, but also the data that possible lies in the database, if any. There is a way to undo the results of magic quotes. We have implemented it on a number of sites so that we won't care when it gets turned off. Early in the script we have the following code: // If magic quotes is on, we want to remove slashes if (get_magic_quotes_gpc()) { // Magic quotes is on $response = stripslashes($_GET[$key]); } Many people use this approach or something similar and when you use that from the beginning of production, it's not a problem. If however you are going to turn Magic Quotes off while running a production system where it was previously turned on, you might run into problems. Don't trust this method blindly. You have to remember that stripslashes will only remove a single slash. If, for some reason, data has been pulled out, updated, and re-inserted it may contain several slashes (because each time Magic Quotes will add a new slash). If you are turning off Magic Quotes on a system that has been running with Magic Quotes on, you have to inspect the data manually to be safe. --- Kind regards Kim N. Lesmer Programmer/Unix systemadministrator Web: www.bitflop.com E-mail : k...@bitflop.com ---End Message--- ---BeginMessage--- Hi.. For my curl_exec problem, http://readlist.com/lists/lists.php.net/php-general/16/81195.html http://curl.haxx.se/mail/lib-2011-02/0101.html I need to know if this simple test will cause data to be sent every 25 seconds _over the wire_. ?php set_time_limit (0); error_reporting (E_ALL); for ($i=0; $i((3600+1800)/25); $i++) { echo '.'; ob_flush(); sleep (25); }; echo wanted-data; ? reason; i just can't get my media import routines that only send sporadic status messages to work for big video files. ---End Message--- ---BeginMessage--- Hi I need to generate some PDF reports (1000s). Part of the report is a set of bar charts (the results of a questionnaire). Each question has the same 5 answers (v.bad, bad, ok ,good, v.good) and the chart is the % distribution of the answers. My plan is to create a HTML version, using some graph drawing* (saving a copy of the HTML to disk), creating a PDF version using html2pdf (saving a copy to disk and emailing to the recipient). I think html2pdf can handle this. But I have not had much success finding something to draw my graphs. Any (free) simple libraries out there I could be pointed towards? Thanks! Tom ---End Message---
[PHP] Bar Charts in PDFs
Hi I need to generate some PDF reports (1000s). Part of the report is a set of bar charts (the results of a questionnaire). Each question has the same 5 answers (v.bad, bad, ok ,good, v.good) and the chart is the % distribution of the answers. My plan is to create a HTML version, using some graph drawing* (saving a copy of the HTML to disk), creating a PDF version using html2pdf (saving a copy to disk and emailing to the recipient). I think html2pdf can handle this. But I have not had much success finding something to draw my graphs. Any (free) simple libraries out there I could be pointed towards? Thanks! Tom
RE: [PHP] Bar Charts in PDFs
Hi Tom, Have a look at the library called 'pChart': http://pchart.sourceforge.net/ While it's a bit old, it generates very nice looking (anti aliased) charts, using the default GD library. Regards, Mattias -Original Message- From: Tom Barrett [mailto:t...@miramedia.co.uk] Sent: vrijdag 11 februari 2011 10:55 To: php-general@lists.php.net Subject: [PHP] Bar Charts in PDFs Hi I need to generate some PDF reports (1000s). Part of the report is a set of bar charts (the results of a questionnaire). Each question has the same 5 answers (v.bad, bad, ok ,good, v.good) and the chart is the % distribution of the answers. My plan is to create a HTML version, using some graph drawing* (saving a copy of the HTML to disk), creating a PDF version using html2pdf (saving a copy to disk and emailing to the recipient). I think html2pdf can handle this. But I have not had much success finding something to draw my graphs. Any (free) simple libraries out there I could be pointed towards? Thanks! Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ob_flush, does it cause data to be sent over the wire immediately?
On Fri, Feb 11, 2011 at 4:05 AM, Tolas Anon tolas...@gmail.com wrote: Hi.. For my curl_exec problem, http://readlist.com/lists/lists.php.net/php-general/16/81195.html http://curl.haxx.se/mail/lib-2011-02/0101.html I need to know if this simple test will cause data to be sent every 25 seconds _over the wire_. ?php set_time_limit (0); error_reporting (E_ALL); for ($i=0; $i((3600+1800)/25); $i++) { echo '.'; ob_flush(); sleep (25); }; echo wanted-data; ? reason; i just can't get my media import routines that only send sporadic status messages to work for big video files. well, first off i should be using php:flush() instead of php:ob_flush() in my simple test. second; http://www.php.net/manual/en/function.flush.php : Several servers, especially on Win32, will still buffer the output from your script until it terminates before transmitting the results to the browser. . aargh.. well, i'll have to dig deep here. will inform you of any relevant progress, digest style -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Bar Charts in PDFs
On 11 February 2011 10:08, Mattias Geniar matt...@nucleus.be wrote: Hi Tom, Have a look at the library called 'pChart': http://pchart.sourceforge.net/ While it's a bit old, it generates very nice looking (anti aliased) charts, using the default GD library. Regards, Mattias -Original Message- From: Tom Barrett [mailto:t...@miramedia.co.uk] Sent: vrijdag 11 februari 2011 10:55 To: php-general@lists.php.net Subject: [PHP] Bar Charts in PDFs Hi I need to generate some PDF reports (1000s). Part of the report is a set of bar charts (the results of a questionnaire). Each question has the same 5 answers (v.bad, bad, ok ,good, v.good) and the chart is the % distribution of the answers. My plan is to create a HTML version, using some graph drawing* (saving a copy of the HTML to disk), creating a PDF version using html2pdf (saving a copy to disk and emailing to the recipient). I think html2pdf can handle this. But I have not had much success finding something to draw my graphs. Any (free) simple libraries out there I could be pointed towards? Thanks! Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php For the PDF production, I'd recommend looking at fpdf [1]. A free PHP class that doesn't use any libraries. It can easily take the image you've created using Mattias's suggestion. I use the fpdf class to take fax documents and add various report data to it and subsequent pages. All fairly simple stuff. Regards, Richard. [1] http://www.fpdf.org/ -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [SOLVED] Re: [PHP] curl_exec won't return (any data)
fromTolas Anon tolas...@gmail.com to libcurl development curl-libr...@cool.haxx.se dateFri, Feb 11, 2011 at 5:09 PM subject Re: php curl_exec won't return any data, libcurl-7.21.3.0, php 5.3.4, WampServer2.1d-x64.exe mailed-by gmail.com On Fri, Feb 11, 2011 at 1:32 PM, Daniel Stenberg dan...@haxx.se wrote: On Fri, 11 Feb 2011, Tolas Anon wrote: It is also very easy for an application to enable the options as I've shown. Just not for the platforms i use, apparently.. :( Why not? A quick search for tcp keepalive windows shows this: http://msdn.microsoft.com/en-us/library/ms819735.aspx BUYAKAA! This fixed my problem in the simple test AND in my application! No need to send keep-alive bytes on the text/html level either. I just added the KeepAliveTime setting with windows 7 regedit.exe in HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/services/Tcpip, as a REG_DWORD value, set it to decimal 25000 (so 25 seconds), rebooted, and it all works as i want it now.. Note that windows registry entries key names are case-sensitive, wrong casing and they'll be deleted on restart. Lots of thanks, Daniel. I would've never solved this on my own.. I'll make an entry in the php.net website comments about this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Bar Charts in PDFs
On Feb 11, 2011, at 2:08 AM, Mattias Geniar wrote: Have a look at the library called 'pChart': http://pchart.sourceforge.net/ While it's a bit old... Actually, it's been updated to v2.1 now. It looks pretty nice. http://www.pchart.net/ Marc
Re: [PHP] Bar Charts in PDFs
On 11-02-11 11:19 AM, sono...@fannullone.us wrote: On Feb 11, 2011, at 2:08 AM, Mattias Geniar wrote: Have a look at the library called 'pChart': http://pchart.sourceforge.net/ While it's a bit old... Actually, it's been updated to v2.1 now. It looks pretty nice. http://www.pchart.net/ Sweeet... good to know. I recently used this and had to hack in support for missing features (mostly different line types for each data set). Hopefully there's better support for that now. Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: [PHP] Bar Charts in PDFs
Tom: You can try: http://www.tcpdf.org/ to generate pdf. And http://jpgraph.net/ To generate chart. EX: to add a image to a pdf document: $pdf-Image( '/home/peter/test.png', 127.78, 15, // left and right 74.93, 6.42, // width and height 'PNG', '', 'T', false, 300 ); With this tcpdf i create a legal documents for Brazilian government. Alejandro MS -Mensagem original- De: Tom Barrett [mailto:t...@miramedia.co.uk] Enviada em: sexta-feira, 11 de fevereiro de 2011 06:55 Para: php-general@lists.php.net Assunto: [PHP] Bar Charts in PDFs Hi I need to generate some PDF reports (1000s). Part of the report is a set of bar charts (the results of a questionnaire). Each question has the same 5 answers (v.bad, bad, ok ,good, v.good) and the chart is the % distribution of the answers. My plan is to create a HTML version, using some graph drawing* (saving a copy of the HTML to disk), creating a PDF version using html2pdf (saving a copy to disk and emailing to the recipient). I think html2pdf can handle this. But I have not had much success finding something to draw my graphs. Any (free) simple libraries out there I could be pointed towards? Thanks! Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help! Made a boo-boo encrypting credit cards
Hey all - I'm using mcrypt to store credit cards into MySQL. About 90% of them decrypt fine, but about 10% decrypt as nonsense (b1�\�JEÚU�A��� is a good example). Maybe there is a character that appears in about 10% of my encryptions that's not being encoded properly??? // Encryption is set up at the top of the script: $crypto = mcrypt_module_open('rijndael-256', '', 'ofb', ''); $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($crypto), MCRYPT_DEV_RANDOM); $ks = mcrypt_enc_get_key_size($crypto); $key = substr(md5('my_funky_term'), 0, $ks); // When the card number is collected by the form, it's encrypted: $cc_number = addslashes($_POST['cc_number']); mcrypt_generic_init($crypto, $key, $iv); $cc_encrypt = mcrypt_generic($crypto, $cc_number); mcrypt_generic_deinit($crypto); // This is written to the database: $query = update accounts set cc_encrypt='$cc_encrypt', encrypt_iv='$iv', other_fields='$other_stuff' where id='$account_id' limit 1; $result = mysql_query($query) or die(mysql_error()); Both the cc_encrypt and encrypt_iv fields are tinytext, latin1_swedish_ci, MyISAM, MySQL 5.0.91 In another script, when I retrieve, I first set it up at the top of the script exactly like step #1 above, then retrieve it like this: mcrypt_generic_init($crypto, $key, $row['encrypt_iv']); $cc_number = trim(mdecrypt_generic($crypto, $row['cc_encrypt'])); mcrypt_generic_deinit($crypto); Most of them are good, a few of them are bad. Can anyone see anything I'm doing wrong or a case I'm not covering? Thanks much. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using BOTH GET and POST in the same page.
Dear All, I am reading PHP5 and MySQL Bible. Chapter 7 of the book says that PHP can use GET and POST in the SAME page! Also it says that we can use the SAME variables in GET and POST variable sets and that conflict resolution is done by variable_order option in php.ini Can some one write a small program to illustrate the previous ideas? It is not clear to me as to how to implement this. Many thanks, Ashim.