Re: [PHP] What was the unix timestamp of last week, Monday 12:00 am?

2009-04-13 Thread Robert Cummings
On Sun, 2009-04-12 at 20:12 -0600, René Fournier wrote: I'm trying to write a [simple] function, such that: function earlier_unix_timestamp () { $now = mktime(); [...] return $then; // e.g., 1238983107 } Anyone have something already made? There seem to be

Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument

2009-04-13 Thread Michael A. Peters
Raymond Irving wrote: Hello, After talking with Michael about how to generate XHTML code using the DOM I came up with this little function that I'm thinking of using to generate XHTML code that's HTML compatible: function saveXHTML($dom) { $html = $dom-saveXML(null,LIBXML_NOEMPTYTAG);

Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument

2009-04-13 Thread Michael Shadle
On Sun, Apr 12, 2009 at 8:07 AM, Raymond Irving xwis...@yahoo.com wrote:    $html = preg_replace('/\!\[CDATA\[(.*)\]\]\/script/s','//![CDATA[\1//]]/script',$html); question - the output of this would be script type=text/javascript![CDATAjs code ... ]]/script right? is the cdata truly

[PHP] Nagios Monitoring

2009-04-13 Thread Waynn Lue
Hey guys, I'm looking to write a nagios plugin that essentially monitors whether or not a database query returns a value 0 at any given point. I was hoping to write this in PHP, but I haven't found too many examples of Nagios plugins in PHP (

Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument

2009-04-13 Thread Michael A. Peters
Michael Shadle wrote: On Sun, Apr 12, 2009 at 8:07 AM, Raymond Irving xwis...@yahoo.com wrote: $html = preg_replace('/\!\[CDATA\[(.*)\]\]\/script/s','//![CDATA[\1//]]/script',$html); question - the output of this would be script type=text/javascript![CDATAjs code ... ]]/script

Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument

2009-04-13 Thread Michael A. Peters
Michael A. Peters wrote: function makeHTML($document) { $buffer = $document-saveHTML(); $output = html_entity_decode($buffer,ENT_QUOTES,UTF-8); return $output; } I'll try it and see what it does. Huh - not tried above yet - but with $test = $myxhtml-createElement('p','שלום');

Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument

2009-04-13 Thread Michael A. Peters
Michael A. Peters wrote: I wonder if the real utf8 problem people experience is really with loadHTML() and not with saveHTML() ?? Go to http://www.clfsrpm.net/xss/dom_script_test.php The page was meant to test something else but enter some UTF-8 into the textarea (well formed xhtml) -

Re: [PHP] Nagios Monitoring

2009-04-13 Thread Yannick Mortier
2009/4/13 Waynn Lue waynn...@gmail.com: Hey guys, I'm looking to write a nagios plugin that essentially monitors whether or not a database query returns a value 0 at any given point.  I was hoping to write this in PHP, but I haven't found too many examples of Nagios plugins in PHP (

Re: [PHP] what to use instead of foreach

2009-04-13 Thread Mark Kelly
Hi. On Sunday 12 April 2009, PJ wrote: foreach does not allow for different formatting for output... [snip] But how do you get result1, result2 result3 // with br at end ? $lastIndex = count($a) - 1; // Adjust for zero-indexing. $outputString = ''; foreach ($a as $index = $value) { if

Re: [PHP] pear mdb2 and null

2009-04-13 Thread Bastien Koert
[snip] I need it to error when an attempt to create a record without setting that field is attempted, but setting the field to an empty string is fine. Attempting to insert data without defining that field indicates there is not sufficient information to create a record. Setting that field to

Re: [PHP] what to use instead of foreach

2009-04-13 Thread PJ
Mark Kelly wrote: Hi. On Sunday 12 April 2009, PJ wrote: foreach does not allow for different formatting for output... [snip] But how do you get result1, result2 result3 // with br at end ? $lastIndex = count($a) - 1; // Adjust for zero-indexing. $outputString = '';

[PHP] try - catch is not so clear to me...

2009-04-13 Thread Lamp Lists
hi to all! actually, the statement in the Subject line is not 100% correct. I understand the purpose and how it works (at least I think I understand :-)) but to me it's so complicated way? let's take a look in example from php.net(http://us3.php.net/try) ?php function inverse($x) { if

Re: [PHP] what to use instead of foreach

2009-04-13 Thread PJ
Hi Leon, Thanks for the suggestion; I'm quite new to all this, so it's a bit complicated for my peanut brain. I have already tried with several count and for schemes. None work because foreach ignores any counters once in the loop. Also, this foreach is nested within another foreach; don't know if

Re: [PHP] try - catch is not so clear to me...

2009-04-13 Thread Kyle Smith
Lamp Lists wrote: hi to all! actually, the statement in the Subject line is not 100% correct. I understand the purpose and how it works (at least I think I understand :-)) but to me it's so complicated way? let's take a look in example from php.net(http://us3.php.net/try) ?php function

[PHP] Re: Suggestion on .htaccess

2009-04-13 Thread Jonesy
On Mon, 13 Apr 2009 02:13:35 +0600, 9el wrote: This is a .htaccess for a MU blog the index file is kept at : public_html/ And main blog is kept at: public_html/blog It is causing severe cache issue. SuperCache plugin is not working. The blog is running out of memory most of times and

Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument

2009-04-13 Thread Raymond Irving
Michael, You are absolutely right! It's loadHTML() that's causing the problems. Best regards, __ Raymond Irving --- On Mon, 4/13/09, Michael A. Peters mpet...@mac.com wrote: From: Michael A. Peters mpet...@mac.com Subject: Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument

Re: [PHP] try - catch is not so clear to me...

2009-04-13 Thread Lamp Lists
From: Kyle Smith kyle.sm...@inforonics.com To: Lamp Lists lamp.li...@yahoo.com Cc: php-general@lists.php.net Sent: Monday, April 13, 2009 9:52:36 AM Subject: Re: [PHP] try - catch is not so clear to me... Lamp Lists wrote: hi to all! actually, the statement in

Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument

2009-04-13 Thread Michael Shadle
Well this is an interesting turn of events :) We should now run over to the libxml folks and see if there is anything that can be done. There *are* encoding options when you setup the domdocument so it seems like the options are there but not working properly for one reason or another.

Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument

