php-general Digest 18 May 2010 22:30:48 -0000 Issue 6751
php-general Digest 18 May 2010 22:30:48 - Issue 6751 Topics (messages 305295 through 305307): Touch an entry of a zip archive. 305295 by: Bastien Helders 305304 by: Richard Quadling Re: preg_replace: avoiding double replacements 305296 by: Andre Polykanine 305297 by: Peter Lind 305300 by: Ashley Sheridan 305301 by: Peter Lind 305302 by: Ashley Sheridan 305303 by: Peter Lind 305306 by: Andre Polykanine dompdf class problem 305298 by: saeed ahmed Re: Authentification and session management 305299 by: Ashley Sheridan 305305 by: Robert Cummings html analyzer 305307 by: Rene Veerman 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--- Hello list, I wanted to know, is it possible to change the modified time of a specific entry in the ziparchive? Or is it possible to set the modified time of a file when packing the file, so each file preserve its modified time? Best Regards, Bastien ---End Message--- ---BeginMessage--- On 18 May 2010 10:32, Bastien Helders eldroskan...@gmail.com wrote: Hello list, I wanted to know, is it possible to change the modified time of a specific entry in the ziparchive? Or is it possible to set the modified time of a file when packing the file, so each file preserve its modified time? Best Regards, Bastien The modified time should be the modified time of the file when it was added to the archive. If you touch() the file before you add it to the archive, then the new time will be used. But the phrase , so each file preserve its modified time, suggests that the modified time is NOT remembered. If so, I would consider that a bug. But, if you are using extractTo(), then you could use statIndex() to read the archive to find the modified time and then to touch() the created file with that time. -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling ---End Message--- ---BeginMessage--- Hello Peter, Hm... I see I need to specify what I'm really doing. Actually, I need to change the letters in the text. It's a famous and ancient crypting method: you divide the alphabet making two parts, then you change the letters of one part with letters for other part (so A becomes N, B becomes O, etc., and vice versa). it works fine and slightly with strtr or str_replace... but only if the text is not in utf-8 and it doesn't contain any non-English letters such as Cyrillic what I need. What my regex does is the following: it sees an A, well it changes it to N; then it goes through the string and sees an N... what does it do? Surely, it changes it back to A! I hoped (in vain) that there exists a modifier preventing this behavior... but it seems that it's false( Thanks! -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Peter Lind peter.e.l...@gmail.com To: Andre Polykanine an...@oire.org Date: Tuesday, May 18, 2010, 10:19:51 AM Subject: [PHP] preg_replace: avoiding double replacements On 18 May 2010 09:04, Andre Polykanine an...@oire.org wrote: [snip] Andre Polykanine wrote: Hello everyone, Sorry for bothering you again. Today I met a problem exactly described by a developer in users' notes that follow the preg_replace description in the manual: info at gratisrijden dot nl 02-Oct-2009 02:48 if you are using the preg_replace with arrays, the replacements will apply as subject for the patterns later in the array. This means replaced values can be replaced again. Example: ?php $text = 'We want to replace BOLD with the boldtag and OLDTAG with the newtag'; $patterns = array( '/BOLD/i', '/OLDTAG/i'); $replacements = array( 'boldtag', 'newtag'); echo preg_replace ($patterns, $replacements, $text); ? Output: We want to replace bnewtag with the bnewtagtag and newtag with the newtag Look what happend with BOLD. Is there any solution to this besides any two-step sophisticated trick like case changing? Thanks! Use better regexes: either match for word endings or use a delimiter in your markers (i.e. ###BOLD### instead of BOLD). Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype
Re[2]: [PHP] preg_replace: avoiding double replacements
Hello Jim, That might work for that particular example, but I have utf-8 strings containing different characters of different alphabets, so neither str_replace nor strtr work... Thanks! -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Jim Lucas li...@cmsws.com To: Andre Polykanine an...@oire.org Date: Tuesday, May 18, 2010, 3:33:09 AM Subject: [PHP] preg_replace: avoiding double replacements Andre Polykanine wrote: Hello everyone, Sorry for bothering you again. Today I met a problem exactly described by a developer in users' notes that follow the preg_replace description in the manual: info at gratisrijden dot nl 02-Oct-2009 02:48 if you are using the preg_replace with arrays, the replacements will apply as subject for the patterns later in the array. This means replaced values can be replaced again. Example: ?php $text = 'We want to replace BOLD with the boldtag and OLDTAG with the newtag'; $patterns = array( '/BOLD/i', '/OLDTAG/i'); $replacements = array( 'boldtag', 'newtag'); echo preg_replace ($patterns, $replacements, $text); ? Output: We want to replace bnewtag with the bnewtagtag and newtag with the newtag Look what happend with BOLD. Is there any solution to this besides any two-step sophisticated trick like case changing? Thanks! -- With best regards from Ukraine, Andre Http://oire.org/ - The Fantasy blogs of Oire Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: http://twitter.com/m_elensule Well, for the example you gave, why use regex? Check this out as an example. plaintext?php $text = 'We want to replace BOLD with the boldtag and OLDTAG with the newtag'; $regex = array( '/BOLD/i', '/OLDTAG/i', ); $oldtags = array( 'BOLD', 'OLDTAG', ); $replacements = array( 'boldtag', 'newtag', ); # Original String echo $text.\n; # After regex is applied echo preg_replace($regex, $replacements, $text).\n; # After plain tag replacement happens echo str_replace($oldtags, $replacements, $text).\n; ? See if that works for you. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] preg_replace: avoiding double replacements
On 18 May 2010 09:04, Andre Polykanine an...@oire.org wrote: [snip] Andre Polykanine wrote: Hello everyone, Sorry for bothering you again. Today I met a problem exactly described by a developer in users' notes that follow the preg_replace description in the manual: info at gratisrijden dot nl 02-Oct-2009 02:48 if you are using the preg_replace with arrays, the replacements will apply as subject for the patterns later in the array. This means replaced values can be replaced again. Example: ?php $text = 'We want to replace BOLD with the boldtag and OLDTAG with the newtag'; $patterns = array( '/BOLD/i', '/OLDTAG/i'); $replacements = array( 'boldtag', 'newtag'); echo preg_replace ($patterns, $replacements, $text); ? Output: We want to replace bnewtag with the bnewtagtag and newtag with the newtag Look what happend with BOLD. Is there any solution to this besides any two-step sophisticated trick like case changing? Thanks! Use better regexes: either match for word endings or use a delimiter in your markers (i.e. ###BOLD### instead of BOLD). Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Authentification and session management
Hello PHP-Community, I am PHP programmer since many years and over the years, I have reinvent the wheel in authenification and session management at least 30 times. Yeah, whenever a new project started, I had to reinvent the wheel. So my question now is, is there a proven and secure framework which can be used? My main problem is, that we (anything ISP related) authenticate using PAM+PostgreSQL while the normal Web-User stuff is authenticated directly with a Virtual-DB based on PostgreSQL. Another thing I like to implement in my scripts, that users can at there implicit choice be permanently connected without using a password. Also the script shoud detect, whether a user is connected trough a dynamic IP or a fixed one and sugegst a security level. I am already detecting the IP from the login and many customers (mostly from http://www.free.fr/) have static IP's. Thanks, Greetings and nice Day/Evening Michelle Konzack -- # Debian GNU/Linux Consultant ## Development of Intranet and Embedded Systems with Debian GNU/Linux itsyst...@tdnet France EURL itsyst...@tdnet UG (limited liability) Owner Michelle KonzackOwner Michelle Konzack Apt. 917 (homeoffice) 50, rue de Soultz Kinzigstraße 17 67100 Strasbourg/France 77694 Kehl/Germany Tel: +33-6-61925193 mobil Tel: +49-177-9351947 mobil Tel: +33-9-52705884 fix http://www.itsystems.tamay-dogan.net/ http://www.flexray4linux.org/ http://www.debian.tamay-dogan.net/ http://www.can4linux.org/ Jabber linux4miche...@jabber.ccc.de ICQ#328449886 Linux-User #280138 with the Linux Counter, http://counter.li.org/ signature.pgp Description: Digital signature
[PHP] Touch an entry of a zip archive.
Hello list, I wanted to know, is it possible to change the modified time of a specific entry in the ziparchive? Or is it possible to set the modified time of a file when packing the file, so each file preserve its modified time? Best Regards, Bastien
Re[4]: [PHP] preg_replace: avoiding double replacements
Hello Peter, Hm... I see I need to specify what I'm really doing. Actually, I need to change the letters in the text. It's a famous and ancient crypting method: you divide the alphabet making two parts, then you change the letters of one part with letters for other part (so A becomes N, B becomes O, etc., and vice versa). it works fine and slightly with strtr or str_replace... but only if the text is not in utf-8 and it doesn't contain any non-English letters such as Cyrillic what I need. What my regex does is the following: it sees an A, well it changes it to N; then it goes through the string and sees an N... what does it do? Surely, it changes it back to A! I hoped (in vain) that there exists a modifier preventing this behavior... but it seems that it's false( Thanks! -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Peter Lind peter.e.l...@gmail.com To: Andre Polykanine an...@oire.org Date: Tuesday, May 18, 2010, 10:19:51 AM Subject: [PHP] preg_replace: avoiding double replacements On 18 May 2010 09:04, Andre Polykanine an...@oire.org wrote: [snip] Andre Polykanine wrote: Hello everyone, Sorry for bothering you again. Today I met a problem exactly described by a developer in users' notes that follow the preg_replace description in the manual: info at gratisrijden dot nl 02-Oct-2009 02:48 if you are using the preg_replace with arrays, the replacements will apply as subject for the patterns later in the array. This means replaced values can be replaced again. Example: ?php $text = 'We want to replace BOLD with the boldtag and OLDTAG with the newtag'; $patterns = array( '/BOLD/i', '/OLDTAG/i'); $replacements = array( 'boldtag', 'newtag'); echo preg_replace ($patterns, $replacements, $text); ? Output: We want to replace bnewtag with the bnewtagtag and newtag with the newtag Look what happend with BOLD. Is there any solution to this besides any two-step sophisticated trick like case changing? Thanks! Use better regexes: either match for word endings or use a delimiter in your markers (i.e. ###BOLD### instead of BOLD). Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[4]: [PHP] preg_replace: avoiding double replacements
On 18 May 2010 12:35, Andre Polykanine an...@oire.org wrote: Hello Peter, Hm... I see I need to specify what I'm really doing. Actually, I need to change the letters in the text. It's a famous and ancient crypting method: you divide the alphabet making two parts, then you change the letters of one part with letters for other part (so A becomes N, B becomes O, etc., and vice versa). it works fine and slightly with strtr or str_replace... but only if the text is not in utf-8 and it doesn't contain any non-English letters such as Cyrillic what I need. What my regex does is the following: it sees an A, well it changes it to N; then it goes through the string and sees an N... what does it do? Surely, it changes it back to A! I hoped (in vain) that there exists a modifier preventing this behavior... but it seems that it's false( Thanks! Hmmm, what comes to mind is using your string as an array and translating one character after another, building your output string using a lookup table. Not entirely sure how that will play with utf8 characters, you'd have to try and see. I don't think you'll get any of PHPs string functions to do the work for you - they'll do the job in serial, not parallel. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] dompdf class problem
I extremely sorry, if my topic isn't related with this group. I apologizes for this. I'm trying to add page number on the pdf. I have try the below code. but couldn't get the page number at the pdf. where I'm doing wrong. please suggest me. ?php require_once(dompdf_config.inc.php); $dompdf = new DOMPDF(); $html = 'htmlbody'; $html .='script type=text/php $font = Font_Metrics::get_font(verdana, bold); $dompdf-page_text(200, 16, {PAGE_NUM} of {PAGE_COUNT}, $font, 10, array(0,0,0)); /script'; $html .= '/body/html'; $dompdf-load_html($html); $dompdf-render(); $dompdf-stream(sample.pdf); ? regards, saeed
Re: [PHP] Authentification and session management
On Tue, 2010-05-18 at 11:21 +0200, Michelle Konzack wrote: Hello PHP-Community, I am PHP programmer since many years and over the years, I have reinvent the wheel in authenification and session management at least 30 times. Yeah, whenever a new project started, I had to reinvent the wheel. So my question now is, is there a proven and secure framework which can be used? My main problem is, that we (anything ISP related) authenticate using PAM+PostgreSQL while the normal Web-User stuff is authenticated directly with a Virtual-DB based on PostgreSQL. Another thing I like to implement in my scripts, that users can at there implicit choice be permanently connected without using a password. Also the script shoud detect, whether a user is connected trough a dynamic IP or a fixed one and sugegst a security level. I am already detecting the IP from the login and many customers (mostly from http://www.free.fr/) have static IP's. Thanks, Greetings and nice Day/Evening Michelle Konzack I recently heard about a PHP-based authentication system called Sumo. It might be what you need to stop re-inventing them darn wheels! http://sumoam.sourceforge.net Thanks, Ash http://www.ashleysheridan.co.uk
Re: Re[4]: [PHP] preg_replace: avoiding double replacements
On Tue, 2010-05-18 at 13:09 +0200, Peter Lind wrote: On 18 May 2010 12:35, Andre Polykanine an...@oire.org wrote: Hello Peter, Hm... I see I need to specify what I'm really doing. Actually, I need to change the letters in the text. It's a famous and ancient crypting method: you divide the alphabet making two parts, then you change the letters of one part with letters for other part (so A becomes N, B becomes O, etc., and vice versa). it works fine and slightly with strtr or str_replace... but only if the text is not in utf-8 and it doesn't contain any non-English letters such as Cyrillic what I need. What my regex does is the following: it sees an A, well it changes it to N; then it goes through the string and sees an N... what does it do? Surely, it changes it back to A! I hoped (in vain) that there exists a modifier preventing this behavior... but it seems that it's false( Thanks! Hmmm, what comes to mind is using your string as an array and translating one character after another, building your output string using a lookup table. Not entirely sure how that will play with utf8 characters, you'd have to try and see. I don't think you'll get any of PHPs string functions to do the work for you - they'll do the job in serial, not parallel. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype If you're wanting to use the Caesar cypher (for that's what it is) then why not just modify the entire string, character by character, to use a character code n characters ahead. For example, a capital A is ascii 65, you want to change it to an N to add 14 to that. Just keep n the same throughout and it's easy to convert back. Thanks, Ash http://www.ashleysheridan.co.uk
Re: Re[4]: [PHP] preg_replace: avoiding double replacements
On 18 May 2010 13:32, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Tue, 2010-05-18 at 13:09 +0200, Peter Lind wrote: On 18 May 2010 12:35, Andre Polykanine an...@oire.org wrote: Hello Peter, Hm... I see I need to specify what I'm really doing. Actually, I need to change the letters in the text. It's a famous and ancient crypting method: you divide the alphabet making two parts, then you change the letters of one part with letters for other part (so A becomes N, B becomes O, etc., and vice versa). it works fine and slightly with strtr or str_replace... but only if the text is not in utf-8 and it doesn't contain any non-English letters such as Cyrillic what I need. What my regex does is the following: it sees an A, well it changes it to N; then it goes through the string and sees an N... what does it do? Surely, it changes it back to A! I hoped (in vain) that there exists a modifier preventing this behavior... but it seems that it's false( Thanks! Hmmm, what comes to mind is using your string as an array and translating one character after another, building your output string using a lookup table. Not entirely sure how that will play with utf8 characters, you'd have to try and see. I don't think you'll get any of PHPs string functions to do the work for you - they'll do the job in serial, not parallel. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype If you're wanting to use the Caesar cypher (for that's what it is) then why not just modify the entire string, character by character, to use a character code n characters ahead. For example, a capital A is ascii 65, you want to change it to an N to add 14 to that. Just keep n the same throughout and it's easy to convert back. Thanks, Ash http://www.ashleysheridan.co.uk You probably overlooked the part where the OP points out he's not using ascii but utf8. If it was just ascii, using str_rot13() would be the weapon of choice I'd say (note that adding 14 to every character of an ascii string will turn lots of it into gibberish - you have to wrap round when you reach a certain point). Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[4]: [PHP] preg_replace: avoiding double replacements
On Tue, 2010-05-18 at 13:46 +0200, Peter Lind wrote: On 18 May 2010 13:32, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Tue, 2010-05-18 at 13:09 +0200, Peter Lind wrote: On 18 May 2010 12:35, Andre Polykanine an...@oire.org wrote: Hello Peter, Hm... I see I need to specify what I'm really doing. Actually, I need to change the letters in the text. It's a famous and ancient crypting method: you divide the alphabet making two parts, then you change the letters of one part with letters for other part (so A becomes N, B becomes O, etc., and vice versa). it works fine and slightly with strtr or str_replace... but only if the text is not in utf-8 and it doesn't contain any non-English letters such as Cyrillic what I need. What my regex does is the following: it sees an A, well it changes it to N; then it goes through the string and sees an N... what does it do? Surely, it changes it back to A! I hoped (in vain) that there exists a modifier preventing this behavior... but it seems that it's false( Thanks! Hmmm, what comes to mind is using your string as an array and translating one character after another, building your output string using a lookup table. Not entirely sure how that will play with utf8 characters, you'd have to try and see. I don't think you'll get any of PHPs string functions to do the work for you - they'll do the job in serial, not parallel. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype If you're wanting to use the Caesar cypher (for that's what it is) then why not just modify the entire string, character by character, to use a character code n characters ahead. For example, a capital A is ascii 65, you want to change it to an N to add 14 to that. Just keep n the same throughout and it's easy to convert back. Thanks, Ash http://www.ashleysheridan.co.uk You probably overlooked the part where the OP points out he's not using ascii but utf8. If it was just ascii, using str_rot13() would be the weapon of choice I'd say (note that adding 14 to every character of an ascii string will turn lots of it into gibberish - you have to wrap round when you reach a certain point). Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype I gave the example as Ascii because I knew the code for A off the top of my head, I don't see a reason why it won't work for utf, the characters still have incremental codes. Also, is gibberish really an issue to worry about? The Caesar cypher is already rendering the string unreadable. Thanks, Ash http://www.ashleysheridan.co.uk
Re: Re[4]: [PHP] preg_replace: avoiding double replacements
On 18 May 2010 13:43, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Tue, 2010-05-18 at 13:46 +0200, Peter Lind wrote: On 18 May 2010 13:32, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Tue, 2010-05-18 at 13:09 +0200, Peter Lind wrote: On 18 May 2010 12:35, Andre Polykanine an...@oire.org wrote: Hello Peter, Hm... I see I need to specify what I'm really doing. Actually, I need to change the letters in the text. It's a famous and ancient crypting method: you divide the alphabet making two parts, then you change the letters of one part with letters for other part (so A becomes N, B becomes O, etc., and vice versa). it works fine and slightly with strtr or str_replace... but only if the text is not in utf-8 and it doesn't contain any non-English letters such as Cyrillic what I need. What my regex does is the following: it sees an A, well it changes it to N; then it goes through the string and sees an N... what does it do? Surely, it changes it back to A! I hoped (in vain) that there exists a modifier preventing this behavior... but it seems that it's false( Thanks! Hmmm, what comes to mind is using your string as an array and translating one character after another, building your output string using a lookup table. Not entirely sure how that will play with utf8 characters, you'd have to try and see. I don't think you'll get any of PHPs string functions to do the work for you - they'll do the job in serial, not parallel. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype If you're wanting to use the Caesar cypher (for that's what it is) then why not just modify the entire string, character by character, to use a character code n characters ahead. For example, a capital A is ascii 65, you want to change it to an N to add 14 to that. Just keep n the same throughout and it's easy to convert back. Thanks, Ash http://www.ashleysheridan.co.uk You probably overlooked the part where the OP points out he's not using ascii but utf8. If it was just ascii, using str_rot13() would be the weapon of choice I'd say (note that adding 14 to every character of an ascii string will turn lots of it into gibberish - you have to wrap round when you reach a certain point). Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype I gave the example as Ascii because I knew the code for A off the top of my head, I don't see a reason why it won't work for utf, the characters still have incremental codes. Also, is gibberish really an issue to worry about? The Caesar cypher is already rendering the string unreadable. You normally want output in the same range that you encode from (i.e. you're remapping within the alphabet, not within the entire range of printable characters) if you're doing a caesar/rot13. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Touch an entry of a zip archive.
On 18 May 2010 10:32, Bastien Helders eldroskan...@gmail.com wrote: Hello list, I wanted to know, is it possible to change the modified time of a specific entry in the ziparchive? Or is it possible to set the modified time of a file when packing the file, so each file preserve its modified time? Best Regards, Bastien The modified time should be the modified time of the file when it was added to the archive. If you touch() the file before you add it to the archive, then the new time will be used. But the phrase , so each file preserve its modified time, suggests that the modified time is NOT remembered. If so, I would consider that a bug. But, if you are using extractTo(), then you could use statIndex() to read the archive to find the modified time and then to touch() the created file with that time. -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Authentification and session management
Michelle Konzack wrote: Hello PHP-Community, I am PHP programmer since many years and over the years, I have reinvent the wheel in authenification and session management at least 30 times. Yeah, whenever a new project started, I had to reinvent the wheel. So my question now is, is there a proven and secure framework which can be used? My main problem is, that we (anything ISP related) authenticate using PAM+PostgreSQL while the normal Web-User stuff is authenticated directly with a Virtual-DB based on PostgreSQL. Another thing I like to implement in my scripts, that users can at there implicit choice be permanently connected without using a password. Also the script shoud detect, whether a user is connected trough a dynamic IP or a fixed one and sugegst a security level. I am already detecting the IP from the login and many customers (mostly from http://www.free.fr/) have static IP's. Why don't you take one of those wheels you created and make it work with a simple configuration and voila, you have a class or library that can be used in all your projects. It should be as simple as it sounds. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[6]: [PHP] preg_replace: avoiding double replacements
Hello Peter, Good point. And more than that, I make a decrypting script, also... so gibberish defenitely is an issue) -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Peter Lind peter.e.l...@gmail.com To: a...@ashleysheridan.co.uk a...@ashleysheridan.co.uk Date: Tuesday, May 18, 2010, 3:00:56 PM Subject: [PHP] preg_replace: avoiding double replacements On 18 May 2010 13:43, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Tue, 2010-05-18 at 13:46 +0200, Peter Lind wrote: On 18 May 2010 13:32, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Tue, 2010-05-18 at 13:09 +0200, Peter Lind wrote: On 18 May 2010 12:35, Andre Polykanine an...@oire.org wrote: Hello Peter, Hm... I see I need to specify what I'm really doing. Actually, I need to change the letters in the text. It's a famous and ancient crypting method: you divide the alphabet making two parts, then you change the letters of one part with letters for other part (so A becomes N, B becomes O, etc., and vice versa). it works fine and slightly with strtr or str_replace... but only if the text is not in utf-8 and it doesn't contain any non-English letters such as Cyrillic what I need. What my regex does is the following: it sees an A, well it changes it to N; then it goes through the string and sees an N... what does it do? Surely, it changes it back to A! I hoped (in vain) that there exists a modifier preventing this behavior... but it seems that it's false( Thanks! Hmmm, what comes to mind is using your string as an array and translating one character after another, building your output string using a lookup table. Not entirely sure how that will play with utf8 characters, you'd have to try and see. I don't think you'll get any of PHPs string functions to do the work for you - they'll do the job in serial, not parallel. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype If you're wanting to use the Caesar cypher (for that's what it is) then why not just modify the entire string, character by character, to use a character code n characters ahead. For example, a capital A is ascii 65, you want to change it to an N to add 14 to that. Just keep n the same throughout and it's easy to convert back. Thanks, Ash http://www.ashleysheridan.co.uk You probably overlooked the part where the OP points out he's not using ascii but utf8. If it was just ascii, using str_rot13() would be the weapon of choice I'd say (note that adding 14 to every character of an ascii string will turn lots of it into gibberish - you have to wrap round when you reach a certain point). Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype I gave the example as Ascii because I knew the code for A off the top of my head, I don't see a reason why it won't work for utf, the characters still have incremental codes. Also, is gibberish really an issue to worry about? The Caesar cypher is already rendering the string unreadable. You normally want output in the same range that you encode from (i.e. you're remapping within the alphabet, not within the entire range of printable characters) if you're doing a caesar/rot13. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] html analyzer
Hi. I'm trying to build a html analyzer that looks at natural words in html text. I'd like to build a routine that walks through the HTML character by character, but i'm not sure on how to properly walk through escaped and ' characters in javascript or other embedded languages. Skipping the first and ' is no problem, but after that, the escaped and ', they can get difficult imo. If you have any ideas on this i'd like to hear 'm.. -- - Greetings from Rene7705, My free open source webcomponents: http://code.google.com/u/rene7705/ http://mediabeez.ws/downloads (and demos) http://www.facebook.com/rene7705 - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dompdf class problem
we don't have that class, nor it's documentation...? On Tue, May 18, 2010 at 1:17 PM, saeed ahmed saeed@gmail.com wrote: I extremely sorry, if my topic isn't related with this group. I apologizes for this. I'm trying to add page number on the pdf. I have try the below code. but couldn't get the page number at the pdf. where I'm doing wrong. please suggest me. ?php require_once(dompdf_config.inc.php); $dompdf = new DOMPDF(); $html = 'htmlbody'; $html .='script type=text/php $font = Font_Metrics::get_font(verdana, bold); $dompdf-page_text(200, 16, {PAGE_NUM} of {PAGE_COUNT}, $font, 10, array(0,0,0)); /script'; $html .= '/body/html'; $dompdf-load_html($html); $dompdf-render(); $dompdf-stream(sample.pdf); ? regards, saeed -- - Greetings from Rene7705, My free open source webcomponents: http://code.google.com/u/rene7705/ http://mediabeez.ws/downloads (and demos) http://www.facebook.com/rene7705 - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: html analyzer
Hello, on 05/18/2010 07:30 PM Rene Veerman said the following: Hi. I'm trying to build a html analyzer that looks at natural words in html text. I'd like to build a routine that walks through the HTML character by character, but i'm not sure on how to properly walk through escaped and ' characters in javascript or other embedded languages. Skipping the first and ' is no problem, but after that, the escaped and ', they can get difficult imo. If you have any ideas on this i'd like to hear 'm.. Better try something that is already done. HTML parsing is not that trivial. If the HTML you are parsing is malformed, things get worse. You may want to try this HTML parser package. It can parse HTML, CSS, DTD, etc.. in pure PHP. No special extensions required. It can tolerate malformed HTML and even filter insecure HTML and CSS that may contain dangerous Javascript. Actually it was done mainly for that purpose. http://www.phpclasses.org/secure-html-filter -- Regards, Manuel Lemos Find and post PHP jobs http://www.phpclasses.org/jobs/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php photo galery
Hello, I've googled for this and tried some downloads but not finding what i'm looking for. A site requirement is to have a photo gallery. These user's are not very technical so i thought about getting a galery with the ability to upload photos via a browser, I would also like thumb nails, and the ability to have an alt text attribute with the photo and a longer description of the picture, for accessibility reasons. If anyone has anything similar to this please let me know. Thanks. Dave. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php photo galery
On Tuesday 18 May 2010 21:11:00 David Mehler wrote: Hello, I've googled for this and tried some downloads but not finding what i'm looking for. A site requirement is to have a photo gallery. These user's are not very technical so i thought about getting a galery with the ability to upload photos via a browser, I would also like thumb nails, and the ability to have an alt text attribute with the photo and a longer description of the picture, for accessibility reasons. If anyone has anything similar to this please let me know. Thanks. Dave. coppermine http://coppermine-gallery.net/ -- Blessings, David M. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php photo galery
On Tue, 18 May 2010 21:11:00 -0400, David Mehler wrote: I've googled for this and tried some downloads but not finding what i'm looking for. A site requirement is to have a photo gallery. These user's are not very technical so i thought about getting a galery with the ability to upload photos via a browser, I would also like thumb nails, and the ability to have an alt text attribute with the photo and a longer description of the picture, for accessibility reasons. If anyone has anything similar to this please let me know. http://www.plogger.org/ -- Ross McKay, Toronto, NSW Australia Let the laddie play wi the knife - he'll learn - The Wee Book of Calvin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: php photo galery
I have used Satellite. Worked pretty well for me. http://design.tedforbes.com/ Justin -Original Message- From: Ross McKay [mailto:ro...@zeta.org.au] Sent: Wednesday, 19 May 2010 11:23 AM To: php-general@lists.php.net Subject: [PHP] Re: php photo galery On Tue, 18 May 2010 21:11:00 -0400, David Mehler wrote: I've googled for this and tried some downloads but not finding what i'm looking for. A site requirement is to have a photo gallery. These user's are not very technical so i thought about getting a galery with the ability to upload photos via a browser, I would also like thumb nails, and the ability to have an alt text attribute with the photo and a longer description of the picture, for accessibility reasons. If anyone has anything similar to this please let me know. http://www.plogger.org/ -- Ross McKay, Toronto, NSW Australia Let the laddie play wi the knife - he'll learn - The Wee Book of Calvin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php photo galery
On Wed, 2010-05-19 at 11:22 +1000, Ross McKay wrote: On Tue, 18 May 2010 21:11:00 -0400, David Mehler wrote: I've googled for this and tried some downloads but not finding what i'm looking for. A site requirement is to have a photo gallery. These user's are not very technical so i thought about getting a galery with the ability to upload photos via a browser, I would also like thumb nails, and the ability to have an alt text attribute with the photo and a longer description of the picture, for accessibility reasons. If anyone has anything similar to this please let me know. http://www.plogger.org/ -- Ross McKay, Toronto, NSW Australia Let the laddie play wi the knife - he'll learn - The Wee Book of Calvin Something like this wouldn't be too hard to put together. A form with a input type=file/ element could handle the image upload and text part. If they need to upload multiple files then you could either use several input elements or a multi-upload option, although the latter aren't very accessible at all I've found, which seems to go against one of your requirements. I assume the need for multiple galleries, and further assume that you already have a way that you are distinguishing users. Just use this identifier against each image to denote a gallery. A database can easily be used here to not only identify the gallery an image belongs to but the user who uploaded it, and what galleries the user has rights to, etc. Creating thumbnails is also a doddle. I've just written up a function I wrote for http://www.vicestyle.com which creates thumbnails in any size you want from any image without distortion using a smart crop technique at http://www.ashleysheridan.co.uk/coding/php/Smart_Image_Resizing . Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] php photo galery
If anyone has anything similar to this please let me know. SlidesShowPro Director: http://slideshowpro.net/products/slideshowpro_director/ You could use the Director API and create a PHP gallery with your own code, or you could use the SlideShowPro flash player. The Director interface is very easy to use. For a nominal fee, you can have SSP site host Director for you, or you can host the software it yourself. Cheers, M -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php