2009-04-13 Thread Michael Shadle
I will say though this negates the reason I chose to use domdocument to begin with. I am feeding it snippets of HTML that usually do not validate and I am not sure I want to run it through tidy first to convert from HTML to XHTML to run the domdocument and then convert it back... I am

Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument

2009-04-13 Thread Michael Shadle
On Mon, Apr 13, 2009 at 2:19 AM, Michael A. Peters mpet...@mac.com wrote: The problem is that validating xhtml does not necessarily render properly in some browsers *cough*IE*cough* I've never had problems and my work is primarily around IE6 / our corporate standards. Hell, even without a

Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument

2009-04-13 Thread Raymond Irving
Hi Michael, You migth want to check out the Raxan PDI (Programmable Document Interface) framework. It works like a charm iwth html snippets: example: $page['body']-appned('pשלום/p'); // this will append the p to the html body Here's the link: http://raxanpdi.com For online examples

Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument

2009-04-13 Thread Raymond Irving
Hi Michael, Your script works fine. The only problem I'm having is that it does not support html entities. The following code will cause the page to crash: pcopy;/p I think that's because you're using loadXML and not loadHTML. Has anyone from the dev team contacted the libxml guys about

Re: [PHP] try - catch is not so clear to me...

2009-04-13 Thread Lamp Lists
From: Lamp Lists lamp.li...@yahoo.com To: php-general@lists.php.net Sent: Monday, April 13, 2009 9:29:16 AM Subject: [PHP] try - catch is not so clear to me... hi to all! actually, the statement in the Subject line is not 100% correct. I understand

[PHP] problems with gnupg extension.

2009-04-13 Thread Ray
Hello all, I'm trying to use the gnupg extension and I think everything is properly installed. I'm just using test data. I'm encrypting and then immediately decrypting. But the decryption is failing with a unhelpful error message. error message : Warning: gnupg::decrypt() [gnupg.decrypt]:

Re: [PHP] try - catch is not so clear to me...

2009-04-13 Thread Marc Steinert
Basically try-catch gives you the ability to handle errors outside a class or method scope, by the calling instance. This comes in handy, if you are programming in an object orientated way and thus enables you to seperate error handling from the rest of your functionality. Means, your methods do

RE: [PHP] what to use instead of foreach

2009-04-13 Thread Leon du Plessis
Hi PJ, Ok, If I understand correctly you can attempt to alter your code as per following example (I am breaking it down a little for readability): a) If you only wish to output the authors, see also Mark Kelly's example, You can simply output as many authors you have associated (you will need

RE: [PHP] what to use instead of foreach

2009-04-13 Thread Leon du Plessis
Hi PJ, You may want to remove the , before the br...That was a slight oversight on my partsorry.'bout that...I will leave you to do the fixing, but I am sure you get the general idea. Best wishes..Leon -Original Message- From: Leon du Plessis [mailto:l...@dsgnit.com] Sent: 13

Re: [PHP] what to use instead of foreach

2009-04-13 Thread PJ
Hi Leon thanks. It sure is complicated. Jim Lucas example did the trick very nicely (in my other post - extract varying data from array with different formatting but here I am learning about other ways means. Redoing the arrays means redoing the queries :-( but I'll have a go at it if I'm to

Re: [PHP] what to use instead of foreach

2009-04-13 Thread Nitsan Bin-Nun
var_dump(implode(br /, $array) . br /); On Mon, Apr 13, 2009 at 7:07 PM, PJ af.gour...@videotron.ca wrote: Hi Leon thanks. It sure is complicated. Jim Lucas example did the trick very nicely (in my other post - extract varying data from array with different formatting but here I am

RE: [PHP] try - catch is not so clear to me...

2009-04-13 Thread Bob McConnell
From: Marc Steinert Basically try-catch gives you the ability to handle errors outside a class or method scope, by the calling instance. This comes in handy, if you are programming in an object orientated way and thus enables you to seperate error handling from the rest of your

[PHP] multi-dimensional arrays

2009-04-13 Thread Andres Gonzalez
Hi, I am learning PHP and have a simple question. I have a input string in this form: xxx xx x xx xxx xx x x xxx xx xx . . . xx xxx xx xx xx each line has 6 words of various lengths, all separated by white space. the input string can have any

Re: [PHP] multi-dimensional arrays

2009-04-13 Thread Shawn McKenzie
Nitsan Bin-Nun wrote: $string = xxx xx x xx xxx xxx xx x xx xxx; $t = explode(\n, $string); foreach ($t as $k = $v) $t[$k] = explode( , $v); var_dump($t); On Mon, Apr 13, 2009 at 8:55 PM, Andres Gonzalez and...@packetstorm.comwrote: Hi, I am learning

[PHP] Re: multi-dimensional arrays

2009-04-13 Thread Jo�o C�ndido de Souza Neto
I think the best way would be: $arrays = explode(PHP_EOL, $field); foreach ($arrays as $array) { $array = explode( , $array); } Not tested, but should work. Andres Gonzalez and...@packetstorm.com escreveu na mensagem news:49e38a9e.3090...@packetstorm.com... Hi, I am learning PHP and

Re: [PHP] multi-dimensional arrays

2009-04-13 Thread Shawn McKenzie
Shawn McKenzie wrote: Well in your approach you get a bunch of empty elements where the spaces are. Here are two ways but I'm sure one preg_match_all() without the explodes and loop could do it (some guru will show us): //one way $text = 'xxx xx x xx xxx xx x x xxx

Re: [PHP] multi-dimensional arrays

2009-04-13 Thread Andres Gonzalez
I was having the same problem. The second way was what I was looking for. Thank you so much for your help--I did not know about preg_match_all(). very coolthanks again. -Andres Shawn McKenzie wrote: Shawn McKenzie wrote: Well in your approach you get a bunch of empty elements where

Re: [PHP] multi-dimensional arrays

2009-04-13 Thread Nitsan Bin-Nun
$string = xxx xx x xx xxx xxx xx x xx xxx; $t = explode(\n, $string); foreach ($t as $k = $v) $t[$k] = explode( , $v); var_dump($t); On Mon, Apr 13, 2009 at 8:55 PM, Andres Gonzalez and...@packetstorm.comwrote: Hi, I am learning PHP and have a simple question. I

Re: [PHP] multi-dimensional arrays

2009-04-13 Thread Nitsan Bin-Nun
Just wondering, there is callback version of preg_match_all() ? if so you could have done it in one line I think.. On Mon, Apr 13, 2009 at 9:52 PM, Andres Gonzalez and...@packetstorm.comwrote: I was having the same problem. The second way was what I was looking for. Thank you so much for your

[PHP] use bundled pcre in php 5.2.9 w/ apache 2.2?

2009-04-13 Thread Tom Worster
upgrading to 5.2.9 on freebsd using the ports, the question was asked: Use BUNDLED_PCRE (Select if you use apache 2.0.x) - Y/N? i use apache 2.2.x so i'd guess the answer would be no. but i'm not sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] multi-dimensional arrays

2009-04-13 Thread Michael A. Peters
Nitsan Bin-Nun wrote: $string = xxx xx x xx xxx xxx xx x xx xxx; $t = explode(\n, $string); foreach ($t as $k = $v) $t[$k] = explode( , $v); var_dump($t); After assigning the string do $string = preg_replace('/\s+/',' ',$string); Then you should be able to do

RE: [PHP] $_GET verses $_POST

2009-04-13 Thread Daevid Vincent
Just to clarify. Obfuscation is NOT a substitute for security. While I don't disagree with the when's here of GET vs POST, this statement is a bit misleading... Any cracker worth his salt can easily install any number of Firefox extensions or unix command line tools and not only view the POST

Re: [PHP] $_GET verses $_POST

2009-04-13 Thread Michael A. Peters
Daevid Vincent wrote: Just to clarify. Obfuscation is NOT a substitute for security. While I don't disagree with the when's here of GET vs POST, this statement is a bit misleading... Any cracker worth his salt can easily install any number of Firefox extensions or unix command line tools and

[PHP] linux console on the PHP

2009-04-13 Thread Alejandro Esteban Galvez
Hi people. If you known any method for grant access to one user to the console of linux, using the php, can you tell me that please? I going to try explain me! I need one interface PHP, and the interface must show me one linux console and take me the control of this console. Excuse me, for my

Re: [PHP] $_GET verses $_POST

2009-04-13 Thread Tom Worster
On 4/12/09 10:23 AM, Ron Piggott ron@actsministries.org wrote: How do I know when to use $_GET verses $_POST? i use GET when i want the user to be able to email the link to someone, mention it on a blog or bookmark it and it will always yield the same page. i use POST if submitting the

Re: [PHP] $_GET verses $_POST

2009-04-13 Thread Tom Worster
On 4/13/09 6:47 PM, Michael A. Peters mpet...@mac.com wrote: For me the biggest advantage of post is the URLs aren't ugly. For cases where get with a variable in the URL is useful (IE product=BluePhone) - I prefer to handle that via mod_rewrite. The requests get handled by generic.php and

RE: [PHP] linux console on the PHP

2009-04-13 Thread dhorton
I am sorry if I don't understand quite what you are after. Answer A: If you want a console connection to a server (e.g. engsan01 as below), then you could use a TELNET URL which is still supported in various browsers. This doesn't require PHP, but could be embedded in the HTML part. a

Re: [PHP] extract varying data from array with different formatting

2009-04-13 Thread Jim Lucas
PJ wrote: Jim Lucas wrote: PJ wrote: foreach does a nice job if you want the results identical each time. What can you use to change the formatting of the results dependent on the number of results. Here's an example: foreach ( $authors[$bookID] AS $authorID = $authorData ) { #

[PHP] Logging out of a SSL / https:// site using PHP? (or JS?), Client Side Cache

2009-04-13 Thread scubak1w1
Hello, I have a series of web sites which use https:// authentication (using AD integration to 'check the credentials' as it were) - all seems to be working well.. I have been Googling et al. for a way to log the user off the site fully... I can do a series of things on the server side

[PHP] https and Credit Cards

2009-04-13 Thread Skip Evans
Hey all, I've always put any forms that collect credit card information behind a secure connection, https, figuring that sending that information from the client browser to the server should be secure, but I'm having convincing a client that it is necessary. He instead insists that only the

Re: [PHP] try - catch is not so clear to me...

2009-04-13 Thread Lamp Lists
From: Marc Steinert li...@bithub.net To: Lamp Lists lamp.li...@yahoo.com Cc: php-general@lists.php.net Sent: Monday, April 13, 2009 11:27:08 AM Subject: Re: [PHP] try - catch is not so clear to me... Basically try-catch gives you the ability to handle errors

Re: [PHP] https and Credit Cards

2009-04-13 Thread Paul M Foster
On Mon, Apr 13, 2009 at 10:19:34PM -0500, Skip Evans wrote: Hey all, I've always put any forms that collect credit card information behind a secure connection, https, figuring that sending that information from the client browser to the server should be secure, but I'm having convincing a

Re: [PHP] Logging out of a SSL / https:// site using PHP? (or JS?), Client Side Cache

2009-04-13 Thread Michael A. Peters
scubak1w1 wrote: Hello, I have a series of web sites which use https:// authentication (using AD integration to 'check the credentials' as it were) - all seems to be working well.. I have been Googling et al. for a way to log the user off the site fully... I can do a series of things