php-general Digest 29 Jun 2012 21:12:13 -0000 Issue 7870

2012-06-29 Thread php-general-digest-help

php-general Digest 29 Jun 2012 21:12:13 - Issue 7870

Topics (messages 318342 through 318344):

Re: php batch/queue framwork
318342 by: Tom Sparks

Re: What's happened to our newsgroup?
318343 by: Marc Guay

PHP tattoo
318344 by: Larry Martell

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---
Forwarded Message: php-general_318334.ezm
Re: php batch/queue framwork
Friday, 29 June, 2012 6:30 AM
From:
Shailesh N. Humbad humb...@alum.mit.edu
To:
php-gene...@lists.php.net
On 6/28/2012 11:58 AM, Tom Sparks wrote:
 I am looking for a batch/queue framework that is database-centric?
 I could write my own, but I want one that is mature

 tom_a_sparks
 It's a nerdy thing I like to do


You could try Amazon Simple Queue Service: http://aws.amazon.com/sqs/
Use the PHP SDK: http://aws.amazon.com/sdkforphp/

I was hoping for something that I could run local on my host

tom
---End Message---
---BeginMessage---
 You mean everyone finally RTFM?

There's a manual?  GoDaddy told me to just ask all of my questions here!


(No insult meant, in case it's not obvious.)

Happy Fridays
Marc
---End Message---
---BeginMessage---
http://www.geekytattoos.com/nothing-risked-nothing-gained-nothing-lost-nothing-learned/
---End Message---


php-general Digest 27 Jun 2012 14:42:49 -0000 Issue 7866

2012-06-27 Thread php-general-digest-help

php-general Digest 27 Jun 2012 14:42:49 - Issue 7866

Topics (messages 318295 through 318309):

Re: What's happened to our newsgroup?
318295 by: Govinda
318296 by: Steven Staples
318297 by: TR Shaw
318298 by: Larry Martell
318299 by: Marc Guay
318300 by: Ashley Sheridan
318301 by: Jen Rasmussen
318302 by: Jason Pruim
318303 by: Matijn Woudt
318304 by: Daniel Brown
318305 by: Simon J Welsh
318306 by: Stefan Wixfort
318307 by: tamouse mailing lists
318308 by: Matijn Woudt
318309 by: Tedd Sperling

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---

 No postings for days.

everyone RTFM? 
:-)

---End Message---
---BeginMessage---

 -Original Message-
 From: Govinda [mailto:govinda.webdnat...@gmail.com]
 Sent: June 26, 2012 3:25 PM
 To: PHP-General List
 Subject: Re: [PHP] What's happened to our newsgroup?
 
 
  No postings for days.
 
 everyone RTFM?
 :-)
 
 

Maybe they joined the British mailing list?


Steven Staples

---End Message---
---BeginMessage---

On Jun 26, 2012, at 3:28 PM, Steven Staples wrote:

 
 -Original Message-
 From: Govinda [mailto:govinda.webdnat...@gmail.com]
 Sent: June 26, 2012 3:25 PM
 To: PHP-General List
 Subject: Re: [PHP] What's happened to our newsgroup?
 
 
 No postings for days.
 
 everyone RTFM?
 :-)
 
 
 
 Maybe they joined the British mailing list?
 

Maybe its just the summer.

Tom

---End Message---
---BeginMessage---
On Tue, Jun 26, 2012 at 1:30 PM, TR Shaw ts...@oitc.com wrote:

 On Jun 26, 2012, at 3:28 PM, Steven Staples wrote:


 -Original Message-
 From: Govinda [mailto:govinda.webdnat...@gmail.com]
 Sent: June 26, 2012 3:25 PM
 To: PHP-General List
 Subject: Re: [PHP] What's happened to our newsgroup?


 No postings for days.

 everyone RTFM?
 :-)



 Maybe they joined the British mailing list?


 Maybe its just the summer.

Maybe they're working in Django now (like I am).
---End Message---
---BeginMessage---
Everyone switched to PCP?
---End Message---
---BeginMessage---
On Tue, 2012-06-26 at 15:42 -0400, Marc Guay wrote:

 Everyone switched to PCP?
 


I wonder if the thing that happened to your newsgroup has also happened
to this mailing list? :p

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk


---End Message---
---BeginMessage---
LOL

-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: Tuesday, June 26, 2012 3:13 PM
To: Marc Guay
Cc: php-gene...@lists.php.net
Subject: Re: [PHP] What's happened to our newsgroup?

On Tue, 2012-06-26 at 15:42 -0400, Marc Guay wrote:

 Everyone switched to PCP?
 


I wonder if the thing that happened to your newsgroup has also happened to this 
mailing list? :p

--
Thanks,
Ash
http://www.ashleysheridan.co.uk



---End Message---
---BeginMessage---

On Jun 26, 2012, at 4:15 PM, Jen Rasmussen j...@cetaceasound.com wrote:

 LOL
 
 -Original Message-
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
 Sent: Tuesday, June 26, 2012 3:13 PM
 To: Marc Guay
 Cc: php-gene...@lists.php.net
 Subject: Re: [PHP] What's happened to our newsgroup?
 
 On Tue, 2012-06-26 at 15:42 -0400, Marc Guay wrote:
 
 Everyone switched to PCP?
 
 
 
 I wonder if the thing that happened to your newsgroup has also happened to 
 this mailing list? :p

We can't talk like this! It's not even Friday yet!!! ;)

---End Message---
---BeginMessage---
On Tue, Jun 26, 2012 at 11:39 PM, Jason Pruim
li...@pruimphotography.com wrote:

 On Jun 26, 2012, at 4:15 PM, Jen Rasmussen j...@cetaceasound.com wrote:

 LOL

 -Original Message-
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
 Sent: Tuesday, June 26, 2012 3:13 PM
 To: Marc Guay
 Cc: php-gene...@lists.php.net
 Subject: Re: [PHP] What's happened to our newsgroup?

 On Tue, 2012-06-26 at 15:42 -0400, Marc Guay wrote:

 Everyone switched to PCP?



 I wonder if the thing that happened to your newsgroup has also happened to 
 this mailing list? :p

 We can't talk like this! It's not even Friday yet!!! ;)



Isn't everyday friday in summer? ;)
---End Message---
---BeginMessage---
On Tue, Jun 26, 2012 at 5:42 PM, Matijn Woudt tijn...@gmail.com wrote:

 Isn't everyday friday in summer? ;)

If it is, then it could be argued that every day is a Monday in
winter --- and right now, those poor folks in the southern hemisphere
(I'm looking at you, Thiago Pojda) are in a season of endless Mondays.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/
---End Message---
---BeginMessage---

On 27/06/2012, at 9:45 AM, Daniel Brown wrote:

 On Tue, Jun 26, 2012 at 5:42 PM, Matijn Woudt tijn

php-general Digest 26 Jun 2012 19:21:59 -0000 Issue 7865

2012-06-26 Thread php-general-digest-help

php-general Digest 26 Jun 2012 19:21:59 - Issue 7865

Topics (messages 318289 through 318294):

Re: If PHP Were British
318289 by: Tedd Sperling
318290 by: Daniel Brown
318291 by: Daevid Vincent
318292 by: Mark Rousell
318293 by: Bastien

What's happened to our newsgroup?
318294 by: Al

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---
On Jun 22, 2012, at 5:07 PM, Daevid Vincent dae...@daevid.com wrote:

 http://www.addedbytes.com/blog/if-php-were-british/


Oh, that is too funny!

I'll counter with my Hill-Billy version:

---
echo();

yell('revenewers commin');

---

var_dump();

take_a_dump();

preferred:

leave_one();

---

if: 

what_ya_think($huh)
   {
   //codie here
   }

ternary:

$gospel = $thisn ? $thatn : $the_othern;

---
switch:

whats_thisn($quess)
   {
   thisn $thunk_one:
   //codie here
   that_settles_it:

   thisn $thunk_tu:
   //codie here
   that_settles_it:

   thisn $thunk_3:
   //codie here
   that_settles_it:

   othern $not_thunk:
   //codie here
   that_settles_it:
   }

---

try/catch:

what_the
   {
   //codie here
   }
   what_the_hell(kin $whut)
   {
   buy_the_farm('Sh#t');
   }

---

class: What? Never went to class.  :-)


Cheers,

tedd

_
t...@sperling.com
http://sperling.com
---End Message---
---BeginMessage---
On Fri, Jun 22, 2012 at 5:07 PM, Daevid Vincent dae...@daevid.com wrote:
 http://www.addedbytes.com/blog/if-php-were-british/

Eh, what the hell, it's Friday

http://links.parasane.net/eea4

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/
---End Message---
---BeginMessage---
 -Original Message-
 From: paras...@gmail.com [mailto:paras...@gmail.com] On Behalf Of Daniel
Brown
 Sent: Friday, June 22, 2012 4:03 PM
 To: Daevid Vincent
 Cc: php-gene...@lists.php.net
 Subject: Re: [PHP] If PHP Were British
 
 On Fri, Jun 22, 2012 at 5:07 PM, Daevid Vincent dae...@daevid.com wrote:
  http://www.addedbytes.com/blog/if-php-were-british/
 
 Eh, what the hell, it's Friday
 
 http://links.parasane.net/eea4

HA! NICE! Thanks for the nod too! :)

---End Message---
---BeginMessage---
On 22/06/2012 22:07, Daevid Vincent wrote:
 http://www.addedbytes.com/blog/if-php-were-british/

LOL!


-- 
Mark Rousell

PGP public key: http://www.signal100.com/markr/pgp
Key ID: C9C5C162
 
 
 



---End Message---
---BeginMessage---
I bow to your skillz! That was pretty awesome!

Bastien Koert

On 2012-06-22, at 7:02 PM, Daniel Brown danbr...@php.net wrote:

 On Fri, Jun 22, 2012 at 5:07 PM, Daevid Vincent dae...@daevid.com wrote:
 http://www.addedbytes.com/blog/if-php-were-british/
 
Eh, what the hell, it's Friday
 
http://links.parasane.net/eea4
 
 -- 
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
---End Message---
---BeginMessage---

No postings for days.

---End Message---


php-general Digest 22 Jun 2012 21:07:28 -0000 Issue 7864

2012-06-22 Thread php-general-digest-help

php-general Digest 22 Jun 2012 21:07:28 - Issue 7864

Topics (messages 318285 through 318288):

Re: why is (intval('444-4') == '444-4') EQUAL??!
318285 by: Robert Cummings
318286 by: Mike Mackintosh
318287 by: marco.behnke.biz

If PHP Were British
318288 by: Daevid Vincent

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---



On 12-06-21 10:27 PM, Daevid Vincent wrote:

Huh? Why is this equal??!

php  $id = '444-4';

php  var_dump($id, intval($id));
string(9) 444-4
int(444)

php  if (intval($id) == $id) echo 'equal'; else echo 'not equal';
equal

or in other words:

php  if (intval('444-4') == '444-4') echo 'equal'; else
echo 'not equal';
equal

I would expect PHP to be evaluating string 444-4 against integer 444
(or string either way)

however, just for giggles, using === works...

php  if ($id === intval($id)) echo 'equal'; else echo 'not equal';
not equal


Using === will always fail because on the left you have a string and on 
the right you have an integer which fails exact comparison based on 
datatype mismatch.


When comparing a string to an integer using == PHP performs type 
juggling and converts the string to an integer first.


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.
---End Message---
---BeginMessage---
Using == will compare the two values after type juggling is performed. === will 
compare based on value and type (identical).

PHP Will type juggle the string to an integer.

Your if/else is just like saying: 

php if (444 == 444) echo 'equal'; else echo 'not equal';
equal

-- 
Mike Mackintosh
PHP 5.3 ZCE


On Thursday, June 21, 2012 at 10:27 PM, Daevid Vincent wrote:

 Huh? Why is this equal??!
 
 php  $id = '444-4';
 
 php  var_dump($id, intval($id));
 string(9) 444-4
 int(444)
 
 php  if (intval($id) == $id) echo 'equal'; else echo 'not equal';
 equal
 
 or in other words:
 
 php  if (intval('444-4') == '444-4') echo 'equal'; else
 echo 'not equal';
 equal
 
 I would expect PHP to be evaluating string 444-4 against integer 444
 (or string either way)
 
 however, just for giggles, using === works...
 
 php  if ($id === intval($id)) echo 'equal'; else echo 'not equal';
 not equal
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


---End Message---
---BeginMessage---


Daevid Vincent dae...@daevid.com hat am 22. Juni 2012 um 04:27 geschrieben:

 Huh? Why is this equal??!

http://de2.php.net/manual/en/language.types.type-juggling.php
---End Message---
---BeginMessage---
http://www.addedbytes.com/blog/if-php-were-british/
---End Message---


php-general Digest 18 Jun 2012 13:41:13 -0000 Issue 7860

2012-06-18 Thread php-general-digest-help

php-general Digest 18 Jun 2012 13:41:13 - Issue 7860

Topics (messages 318271 through 318275):

Re: else if vs switch
318271 by: James
318275 by: April Mains

IE9 Large Post Hangs for 5 Minutes Plus
318272 by: Christopher Cowan
318274 by: Mihamina Rakotomandimby

Re: Missing something simple
318273 by: Lester Caine

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---
Same logical check with my personal preference ;)

$toaddress = $mapping['default'];

if ( isset($city)  isset($mapping[$city]) ) { ... }

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Jim Lucas li...@cmsws.com wrote:

On 6/15/2012 3:29 PM, Joshua Kehn wrote:
 Way easier to just use a map.

 $mapping = array(
   'Calgary' = abc@emailaddress,
   'Brooks' = def@emailaddress,
   // etc
 );
 $toaddress = $mapping[$city];

I would use this, but add a check to it.

$mapping = array(
'default' = 'defa...@domain.tld',
...
);

...

if ( isset($mapping[$city]) ) {
$toaddress = $mapping[$city];
} else {
$toaddress = $mapping['default'];
}

Jim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


---End Message---
---BeginMessage---
This is what I had been using as the check based on the code that had been
there previously and along with an email validator that sets $email to 
if the address isn't valid. The purpose of the form is lead generation. The
last bit is to prevent spammers from entering urls in the class text box.

iif (($name == ) || ($email == ) || ($phone ==) || ($city==Select
your city) || ($class==) ||
preg_match(/[^A-Za-z0-9-\\s\\(\\)\\?\\:\\;@\\.trade;\\,\\ndash;\\'\\t]/uis,
$class))
{...}

Does this do the same thing as isset? Would isset be better?

April

On Sun, Jun 17, 2012 at 7:41 PM, James ja...@nixsecurity.org wrote:

 Same logical check with my personal preference ;)

 $toaddress = $mapping['default'];

 if ( isset($city)  isset($mapping[$city]) ) { ... }

 --
 Sent from my Android phone with K-9 Mail. Please excuse my brevity.

 Jim Lucas li...@cmsws.com wrote:

 On 6/15/2012 3:29 PM, Joshua Kehn wrote:
  Way easier to just use a map.
 
  $mapping = array(

 'Calgary' =  abc@emailaddress,
 'Brooks' =  def@emailaddress,
 // etc
  );
  $toaddress = $mapping[$city];

 I would use this, but add a check to it.

 $mapping = array(
'default' = 'defa...@domain.tld',
 ...
 );

 ...

 if ( isset($mapping[$city]) ) {
$toaddress = $mapping[$city];

 } else {
$toaddress = $mapping['default'];

 }

 Jim

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



---End Message---
---BeginMessage---
I'm working on an issue with IE9. I have a web app that posts a multipart form 
via Ajax. The content-length is about 1MB often larger (uploading GPS tracks). 
Chrome, Safari and Firefox all make the POST request then immediately (after 
the POST completes receives the response). IE on the other hand seems to hold 
on to the connection for up to five minutes (sometimes more). On Apache, the 
request eventually completes; on Nginx, the request never makes it to the 
php-fpm process.

ON Nginx I have the keep alives set to 65 seconds. Apache the keep alives are 
turned off (since I'm running mod_php under mpm-prefork). 

Any suggestions on how to fix this issue?

Chris Cowan---End Message---
---BeginMessage---

On 06/18/2012 08:21 AM, Christopher Cowan wrote:

Any suggestions on how to fix this issue?


If IE9 has a specific problem, I think one very good place is 
http://goo.gl/Eug3a




--
RMA.
---End Message---
---BeginMessage---

Lester Caine wrote:

Normally I'd just assume that PHP was not starting up, but since PHP is running
from command line and the .dll is in the right place I'm now a little confused
as to what I'm missing ...


OK switched to FastCGI, but that is complaining about 'can't load windows 
library' which I suspect is the same problem as the Apache Module has.


I suspect this has something to do with VC10 since the runtime library has to be 
updated to that to get FastCGI to load.


I do have a working setup using PHP5.4.0 with Apache 2.4.0, which seems to be 
the last version that installs out of the box on Xp32bit ...


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
---End Message---


php-general Digest 16 Jun 2012 22:35:46 -0000 Issue 7857

2012-06-16 Thread php-general-digest-help

php-general Digest 16 Jun 2012 22:35:46 - Issue 7857

Topics (messages 318257 through 318260):

Re: define()
318257 by: Maciek Sokolewicz
318258 by: Karl DeSaulniers
318259 by: Ashley Sheridan
318260 by: tamouse mailing lists

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---

On 16-06-2012 08:36, Karl DeSaulniers wrote:

Quick question phprz. Is it ok to put a token inside a define() statement?

IE:
define('TOKEN', $sometoken);

I guess what I am really after is if this can be read by a hacker?
I may be misguided as to what define()'s parameters are.
Once you define something it becomes a server variable?
And server variables are easy to read/get ?

If it is unsafe, what is the best method of storing/using a token so
that it can be called at will?
Kind of like a global, just more secure. Can you secure a define statement?

TIA,

Best,
Karl DeSaulniers
Design Drumm
http://designdrumm.com




I don't think you understand what define does, or what a constant is.

The define function literally defines a constant. That is, it creates 
a constant in your script.
A constant isn't a server variable, it's not some kind of special global 
whatever.


A constant is a kind of variable, but which is constant; that is, it can 
not change value once set. Constants in PHP look like variables, only 
without the preceding $-mark. They are not inherently safer or better 
than normal variables.


Now, the question we would all like to pose is: what are you trying to 
do?. You say you're looking for the best method of storing/using a 
token to be called at will. Then of course a good question would be 
what do you mean by 'token'? and what do you want to do with that 
'token'? Why is that 'token' so important to you?
---End Message---
---BeginMessage---


On Jun 16, 2012, at 6:39 AM, Maciek Sokolewicz wrote:


On 16-06-2012 08:36, Karl DeSaulniers wrote:
Quick question phprz. Is it ok to put a token inside a define()  
statement?


IE:
define('TOKEN', $sometoken);

I guess what I am really after is if this can be read by a hacker?
I may be misguided as to what define()'s parameters are.
Once you define something it becomes a server variable?
And server variables are easy to read/get ?

If it is unsafe, what is the best method of storing/using a token so
that it can be called at will?
Kind of like a global, just more secure. Can you secure a define  
statement?


TIA,

Best,
Karl DeSaulniers
Design Drumm
http://designdrumm.com




I don't think you understand what define does, or what a constant is.

The define function literally defines a constant. That is, it  
creates a constant in your script.
A constant isn't a server variable, it's not some kind of special  
global whatever.


A constant is a kind of variable, but which is constant; that is, it  
can not change value once set. Constants in PHP look like variables,  
only without the preceding $-mark. They are not inherently safer or  
better than normal variables.


Now, the question we would all like to pose is: what are you trying  
to do?. You say you're looking for the best method of storing/using  
a token to be called at will. Then of course a good question would  
be what do you mean by 'token'? and what do you want to do with  
that 'token'? Why is that 'token' so important to you?


Thanks for the reply. I had a feeling I was off-track.
I am using the token for a paypal verification. Paypals PDT.
Would like to know how to store safely in my config file to use in my  
scripts.


Karl DeSaulniers
Design Drumm
http://designdrumm.com

---End Message---
---BeginMessage---
On Sat, 2012-06-16 at 07:09 -0500, Karl DeSaulniers wrote:

 On Jun 16, 2012, at 6:39 AM, Maciek Sokolewicz wrote:
 
  On 16-06-2012 08:36, Karl DeSaulniers wrote:
  Quick question phprz. Is it ok to put a token inside a define()  
  statement?
 
  IE:
  define('TOKEN', $sometoken);
 
  I guess what I am really after is if this can be read by a hacker?
  I may be misguided as to what define()'s parameters are.
  Once you define something it becomes a server variable?
  And server variables are easy to read/get ?
 
  If it is unsafe, what is the best method of storing/using a token so
  that it can be called at will?
  Kind of like a global, just more secure. Can you secure a define  
  statement?
 
  TIA,
 
  Best,
  Karl DeSaulniers
  Design Drumm
  http://designdrumm.com
 
 
 
  I don't think you understand what define does, or what a constant is.
 
  The define function literally defines a constant. That is, it  
  creates a constant in your script.
  A constant isn't a server variable, it's not some kind of special  
  global whatever.
 
  A constant is a kind

php-general Digest 14 Jun 2012 11:55:30 -0000 Issue 7853

2012-06-14 Thread php-general-digest-help

php-general Digest 14 Jun 2012 11:55:30 - Issue 7853

Topics (messages 318231 through 318231):

global array
318231 by: Jeff Burcher

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---
Hi,

 

I am running PHP 5.4 on IIs 6 on a Windows SBS 2003 server. Here is a
streamlined version of the code I am dealing with. I tried to trim as much
as possible to only show code that deals with my issue. The main issue I
think I am having is the global array statement within the function is not
working. From all of the articles I have read, I seem to be doing it
correctly, yet it does not recognize $InvReq as an array within the
function. The array works just fine outside of the function, though. Here
are the error messages:

 

Notice: Undefined variable: InvReq (line numbers point to inside the
function)

Warning: array_key_exists() expects parameter 2 to be array, null given
(line numbers point to inside the function)

 

If anyone could point out where I have incorrect syntax or something else
that would interfere with the global reference for the array within the
function, or tell me I can't do what I am doing using arrays, but assume I
don't have the ability to write to an external work table, which is why I am
trying to use an array in the first place. Thanks.


-

?php

$InvReq = array();

 

// there is some database action here and other programming, but the core
issue is writing to the array, so assume I have all of the necessary data

// data loop to gather inventory requests ---

$linetotal = ???;

$hldpartID = ?; //these variables are provided
by looping, so this check/write/update code snippet happens many times to
update/write to the array

 

if (array_key_exists($hldpartID, $InvReq)) {

$InvReq[$hldpartID] += $linetotal;
//if this line will create the array entry if it does not exist, then I
don't need the key_exists check, anyone??

} else {

$InvReq[$hldpartID] = $linetotal;

}

 

Part_BOM($hldpartID, $linetotal, 1);   //function is
called the first time to set up the BOM

// end loop ---

 

// after gathering all of the inventory requests, check for inventory on
hand

reset ($InvReq);

while (list($PartID,) = each($InvReq)) {

// data loop to get inventory on hand ---

$OnHandQty = ???; //these variables
are provided by looping, so this check/write/update code snippet happens
many times to update/add to the array

 

if (array_key_exists($PartID, $InvReq)) {

$InvReq[$PartID] -=
$OnHandQty;

} else {

$InvReq[$PartID] =
$OnHandQty;

}

Part_BOM($PartID, $OnHandQty, 2);
//function is called the second time to trim up BOM

// end loop ---

}

// print list

$display_block = h2Part Forecast/h2tabletrthPart
Number/ththAmount Needed/th/tr;

reset ($InvReq);

while (list($PartID,$need) = each($InvReq)) {

$needout = number_format($need);

$display_block .=
trtd$PartID/tdtd$needout/td/tr;

}

$display_block .= /table;

 

//---this function adds or subtracts inventory to/from the BOM materials for
the part passed.

//---it also can add parts that make parts with their inventory total for a
multiple level BOM

 

function Part_BOM($PartID, $need, $phase) {

 

global $Invreq;

 

$BOMreq = $need * $BOMQty; //$BOMQty 
$BOMPartID are pulled from a database keyed by $PartID

 

if ($phase == 1) {

if (array_key_exists($BOMPartID, $InvReq)) {

$InvReq[$BOMPartID] +=
$BOMreq;  //first time through adds to array item totals

} else {

$InvReq[$BOMPartID] =
$BOMreq;

}

} else {

if (array_key_exists($BOMPartID, $InvReq)) {

$InvReq[$BOMPartID] -=
$BOMreq;   //second time through subtracts from array item totals

}

}

 

if (--check for parts within other parts for multiple level
BOM

php-general Digest 13 Jun 2012 21:50:09 -0000 Issue 7852

2012-06-13 Thread php-general-digest-help

php-general Digest 13 Jun 2012 21:50:09 - Issue 7852

Topics (messages 318218 through 318230):

Re: Searching IDE.
318218 by: Sharl Jimh Tsin
318219 by: Sebastian Krebs
318220 by: Louis Huppenbauer
318221 by: David Arroyo
318222 by: Lester Caine
318223 by: Simon Schick
318224 by: Simon Dániel
318225 by: Curtis Maurand
318226 by: Marc Guay
318227 by: Bastien Koert
318229 by: David Arroyo

how to walk async recursively over an object, doing work (in right order) per 
leaf
318228 by: rene7705
318230 by: Matijn Woudt

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---
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 2012年06月13日 17:11, David Arroyo wrote:
 Hi Folks,
 
 I am searching an IDE for php and web development, my options are 
 Aptana or Eclipse+PDT. What is your opinion?
 
 Thanks. Regards.
 
 --
 
NetBeans IDE.

- -- 
Best regards,
Sharl.Jimh.Tsin (From China **Obviously Taiwan INCLUDED**)

Using Gmail? Please read this important notice:
http://www.fsf.org/campaigns/jstrap/gmail?10073.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJP2Fv8AAoJEEYmNy4jisTjBRwH/2hjhwaYNkjcJEastwa7O6cq
ej/s95ssiQw/AA/qc/SdkC8qn830D+7UhP/ZwjfC1FGMWNWsx3MCO8KubhNoZ1B0
yXuXFoIbxwmmlloQ8gLNtn0a7Nb9HztzCxcHp1GgUaABgj/BQOQspPy8zqyaFTBI
WTFtUGrnz3DH1H+nyZhBfRUVCFMmOL7NZNBOMuc8bg+W+fhgtv+m2QJZLEZJKn72
OZrH8zsjr3rk5OL/W614zNirJ7KQ4RZlv8sUFqitxbBdiEx5qQXIeflmuCXlRlY2
D/F2ZKgb7NrIf5MW8GdwQUJrfoCPPTRApn4pkqcuJs+wsbwW2G/50gkVlE4xYq8=
=7o3e
-END PGP SIGNATURE-
---End Message---
---BeginMessage---
Hi,

2012/6/13 David Arroyo darr...@gmail.com

 Hi Folks,

 I am searching an IDE for php and web development, my options are
 Aptana or Eclipse+PDT.
 What is your opinion?


PhpStorm


 Thanks.
 Regards.

 --

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


---End Message---
---BeginMessage---
Hi there,

2012/6/13 David Arroyo darr...@gmail.com

 Hi Folks,

 I am searching an IDE for php and web development, my options are
 Aptana or Eclipse+PDT.
 What is your opinion?

 Thanks.
 Regards.


notepad++ or netbeans.
And although I haven't tried it yet, I heard the the Sublime Text Editor 2
is great.

Sincerely
Louis H.
---End Message---
---BeginMessage---
 I would like free, no pay a license.

On Wed, Jun 13, 2012 at 11:51 AM, David Arroyo darr...@gmail.com wrote:
 Sebastian, I would like free, no pay a license.
 Thanks for you opinion.

 On Wed, Jun 13, 2012 at 11:33 AM, Sebastian Krebs
 krebs@googlemail.com wrote:
 Hi,

 2012/6/13 David Arroyo darr...@gmail.com

 Hi Folks,

 I am searching an IDE for php and web development, my options are
 Aptana or Eclipse+PDT.
 What is your opinion?


 PhpStorm


 Thanks.
 Regards.

 --

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


---End Message---
---BeginMessage---

David Arroyo wrote:

I am searching an IDE for php and web development, my options are
Aptana or Eclipse+PDT.
What is your opinion?


I'm using Eclipse with PHPEclipse but PDT is probably just as good nowadays. 
PHPEclipse needs a few updates to handle some of the 'new features' in PHP.


The advantage of Eclipse is that ALL of my development work is done in the one 
IDE, so I can play with C/C++, Python, javascript and even occasionally Java 
without having to switch. It also runs transparently on both Linux and Windows 
platforms which I have to support ...


Need to fire up the java side again and have a look at fixing PHPEclipse ;)

--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
---End Message---
---BeginMessage---
Hi,

There was a discussion about that on Google+ ...

IDEs mentioned there:

__Free
* Eclipse PDT (5x)
* Aptana - based on Eclipse but not using PDT for PHP (2x)
* Netbeans (12x)
* VIM (6x)
* KDevelop (1x)
* gedit (3x)

__NonFree
* Sublime Text 2 (6x) - USD $59
* PhpStorm (7x) - €94 personal, €189 commercial
* Komodo (2x) - $382
* Zend Studio - also based on Eclipse (1x) - €299

Just by a rough view over the comments, not really reading any of those :)

My personal opinion:
* Eclipse PDT
** not used since 2008
** was way to slow, specially the file-search
** missed some good PHP code support ... code-completion for classes and
it's functions was quite

php-general Digest 12 Jun 2012 10:30:48 -0000 Issue 7850

2012-06-12 Thread php-general-digest-help

php-general Digest 12 Jun 2012 10:30:48 - Issue 7850

Topics (messages 318211 through 318215):

looking for a PHP texte indexer
318211 by: Mihamina Rakotomandimby
318212 by: marco.behnke.biz

Re: Which workstation
318213 by: Simon Schick

Re: show info from mysql db
318214 by: Jim Lucas

Problem with ssh2 public/private key connecting
318215 by: Radek Krejča

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---

Hi all,

I have a small job ad website, where some poster tend to flood with the 
same ad, just in order to be on top of the recent sort.


To perturb the strict duplication detection (yes it's weak), they add 
one or two words that makes difference.


The result is a duplication of many ads.

I would like to search for duplicates by looking for ads with 80%-90% 
same words and decide they're the same, so that I can group them.


Of course, putting a limiting mecanism or even a moderation is 
scheduled, but I want to process existing first.


I dont want to use MySQL for indexing, I believe text indexers are best 
tools for this: Am I wrong?


What would you suggest me to process and lookup for duplicates in that 
situation?


--
RMA.
---End Message---
---BeginMessage---


Mihamina Rakotomandimby miham...@rktmb.org hat am 11. Juni 2012 um 11:12
geschrieben:

 Hi all,

 I have a small job ad website, where some poster tend to flood with the
 same ad, just in order to be on top of the recent sort.

 To perturb the strict duplication detection (yes it's weak), they add
 one or two words that makes difference.

 The result is a duplication of many ads.

 I would like to search for duplicates by looking for ads with 80%-90%
 same words and decide they're the same, so that I can group them.

 Of course, putting a limiting mecanism or even a moderation is
 scheduled, but I want to process existing first.

 I dont want to use MySQL for indexing, I believe text indexers are best
 tools for this: Am I wrong?

 What would you suggest me to process and lookup for duplicates in that
 situation?

Maybe take a look at

http://de.php.net/manual/de/function.similar-text.php
http://de.php.net/manual/de/function.levenshtein.php



 --
 RMA.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz
---End Message---
---BeginMessage---
Hi, All

There was an interesting talk on the PHP Conference Spring 2012:
Concepts of Success: Choose Your Framework
http://phpconference.com/2012spring/keynotes#session-3

If somebody has been there, please write some notes ... I personally
haven't had the time to join but am quite interested, what the developer of
the frameworks say about their own systems in comparison to others. Pro and
(more interesting) Contra arguments.

The only stuff I found is in german and quite limited:
http://it-republik.de/php/artikel/FLOW3-Zend-Symfony-Auf-der-Suche-nach-dem-besten-Framework-4826.html

Bye
Simon

On Tue, Jun 5, 2012 at 2:22 PM, Simon Schick simonsimc...@googlemail.comwrote:

 Hi, Farzan

 I do not really get your point of confusion ...

 What you've posted here are tools/frameworks that do not to the same stuff
 at all, yes you could even use all without missing something ...

 cakephp
 .. is a full-stack PHP-Framework. Yes, I have to say that there's quite a
 bunch of full-stack frameworks in PHP you could choose and I myself would
 recommend one by knowing how much experience you have in PHP :)

 smarty
 .. is a template-engine for PHP. If you want to use smarty, twig, php
 itself or another library as template-engine is up to you. Using a
 template-engine for some programmers I know just feel like a better
 separation between the view and the controler/model (search for
 ModelViewControler if you don't know what I mean here).

 netbeans
 .. is an IDE where you can develop with. I prefer to use PhpStorm, others
 use EclipsePDT, Notepad++ or even the basic editor of windows. This is just
 about syntax-highlight, code-completion and other things helping you to
 develop your code.

 Hope that helps :)

 Bye
 Simon


 On Tue, Jun 5, 2012 at 2:10 PM, Farzan Dalaee farzan.dal...@gmail.comwrote:

 hi guys
 i really confuse by choosing the best work station for php ( cakephp ,
 smarty , net bean , ... ) , please give me some advisdes.
 and please tell why which one is better,
 tnx
 best regards farzan



---End Message---
---BeginMessage---

On 06/10/2012 09:50 AM, Tim Dunphy

php-general Digest 10 Jun 2012 12:26:05 -0000 Issue 7848

2012-06-10 Thread php-general-digest-help

php-general Digest 10 Jun 2012 12:26:05 - Issue 7848

Topics (messages 318206 through 318207):

show info from mysql db
318206 by: Tim Dunphy
318207 by: Tim Dunphy

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 tried designing a very basic couple of web pages tonight that was
solely meant to build some php chops. intentionally cheesy. I got half
the way there by designing a page that grabs some info from an html
form and puts that info into a mysql database.

This part works.  You can see that page here:

html
headtitleStarship Crew/title/head
body bgcolor=black
centerimg src=logo.jpg alt=Star Trek Logo  / /center
font size=3 color=white
style
.box{
font-family:Tahoma, Geneva, sans-serif;
font-size:16px;
text-align: center
}
/style

  pEnter your First Name, Last Name, Rank, Division,Ship and Email
address./p
  form method=post action=addcrew.php 

trtdlabel for=firstnameFirst name:/label
input type=text id=firstname name=firstname //td/trbr /
trlabel for=lastnameLast name:/label
input type=text id=lastname name=lastname //trbr /
trlabel for=rankRank:/label
input type=text id=rank name=rank /br //tr
trlabel for=divisionDivision:/label
input type=text id=division name=division /br //tr
trlabel for=shipShip:/label
input type=text id=ship name=ship /br //tr
tr/trlabel for=emailEmail:/label
input type=text id=email name=email /br //tr
input type=submit name=Submit value=Submit /
  /form

   a href='showcrew.php'Show crew manifest/a


centerimg src=enterprise.jpg alt=Enterprise  / /center
/font
/body
/html

This is the one table in the database:

mysql describe crew_manifest;
++-+--+-+-+---+
| Field  | Type| Null | Key | Default | Extra |
++-+--+-+-+---+
| first_name | varchar(20) | YES  | | NULL|   |
| last_name  | varchar(20) | YES  | | NULL|   |
| rank   | varchar(10) | YES  | | NULL|   |
| division   | varchar(10) | YES  | | NULL|   |
| ship   | varchar(20) | YES  | | NULL|   |
| email  | varchar(20) | YES  | | NULL|   |
++-+--+-+-+---+
6 rows in set (0.06 sec)

and this is the corresponding php page that inputs the info:

?php

$first_name = $_POST['firstname'];
$last_name = $_POST['lastname'];
$rank = $_POST['rank'];
$division =  $_POST['division'];
$ship = $_POST['ship'];
$email = $_POST['email'];

$dbc = mysqli_connect('127.0.0.1','admin','secret','trek_db')
   or die('Error connecting to MySQL database');


$query = INSERT INTO crew_manifest VALUES
('$first_name','$last_name','$rank','$division','$ship','$email');

$result = mysqli_query($dbc,$query)
  or die('Error querying database');

  echo crew member added;


  mysqli_close($dbc);


?

But the page that reads the info is the problem:

html
head
titleShow Crew/title
/head

body bgcolor=black
centerimg src=ncc1701.jpg alt=NCC 1701  / /center
font size=3 color=white
style
.box{
font-family:Tahoma, Geneva, sans-serif;
font-size:16px;
text-align: center
}
/style
centerCrew Manifest/center

?php

$dbc = mysqli_conect('127.0.0.1','admin','secret','trek_db')
 or die ('Could not connect to database');

$query = SELECT * FROM crew_manifest;

$result = mysqli_query($dbc,$query);

while ($row = mysqli_fetch_array($result)) {
$first_name = $row['first_name'];
$last_name = $row['last_name'];
$rank = $row['rank'];
$division = $row['division'];
$ship = $row['ship'];
$email = $row['email'];

echo  $rank . 'br /';
  }

   mysqli_close($dbc);


?
/font
/html

What I'd like to find out is why the while loop does not display info
from the database? The page does show up, but not any info from the
db.

Thanks in advance.

tim

-- 
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
---End Message---
---BeginMessage---
wow! this fixed it..

$dbc = mysqli_connect('127.0.0.1','admin',secret','trek_db')
 or die ('Could not connect to database');

used to be...

$dbc = mysqli_conect('127.0.0.1','admin','Duk30fZh0u','trek_db')
 or die ('Could not connect to database');


d'oh!! spelling counts!!! :)

On Sun, Jun 10, 2012 at 1:15 AM, Tim Dunphy bluethu...@gmail.com wrote:
 hello list,

  I tried designing a very basic couple of web pages tonight that was
 solely meant to build some php chops. intentionally cheesy. I got half
 the way there by designing a page

php-general Digest 9 Jun 2012 17:48:58 -0000 Issue 7847

2012-06-09 Thread php-general-digest-help

php-general Digest 9 Jun 2012 17:48:58 - Issue 7847

Topics (messages 318201 through 318205):

Re: SQL Injection
318201 by: Lester Caine
318202 by: Govinda
318203 by: Ashley Sheridan
318204 by: Govinda

Re: Your Amazon.com order confirmation.
318205 by: tamouse mailing lists

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---

Jim Lucas wrote:

Not to refute the above advice one bit (not to mention oppose the arguments
against escaping in general) ...  but just curious - can anyone demo a hack
that effectively injects past mysqli_real_escape_string(), while using utf-8
?  It may just be a matter of time (or already?) before
mysqli_real_escape_string is *proven* ineffective (w/utf-8) ... but here I am
just attempting to gather facts.



Ah, but what if I use sqlite or postgres?


Or Firebird ;)


IMHO, the discussion needs to be a the best way to prevent SQL injection across
all possible DB types.  Not just mysql.


The main thing to avoid is building queries from elements that are directly 
loaded from the form inputs. While it is difficult to build sort elements for 
queries that use parameters, having a mechanism like ADOdb's datadict where one 
can filter SQL based on the identified field names does make life easier.


While the problems of dealing with student names such as 'Delete from student' 
are easily solved by only using them in parameter arrays.


A few simple basics cover the vast majority of traditional SQL injection 
problems?

--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
---End Message---
---BeginMessage---
 Ah, but what if I use sqlite or postgres?
 
 Or Firebird ;)

good point.


 IMHO, the discussion needs to be a the best way to prevent SQL injection 
 across
 all possible DB types.  Not just mysql.
 
 The main thing to avoid is building queries from elements that are directly 
 loaded from the form inputs. While it is difficult to build sort elements for 
 queries that use parameters, having a mechanism like ADOdb's datadict where 
 one can filter SQL based on the identified field names does make life easier.
 
 While the problems of dealing with student names such as 'Delete from 
 student' are easily solved by only using them in parameter arrays.
 
 A few simple basics cover the vast majority of traditional SQL injection 
 problems?

Yes, apparently.   

Part of why I even asked is to get a sense of the shelf life on legacy code 
(that relies on escaping) which I am not keen to have to re-write, for free, 
until I really must.


-Govinda---End Message---
---BeginMessage---


Govinda govinda.webdnat...@gmail.com wrote:

 Ah, but what if I use sqlite or postgres?

 Or Firebird ;)

good point.


 IMHO, the discussion needs to be a the best way to prevent SQL
injection across
 all possible DB types.  Not just mysql.

 The main thing to avoid is building queries from elements that are
directly loaded from the form inputs. While it is difficult to build
sort elements for queries that use parameters, having a mechanism like
ADOdb's datadict where one can filter SQL based on the identified field
names does make life easier.

 While the problems of dealing with student names such as 'Delete from
student' are easily solved by only using them in parameter arrays.

 A few simple basics cover the vast majority of traditional SQL
injection problems?

Yes, apparently.

Part of why I even asked is to get a sense of the shelf life on legacy
code (that relies on escaping) which I am not keen to have to re-write,
for free, until I really must.


-Govinda
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

I think you can happily sanitise data where it makes sense, and use bound 
parameters elsewise. So when you expect a number, its easy to check for and 
force a sensible default. Likewise for things like dates, or names of articles 
(probably a popular need with a CMS) you can check and enforce particular 
characters.

Outside of that, without bound params you run a potential risk (even if only 
slight). You can do stuff like base64 encode values, but then you lose a lot of 
the ability to search through your DB after.

Thanks,
Ash
http://ashleysheridan.co.uk
---End Message---
---BeginMessage---
 I think you can happily sanitise data where it makes sense, and use bound 
 parameters elsewise. So when you expect a number, its easy to check for and 
 force a sensible

php-general Digest 8 Jun 2012 06:20:41 -0000 Issue 7845

2012-06-08 Thread php-general-digest-help

php-general Digest 8 Jun 2012 06:20:41 - Issue 7845

Topics (messages 318179 through 318191):

Re: A Question of SESSION
318179 by: Daniel P. Brown
318180 by: Daniel P. Brown
318185 by: Matijn Woudt

help with query
318181 by: Jack
318186 by: Ashley Sheridan
318187 by: Jim Lucas
318188 by: Jack Sasportas

test
318182 by: Sven Kowalski
318183 by: Camilo Sperberg
318184 by: Jay Blanchard

A problem about sessions
318189 by: Tazio Ceri
318190 by: Stuart Dallas
318191 by: As'ad Djamalilleil

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---
On Thu, Jun 7, 2012 at 11:15 AM, Tedd Sperling t...@sperling.com wrote:

 3. Looking for an explanation, I came across Daniel's post to the PHP manual, 
 which follows:

 http://www.webbytedd.com/b/sessions3

 Now I am totally bonkers.

 What am I not getting?

Anything.  Because that page 404's.  ;-P

Chances are, what you may be seeing as a post I made is, in fact,
just someone else's user note submission which I edited.

-- 
/Daniel P. Brown
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/
---End Message---
---BeginMessage---
On Thu, Jun 7, 2012 at 11:20 AM, Daniel P. Brown
daniel.br...@parasane.net wrote:
 On Thu, Jun 7, 2012 at 11:15 AM, Tedd Sperling t...@sperling.com wrote:

 3. Looking for an explanation, I came across Daniel's post to the PHP 
 manual, which follows:

 http://www.webbytedd.com/b/sessions3

I see: http://www.webbytedd.com/b/sessions2/  (not 3).

And yes, I edited the note, I didn't submit it.



 Now I am totally bonkers.

 What am I not getting?

    Anything.  Because that page 404's.  ;-P

    Chances are, what you may be seeing as a post I made is, in fact,
 just someone else's user note submission which I edited.

 --
 /Daniel P. Brown
 Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
 (866-) 725-4321
 http://www.parasane.net/



-- 
/Daniel P. Brown
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/
---End Message---
---BeginMessage---
On Thu, Jun 7, 2012 at 5:15 PM, Tedd Sperling t...@sperling.com wrote:
 Hi Daniel and gang:

 Considering I'm never afraid to show my ignorance, please review the 
 following example.

 Because of the way I normally use sessions and considering this way works for 
 me, I thought I knew what sessions were about -- but my faith is eroding.

 Cases in point

 1. The following is the way I normally use sessions (with COOKIES turned ON):

 http://www.webbytedd.com/b/sessions

 It works.

 2. Considering that people may have their COOKIES turned OFF, I tried this:

 http://www.webbytedd.com/b/sessions1/

 It works when COOKIES are turned ON, but the SID does not appear in the URL 
 -- I find that odd.

 However, if COOKIES are turned OFF, then SID does appear in the URL, but the 
 process of passing session variables doesn't work -- I find that confusing. 
 What's the point of passing the SID if it isn't going to be used?

 3. Looking for an explanation, I came across Daniel's post to the PHP manual, 
 which follows:

 http://www.webbytedd.com/b/sessions3

 Now I am totally bonkers.

 What am I not getting?

 Cheers,

 tedd


Hi Tedd,

I assume you're running PHP 5.3 or later, then
session.use_only_cookies in php.ini is default set to 1, which means
it doesn't accept PHPSESSID. Change that to 0, and it will probably
work.


- Matijn
---End Message---
---BeginMessage---
Hello All,

 

I have this string defined for my query and it shows the different types of
categories fine, but when I change a.categoryid = c.categoryid to
a.categoryid = 1 which is only one of the categories

It shows me the same record twice.

 

$query = select a.startdate, a.articleid, c.name, a.title, a.intro,
a.datecreated from articles as a, categories as c where (a.startdate = -1 or
a.startdate = {$now}) and (a.enddate = -1 or a.enddate = {$now}) and
a.categoryid = c.categoryid order by a.startdate DESC;

 

 

while ( $row = mysql_fetch_array($res) ) {

$tpldata['articles'][] = array(

'title' = $row['title'],

'intro' = makeLinks($row['intro']),

'id'= $row['articleid'],

'categoryname'  = $row['name'],

'created'   = date('n/j/Y',
$row['datecreated'])

);

//echo $row['datecreated'];

}

 

Any Ideas???

 

 

Thanks!

 

---End Message---
---BeginMessage---


Jack jacklistm

php-general Digest 8 Jun 2012 18:26:47 -0000 Issue 7846

2012-06-08 Thread php-general-digest-help

php-general Digest 8 Jun 2012 18:26:47 - Issue 7846

Topics (messages 318192 through 318200):

Re: Read dynamic variable from HTML form into PHP
318192 by: ioannes.btinternet.com

Re: A problem about sessions
318193 by: Tazio Ceri

Your Amazon.com order confirmation.
318194 by: digital-no-reply.amazon.com
318195 by: Dan McCullough

SQL Injection
318196 by: Ethan Rosenberg
318197 by: Adam Richardson
318198 by: Jen Rasmussen
318199 by: Govinda
318200 by: Jim Lucas

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---



There are essentially 2 ways:
1. All POSTed data is present in the $_POST superglobal array. So you
could just loop over that, ignore the fields you already knew were there,
and the data remaining is then essentially the data you seek. The keys in
the $_POST array are the fieldnames you are looking for.

2. There's a special trick in PHP, when you name a field name[] in HTML
and then POST it to a PHP script, it will turn into an array field. So
input name=a[] value=1  input name=a[] value=2  will then end up
in:
$_POST = [
'a' =  [
   0 =  '1',
   1 =  '2'
]
]

If you had not added the square-brackets, you would have:
input name=a value=1  input name=a value=2  ending up in:
$_POST = [
'a' =  '2'
]
Thus not ever seeing the value '1'.





form
checkbox field name=input_1 value=y
checkbox field name=input_2 value=y
field name input_n
..
/form

?
//checkboxes return on submit only if ticked
$query=SELECT id FROM table WHERE etc;
$result=mysql_db_query($db, $query,$connection);
$count=mysql_num_rows($result);
while($row=mysql_fetch_row($result)) {
$id=$row[0];
//dynamic variable
//if form uses textfield that returns on submit
//if(${input_.$id}==1){
//if checkbox that only returns if ticked
if(ISSET(${input_.$id})){
echo checked 1;
}
}
?
---End Message---
---BeginMessage---
Stuart Dallas stu...@3ft9.com ha scritto:

On 8 Jun 2012, at 00:39, Tazio Ceri wrote:

 I have a PHP script that takes very long time to execute. I manage it
using the following structure:
 
 ob_start();
 
 // some code
 session_start();
 // some code
 
 header(Content-length: .ob_get_length());
 ob_end_flush();
 
 // some other, very long, code!
 
 The problem I am facing is that, after having set up a session, often
I have error as
 I don't find any simple variable that I wrote in $_SESSION.
 Correct my if I am wrong, but I think that $_SESSION get saved to
disk only
 at the end of the script, after the very long code has been
executed.
 There is a way to save the session manually just after
ob_end_flush()?


http://php.net/session_write_close

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Thank you, I don't know how I overlooked that function.
Tazio Ceri
---End Message---
---BeginMessage---
   Your Order with Amazon.com  Thanks for your order, php-db-h...@lists.php.net!Did you know you can view and edit your  orders online, 24 hours a day? Visit Your Account.Order Information:
 E-mail Address:   php-db-h...@lists.php.netBillingAddress: Av.GAHANNAUnited States  Phone: 1-747-517-7595
 Order Grand

php-general Digest 5 Jun 2012 15:29:29 -0000 Issue 7842

2012-06-05 Thread php-general-digest-help

php-general Digest 5 Jun 2012 15:29:29 - Issue 7842

Topics (messages 318156 through 318167):

zend_auto_global_disable_jit missing in PHP 5.4.5
318156 by: freeone3000
318166 by: Daniel Brown
318167 by: Matijn Woudt

Re: long running php script won't complete :(
318157 by: rene7705

Re: disabled cookies
318158 by: Lester Caine

Re: 0.0.0.0  iplong()
318159 by: jas
318160 by: Matijn Woudt
318161 by: jas
318162 by: Chris Knipe
318165 by: Matijn Woudt

Which workstation
318163 by: Farzan Dalaee
318164 by: Simon Schick

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---
I'm working with a third-party PHP extension that makes a call to
zend_auto_global_disable_jit. However, in PHP5.4.5, there is no
zend_auto_global_disable_jit available, nor is it in its traditional
header. Commenting out all zend_auto_global_disable_jit calls causes
PHP to no longer recognize it as a valid extension, while leaving them
in attempts for an invalid method to be called.

The file in question is
https://github.com/mtorromeo/runkit/blob/master/runkit.c line 305. As
is relatively obvious, it's not part of a macro, and its removal
should not affect whether the library is a PHP extension or not -
perhaps it's based on PHP's static analysis? If it doesn't call the
function, it would access a global, possibly before the global has
been JIT initialized by the runtime. If this is the case, what is the
replacement function for PHP 5.4.5?

-- 
James Moore
---End Message---
---BeginMessage---
On Mon, Jun 4, 2012 at 11:30 PM, freeone3000 freeone3...@gmail.com wrote:
 I'm working with a third-party PHP extension that makes a call to
 zend_auto_global_disable_jit. However, in PHP5.4.5, there is no
 zend_auto_global_disable_jit available, nor is it in its traditional
 header. Commenting out all zend_auto_global_disable_jit calls causes
 PHP to no longer recognize it as a valid extension, while leaving them
 in attempts for an invalid method to be called.

 The file in question is
 https://github.com/mtorromeo/runkit/blob/master/runkit.c line 305. As
 is relatively obvious, it's not part of a macro, and its removal
 should not affect whether the library is a PHP extension or not -
 perhaps it's based on PHP's static analysis? If it doesn't call the
 function, it would access a global, possibly before the global has
 been JIT initialized by the runtime. If this is the case, what is the
 replacement function for PHP 5.4.5?

This is something you're going to want to ask on the Internals
list (CC'd).  General is more for questions on using the language.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/
---End Message---
---BeginMessage---
On Tue, Jun 5, 2012 at 4:39 AM, freeone3000 freeone3...@gmail.com wrote:
 I'm working with a third-party PHP extension that makes a call to
 zend_auto_global_disable_jit. However, in PHP5.4.5, there is no
 zend_auto_global_disable_jit available, nor is it in its traditional
 header. Commenting out all zend_auto_global_disable_jit calls causes
 PHP to no longer recognize it as a valid extension, while leaving them
 in attempts for an invalid method to be called.

 The file in question is
 https://github.com/mtorromeo/runkit/blob/master/runkit.c line 305. As
 is relatively obvious, it's not part of a macro, and its removal
 should not affect whether the library is a PHP extension or not -
 perhaps it's based on PHP's static analysis? If it doesn't call the
 function, it would access a global, possibly before the global has
 been JIT initialized by the runtime. If this is the case, what is the
 replacement function for PHP 5.4.5?

 --
 James Moore


There's a bug report about it at [1], though there's no solution there.

- Matijn

[1] https://bugs.php.net/bug.php?id=61189
---End Message---
---BeginMessage---
On Mon, Jun 4, 2012 at 6:52 PM, Matijn Woudt tijn...@gmail.com wrote:
 On Mon, Jun 4, 2012 at 5:57 PM, rene7705 rene7...@gmail.com wrote:
 Hi.

 I've got a piece of code that builds up a multi-meg test array for my
 opensourced http://mediabeez.ws/products/htmlMicroscope var_dump()
 improvement, and when I run it for longer than about 20 minutes, the
 browser just calls it quits.. :( Firefox, and chrome.

 I'd like to do this with a browser call, if all else fails I suppose I
 can run the generation of the test array from the commandline, but I
 prefer calling from the browser..

 So, I'm doing ob_start(), then start the main loop which does echo
 '.'; ob_flush(); flush();.

 I've got my KeepAliveTime set to 25 seconds, as per
 http://www.pctools.com/guides/registry/detail/891/

 And I'm

php-general Digest 2 Jun 2012 01:28:38 -0000 Issue 7836

2012-06-01 Thread php-general-digest-help

php-general Digest 2 Jun 2012 01:28:38 - Issue 7836

Topics (messages 318072 through 318096):

Re: How to insert a file in a class?
318072 by: sertcetin.itu.edu.tr
318073 by: LAMP
318074 by: LAMP
318075 by: marco.behnke.biz
318076 by: LAMP

progress indicators in browsers for long running php scripts?
318077 by: rene7705

Exception Handling
318078 by: James Colannino
318079 by: marco.behnke.biz
318080 by: Mackintosh, Mike
318081 by: James Colannino
318082 by: James Colannino
318083 by: James Colannino
318084 by: Mackintosh, Mike
318085 by: FeIn
318088 by: marco.behnke.biz
318091 by: James Colannino

Happy Diamond Jubilee everyone!
318086 by: Ashley Sheridan
318087 by: Daniel Brown
318092 by: Jason Pruim
318093 by: Paul M Foster

Using default argument values in the middle of the argument list
318089 by: 324706.mail.muni.cz

Re: is there a way to stop HTMLPurifier/CSStidy from forcing input CSS into all 
lowercase?
318090 by: Govinda

Open Call: Official PHP Mirror
318094 by: Daniel Brown

Simple Email System (SES) Provider
318095 by: Don Wieland
318096 by: Bastien Koert

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---

file_get_contents() ?


--
Ege Sertçetin

Alinti LAMP l...@afan.net


Hi to all.

Let's say there is a class

class Box
{
var $box_title;
var $box_content;

function __construct()
{
$this-box = '';
}


function box_title($title)
{
$this-title = $title;
}

function box_content($content)
{
$this-content = $content;
}

function make_box()
{
$this-box = 'h3'.$this-box_title.'/h3'.$this-box_content;
}


function get_box()
{
return $this-box;
}
}


$box = new Box();
$box-box_title('PHP Classes');
$box-box_content('Starting with PHP 5, the object model was  
rewritten to allow for better performance and more features. This  
was a major change from PHP 4. PHP 5 has a full object model.')

$box-make_box();
echo $box-get_box();

This works fine.

The problem I have is how to include a file as box_content? it  
could be plain text, but it could be a form or some kind of code.

$box-box_include(include(/path/to/file/file.php)) doesn't work, of course.

Wrapping up the whole code in a variable doesn't make a sense too:
# file.php
$content = '
form method=post action=$_SERVER['PHP_SELF']
Email = input type=text name=email
Pass = input type=password name=pass
input type=submit value=Submit
/form';

# main.php
$box = new Box();
$box-box_title('PHP Classes');
include(file.php);
$box-box_content($content);
$box-make_box();
echo $box-get_box();


Also, I'm sure I read once it's not correct to print directly from a  
class. First return a value/result to main code and then print.  
Correct?


LAMP




---End Message---
---BeginMessage---


On Jun 1, 2012, at 8:00 AM, Gibbs wrote:


On 01/06/12 13:41, LAMP wrote:

Hi to all.

Let's say there is a class

class Box
{
   var $box_title;
   var $box_content;

   function __construct()
   {
   $this-box = '';
   }


   function box_title($title)
   {
   $this-title = $title;
   }

   function box_content($content)
   {
   $this-content = $content;
   }

   function make_box()
   {
   $this-box = 'h3'.$this-box_title.'/h3'.$this- 
box_content;

   }


   function get_box()
   {
   return $this-box;
   }
}


$box = new Box();
$box-box_title('PHP Classes');
$box-box_content('Starting with PHP 5, the object model was  
rewritten to allow for better performance and more features. This  
was a major change from PHP 4. PHP 5 has a full object model.')

$box-make_box();
echo $box-get_box();

This works fine.

The problem I have is how to include a file as box_content? it  
could be plain text, but it could be a form or some kind of code.
$box-box_include(include(/path/to/file/file.php)) doesn't work, of  
course.


Wrapping up the whole code in a variable doesn't make a sense too:
# file.php
$content = '
form method=post action=$_SERVER['PHP_SELF']
   Email = input type=text name=email
   Pass = input type=password name=pass
input type=submit value=Submit
/form';

# main.php
$box = new Box();
$box-box_title('PHP Classes');
include(file.php);
$box-box_content($content);
$box-make_box();
echo $box-get_box();


Also, I'm sure I read once it's not correct to print directly

php-general Digest 30 May 2012 14:04:33 -0000 Issue 7832

2012-05-30 Thread php-general-digest-help

php-general Digest 30 May 2012 14:04:33 - Issue 7832

Topics (messages 318024 through 318030):

Re: Function size
318024 by: Paul M Foster
318025 by: Ashley Sheridan
318026 by: Tedd Sperling
318027 by: Paul M Foster
318028 by: Matijn Woudt
318029 by: Robert Cummings
318030 by: Tony Marston

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---
On Tue, May 29, 2012 at 08:52:46AM +0100, Tony Marston wrote:

 On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote:
   A rule of thumb is no more than 50 lines per
  function, most much less. Back in the day when we didn't have nifty
  gui screens and an 24 line terminals (yay green on black!), if a
  function exceeded one printed page, it was deemed too long and marked
  for refactoring.
 
 I think the idea of setting an arbitrary limit on the number of lines that a
 function should contain is quite ludicrous and something which I will
 completely ignore. If a function requires a hundred or more lines then so be
 it. The only reason to take a block of code and put it into its own function
 is when that code is likely to be called more than once so that it conforms
 to the DRY principle. If it is only ever used in one place then there is no
 point.
 
 The problems I have with creating lots of small used-only-once functions is
 as follows:
 - you have to create a meaningful name for each function.
 - all those functions should be arranged in alphabetical order within their
 containing file - having them in a random sequence makes it difficult to
 find the one you want.

OMG in alpha order?! At best, I might group them together by function
type, with some comment notation in the file. But not alpha order. I
prefer not to have forward declares in my files, so I generally
arrange functions so that those called by other functions later are
defined before they're called. (Probably a holdover from my C days; PHP
doesn't care.)

No offense. I never even thought about arranging functions in
alphabetical order. But I don't think I'd do it.

 - when browsing through the code you have to keep jumping to another
 function, and then returning to where you came from.
 
 I don't know about you, but I would rather use the scroll wheel on my mouse
 than keep jumping from one position in the file to another.
 
 Another problem I have encountered in the past with such an idea is that it
 encourages a stupid programmer to decrease the number of lines of code by
 compressing as many statements as possible into a single line, which then
 makes the code less easy to read and understand. This is much worse than
 having more than 20 lines in a function.

I think a lot of coders try to be kewler than the next 18 guys who are
gonna have to look at the code, so they use a lot of compression
techniques to reduce LOC. Plus, they're lazy. I'd rather see everything
with lots of spaces and plenty of comments and blank lines. Especially
since I'm sometimes that 18th guy to look at the code.

Paul

-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com
---End Message---
---BeginMessage---
On Tue, 2012-05-29 at 17:06 -0400, Paul M Foster wrote:

 On Tue, May 29, 2012 at 08:52:46AM +0100, Tony Marston wrote:
 
  On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote:
A rule of thumb is no more than 50 lines per
   function, most much less. Back in the day when we didn't have nifty
   gui screens and an 24 line terminals (yay green on black!), if a
   function exceeded one printed page, it was deemed too long and marked
   for refactoring.
  
  I think the idea of setting an arbitrary limit on the number of lines that a
  function should contain is quite ludicrous and something which I will
  completely ignore. If a function requires a hundred or more lines then so be
  it. The only reason to take a block of code and put it into its own function
  is when that code is likely to be called more than once so that it conforms
  to the DRY principle. If it is only ever used in one place then there is no
  point.
  
  The problems I have with creating lots of small used-only-once functions is
  as follows:
  - you have to create a meaningful name for each function.
  - all those functions should be arranged in alphabetical order within their
  containing file - having them in a random sequence makes it difficult to
  find the one you want.
 
 OMG in alpha order?! At best, I might group them together by function
 type, with some comment notation in the file. But not alpha order. I
 prefer not to have forward declares in my files, so I generally
 arrange functions so that those called by other functions later are
 defined before they're

php-general Digest 29 May 2012 07:52:59 -0000 Issue 7830

2012-05-29 Thread php-general-digest-help

php-general Digest 29 May 2012 07:52:59 - Issue 7830

Topics (messages 318010 through 318011):

Re: What is The best way/tool for debuging PHP?
318010 by: Lester Caine

Re: Function size
318011 by: Tony Marston

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---

LEOPARD Corporation wrote:

Dev-PHP is an IDE, and I don't need such tool because I'm using Eclipse,
and I'm very comfortable with.
Good to hear others are using Eclipse as well ;) I work on a lot more than just 
PHP so as a single platform it's great - even between Linux and Windows.



what I really want to know is:
what is the best pure debugging tool which its function is to debug PHP
scripts and applications only.
I'm still using PHPEclipse for the PHP editing, and while I do have xdebug 
installed with it, I tend not to have to bother 'debugging', I normally just 
need to add the occasional print_r() in the simple stuff, and the bitweaver 
framework has some additional debugging facilities built right in for tracking 
SQL problems and proving a pretty view of data provided by print_r(). A little 
longer winded than setting breakpoints, but it works well the majority of the time.


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
---End Message---
---BeginMessage---
On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote:
  A rule of thumb is no more than 50 lines per
 function, most much less. Back in the day when we didn't have nifty
 gui screens and an 24 line terminals (yay green on black!), if a
 function exceeded one printed page, it was deemed too long and marked
 for refactoring.

I think the idea of setting an arbitrary limit on the number of lines that a
function should contain is quite ludicrous and something which I will
completely ignore. If a function requires a hundred or more lines then so be
it. The only reason to take a block of code and put it into its own function
is when that code is likely to be called more than once so that it conforms
to the DRY principle. If it is only ever used in one place then there is no
point.

The problems I have with creating lots of small used-only-once functions is
as follows:
- you have to create a meaningful name for each function.
- all those functions should be arranged in alphabetical order within their
containing file - having them in a random sequence makes it difficult to
find the one you want.
- when browsing through the code you have to keep jumping to another
function, and then returning to where you came from.

I don't know about you, but I would rather use the scroll wheel on my mouse
than keep jumping from one position in the file to another.

Another problem I have encountered in the past with such an idea is that it
encourages a stupid programmer to decrease the number of lines of code by
compressing as many statements as possible into a single line, which then
makes the code less easy to read and understand. This is much worse than
having more than 20 lines in a function.

Whether a file contains 10 functions of 100 lines each, or 100 functions of
10 lines each, you still end up with 1000 lines of code. If you do not have
the mental capacity to deal with a 100-line function then you are in the
wrong job.

-- 
Tony Marston

http://www.tonymarston.net
http://www.radicore.org



---End Message---


php-general Digest 29 May 2012 20:57:11 -0000 Issue 7831

2012-05-29 Thread php-general-digest-help

php-general Digest 29 May 2012 20:57:11 - Issue 7831

Topics (messages 318012 through 318023):

Re: Function size
318012 by: Stuart Dallas
318017 by: Stuart Dallas
318021 by: Tedd Sperling
318023 by: Matijn Woudt

Re: Simple XML, (x)html, and xpath
318013 by: Gary

Too many arrays! My head is exploding!
318014 by: Gary
318015 by: Vikash Kumar
318016 by: Florian Lemaitre
318018 by: Gary
318019 by: Tedd Sperling
318020 by: Adam Richardson
318022 by: Tedd Sperling

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---
On 23 May 2012, at 15:14, Tedd Sperling wrote:

 Hi gang:
 
 On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote:
 A rule of thumb is no more than 50 lines per
 function, most much less. Back in the day when we didn't have nifty
 gui screens and an 24 line terminals (yay green on black!), if a
 function exceeded one printed page, it was deemed too long and marked
 for refactoring.
 
 You hit upon a theory of mine -- and that is our functions grow in size up to 
 our ability to view them in their totality. When our functions get beyond 
 that limit, we tend to refactor and reduce.
 
 I know from the last several decades of programming, my functions have 
 increased in number of lines. But, they have reached a limit that limit is 
 generally about the number of lines I can read in half of my monitor's 
 height. This of course, is dependent on monitor resolution, font-size, and 
 how far I am sitting from the monitor. But I think this is a natural and 
 physical limit that we don't normally recognize. I can cite studies that 
 support my theory.
 
 It would be an interesting survey to ask programmers to review their code and 
 provide the average number of lines in their functions AND how many lines of 
 code their monitor's can display. In other words, look at your editor; count 
 the number of lines your monitor can display; estimate the number of lines in 
 your average function; and report the findings.  For example, mine is about 
 half -- my monitor can display 55 lines of code and my average function is 
 around 25 lines. YMMV.
 
 Interesting, yes?

It's a theory, yes, and for many people it may be valid, but it's not for me. 
The resolution of your screen; the size of your font; the colour scheme you 
use. These should not be a factor in the way you write your code. If they are 
then you'll be making decisions for all the wrong reasons.

The art of software development is in taking a problem, breaking it up in to 
bite-size chunks, and putting those chunks together to form a practical 
solution. Anyone who considers themselves a better programmer because their 
functions are large due to their ability to handle large functions needs to 
keep their ego in check. Mental capacity has nothing to do with it.

My philosophy for functions is simple... a function does one well-defined, 
discrete task, and it does it well. The inputs are clearly specified, and the 
potential outputs/exceptions are fully understood. Sound familiar? These 
requirements make it incredibly easy to write unit tests for the code.

The number of times a function is used does not enter my field of interest. 
It's irrelevant, as is the number of lines in each function. Following this 
philosophy does naturally lead to fairly small functions, but as you move up 
the levels of abstraction they tend to grow larger. For PHP, I consider code in 
a file that's not within a function to be a function in itself, and the same 
philosophy applies.

I wasn't going to respond to this thread because I think it's a largely 
ridiculous topic, but some of the responses have scared me. Sir Cummings 
(hopefully) sarcastic response about using a 5px font size demonstrated how 
daft it is to base function size on how much code you can see on the screen at 
once.

Looking at the stats for your code is meaningless, and it's particularly 
meaningless if you're looking at lines rather than statements, but even then it 
lacks sufficient meaning to be worthwhile.

Shiplu posted a great video on using polymorphism to properly model different 
behaviours of a base type, and that's great, but for PHP you need to factory in 
the sizeable speed difference between using a switch statement and using 
objects. You should never let the elegance of a solution take priority over 
efficiency.

Tony had some curious comments...

On 29 May 2012, at 08:52, Tony Marston wrote:
 The only reason to take a block of code and put it into its own function
 is when that code is likely to be called more than once so that it conforms
 to the DRY principle. If it is only ever

php-general Digest 25 May 2012 12:39:00 -0000 Issue 7826

2012-05-25 Thread php-general-digest-help

php-general Digest 25 May 2012 12:39:00 - Issue 7826

Topics (messages 317994 through 317997):

Re: Function size
317994 by: Ashley Sheridan
317997 by: Tedd Sperling

Simple XML, (x)html, and xpath
317995 by: Gary
317996 by: marco.behnke.biz

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---
On Thu, 2012-05-24 at 15:48 -0500, tamouse mailing lists wrote:

 On May 23, 2012 9:14 AM, Tedd Sperling t...@sperling.com wrote:
 
  Hi gang:
 
  On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote:
A rule of thumb is no more than 50 lines per
   function, most much less. Back in the day when we didn't have nifty
   gui screens and an 24 line terminals (yay green on black!), if a
   function exceeded one printed page, it was deemed too long and marked
   for refactoring.
 
  You hit upon a theory of mine -- and that is our functions grow in size
 up to our ability to view them in their totality. When our functions get
 beyond that limit, we tend to refactor and reduce.
 
  I know from the last several decades of programming, my functions have
 increased in number of lines. But, they have reached a limit that limit is
 generally about the number of lines I can read in half of my monitor's
 height. This of course, is dependent on monitor resolution, font-size, and
 how far I am sitting from the monitor. But I think this is a natural and
 physical limit that we don't normally recognize. I can cite studies that
 support my theory.
 
  It would be an interesting survey to ask programmers to review their code
 and provide the average number of lines in their functions AND how many
 lines of code their monitor's can display. In other words, look at your
 editor; count the number of lines your monitor can display; estimate the
 number of lines in your average function; and report the findings.  For
 example, mine is about half -- my monitor can display 55 lines of code and
 my average function is around 25 lines. YMMV.
 
  Interesting, yes?
 
  Cheers,
 
  tedd
 
 
  _
  tedd.sperl...@gmail.com
  http://sperling.com
 
 
 
 
 
 
 Yes, I think that is *exactly* the criterion-- not a mystery or an emergent
 thing, really, was a pretty expicit reasoning--being able to see/scan the
 entire function on one page (or now in one screenful) makes it much easier
 to see what happens in the function, where blocks open/close, and it forces
 one to break up code into logical units.


With the odd exception being where code is more readable in a longer
format, as seen with my and several others examples of long functions
that rely heavily on switches. 

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk


---End Message---
---BeginMessage---
On May 24, 2012, at 4:48 PM, tamouse mailing lists wrote:

 Yes, I think that is *exactly* the criterion-- not a mystery or an emergent 
 thing, really, was a pretty expicit reasoning--being able to see/scan the 
 entire function on one page (or now in one screenful) makes it much easier to 
 see what happens in the function, where blocks open/close, and it forces one 
 to break up code into logical units.

While it may be obvious to you, there is considerable study on the ways we 
perceive things -- this is just one we apparently take for granted ... at least 
now.

Cheers,

tedd


_
t...@sperling.com
http://sperling.com

---End Message---
---BeginMessage---
If I use simplexml_load_string to create an XML object with the
following XHTML
,
| ?xml version=1.0?
| !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
| http://www.w3.org/TR/
| xhtml1/DTD/xhtml1-strict.dtd
| html xmlns=http://www.w3.org/1999/xhtml;
| headmeta http-equiv=Content-Type content=text/html; charset=UTF-8
| /
| titletest title/title
| /head
| body
| !-- comment --
| /body
| /html
`

I get this SimpleXMLElement back
,
| object(SimpleXMLElement)#1 (2) {
|   [head]=
|   object(SimpleXMLElement)#2 (1) {
| [title]=
| string(10) test title
|   }
|   [body]=
|   object(SimpleXMLElement)#3 (1) {
| [comment]=
| object(SimpleXMLElement)#4 (0) {
| }
|   }
| }
`

but I cannot seem to get anything out of an xpath expression, no matter
what I try.

If, however, I remove the 'xmlns=http://www.w3.org/1999/xhtml;' in the
html element, it works fine. So yeah, I can just remove that text,
but... is there something wrong here, in my expectation or in the xpath
function?

TIA.

-- 
GaryPlease do NOT send me 'courtesy' replies off-list.

---End Message---
---BeginMessage---


Gary listgj-phpgene...@yahoo.co.uk hat am 25. Mai 2012 um 09:57
geschrieben:

 If I use simplexml_load_string to create an XML object with the
 following

php-general Digest 20 May 2012 20:30:08 -0000 Issue 7818

2012-05-20 Thread php-general-digest-help

php-general Digest 20 May 2012 20:30:08 - Issue 7818

Topics (messages 317908 through 317912):

Re: errors not showing
317908 by: Simon J Welsh
317909 by: Tim Dunphy
317910 by: tamouse mailing lists
317912 by: Maciek Sokolewicz

Re: regexp novice
317911 by: Geoff Shang

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---
On 20/05/2012, at 3:55 PM, Tim Dunphy wrote:

 hello, list!
 
 I have 'error_reporting = E_ALL' set in my php.ini file. However when
 I run a php script that has errors in it all that happens is that the
 page WSODs. I am running Mac OS X 10.6. Any thoughts on why errors
 don't show up in the browser and how to correct this?
 
 
 Thanks
 Tim

You also need to set display_errors to On.
---
Simon Welsh
Admin of http://simon.geek.nz/

---End Message---
---BeginMessage---
Hello Simon,

 Thanks for your response.

 However I still can't seem to get errors to show up.

[dunphy@localhost:~/jf-current] #cat /private/etc/php.ini | grep -e
error_reporting -e display_errors
; display_errors
; error_reporting
error_reporting = E_ALL  E_NOTICE
;error_reporting = E_ALL  ~E_DEPRECATED
display_errors = On
; separately from display_errors. PHP's default behavior is to suppress those
; Eval the expression with current error_reporting().  Set to true if you want
; error_reporting(0) around the eval().

[dunphy@localhost:~/jf-current] #sudo apachectl -t
Syntax OK

[dunphy@localhost:~/jf-current] #sudo apachectl restart


[dunphy@localhost:~/jf-current] #uname -a
Darwin localhost 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7
16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 i386

I was wondering if there might be something else I might've missed?

Thanks
Tim

On Sat, May 19, 2012 at 11:57 PM, Simon J Welsh si...@welsh.co.nz wrote:
 On 20/05/2012, at 3:55 PM, Tim Dunphy wrote:

 hello, list!

 I have 'error_reporting = E_ALL' set in my php.ini file. However when
 I run a php script that has errors in it all that happens is that the
 page WSODs. I am running Mac OS X 10.6. Any thoughts on why errors
 don't show up in the browser and how to correct this?


 Thanks
 Tim

 You also need to set display_errors to On.
 ---
 Simon Welsh
 Admin of http://simon.geek.nz/




-- 
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
---End Message---
---BeginMessage---
On Sat, May 19, 2012 at 11:16 PM, Tim Dunphy bluethu...@gmail.com wrote:
 Hello Simon,

  Thanks for your response.

  However I still can't seem to get errors to show up.

 [dunphy@localhost:~/jf-current] #cat /private/etc/php.ini | grep -e
 error_reporting -e display_errors
 ; display_errors
 ; error_reporting
 error_reporting = E_ALL  E_NOTICE
 ;error_reporting = E_ALL  ~E_DEPRECATED
 display_errors = On
 ; separately from display_errors. PHP's default behavior is to suppress those
 ; Eval the expression with current error_reporting().  Set to true if you want
 ; error_reporting(0) around the eval().

 [dunphy@localhost:~/jf-current] #sudo apachectl -t
 Syntax OK

 [dunphy@localhost:~/jf-current] #sudo apachectl restart


 [dunphy@localhost:~/jf-current] #uname -a
 Darwin localhost 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7
 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 i386

 I was wondering if there might be something else I might've missed?

 Thanks
 Tim

 On Sat, May 19, 2012 at 11:57 PM, Simon J Welsh si...@welsh.co.nz wrote:
 On 20/05/2012, at 3:55 PM, Tim Dunphy wrote:

 hello, list!

 I have 'error_reporting = E_ALL' set in my php.ini file. However when
 I run a php script that has errors in it all that happens is that the
 page WSODs. I am running Mac OS X 10.6. Any thoughts on why errors
 don't show up in the browser and how to correct this?


 Thanks
 Tim

 You also need to set display_errors to On.
 ---
 Simon Welsh
 Admin of http://simon.geek.nz/




 --
 GPG me!!

 gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


Are these syntax errors or run-time errors? The former won't display
to the page at all, as they abort PHP before that point. Those written
to wherever PHP is set to log errors, which might be the same as the
apache error log unless you've set something specifically for it in
php.ini.

The best way I've found to suss out syntax errors is to lint the
source file with php -l from the command line.

On the other hand, if they are not syntax errors, then make sure you
set error_reporting and display_errors (I also always set
display_startup_errors as well) soon enough to catch them (and that
nothing you include turns them off).
---End

php-general Digest 18 May 2012 13:25:51 -0000 Issue 7816

2012-05-18 Thread php-general-digest-help

php-general Digest 18 May 2012 13:25:51 - Issue 7816

Topics (messages 317881 through 317892):

Re: regexp novice
317881 by: Jim Giner
317882 by: shiplu
317883 by: Yared Hufkens
317884 by: Jim Giner
317885 by: Govinda
317886 by: Jim Giner
317887 by: Jim Lucas
317888 by: Jim Giner
317889 by: Jim Lucas
317890 by: Jim Lucas
317891 by: shiplu
317892 by: Jim Giner

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---
OOPS
FORGOT to mention that I modify the string to add a colon if it is entered 
without one, so my regexp
always expects a : to be in the middle.  So in actuality - my regexp is 
'passing' a value of 13:00 as legitimate, when it should not be.


---End Message---
---BeginMessage---
On Fri, May 18, 2012 at 2:37 AM, Jim Giner jim.gi...@albanyhandball.comwrote:

 ok - finally had to come up with my own regexp - and am failing.

 Trying to validate an input of a time value in the format hh:mm, wherein
 I'll accept anything like the following:
 hmm
 hhmm
 h:mm
 hh:mm

 in a 12 hour format.  My problem is my test is ok'ing an input of 1300.

 Here is my test:

  if (0 == preg_match(/([0][1-9]|[1][0-2]|[1-9]):[0-5][0-9]/,$t))
return true;
 else
return false;

 Can someone help me correct my regexp?



I can not correct your regexp. But I must tell you that trying to tweak a
regex for hours is surely **not productive**. If you got any type of text
processing dont always go for regular expression. This problem can be
solved just by simple string parsing.
Here I have done that for you.


function valid_time($time){
$m  = (int) substr($time, -2);
$h  = (int) substr($time, 0, -2);
return ($h=0  $h13  $m=0  $m60);
}


-- 
Shiplu.Mokadd.im
ImgSign.com | A dynamic signature machine
Innovation distinguishes between follower and leader
---End Message---
---BeginMessage---
Try this:
/(0?[1-9]|[12][0-9]):?[0-5][0-9]/

FYI: ? is equal to {0,1}, and [1-9] to [123456789] (and therefore [1-2]
to [12]).


Am 17.05.2012 22:37, schrieb Jim Giner:
 ok - finally had to come up with my own regexp - and am failing.

 Trying to validate an input of a time value in the format hh:mm, wherein 
 I'll accept anything like the following:
 hmm
 hhmm
 h:mm
 hh:mm

 in a 12 hour format.  My problem is my test is ok'ing an input of 1300.

 Here is my test:

  if (0 == preg_match(/([0][1-9]|[1][0-2]|[1-9]):[0-5][0-9]/,$t))
 return true;
 else
 return false;

 Can someone help me correct my regexp? 



---End Message---
---BeginMessage---
Yared Hufkens y4...@yahoo.de wrote in message 
news:4fb5667d.7020...@yahoo.de...
 Try this:
 /(0?[1-9]|[12][0-9]):?[0-5][0-9]/

 FYI: ? is equal to {0,1}, and [1-9] to [123456789] (and therefore [1-2]
 to [12]).


 Am 17.05.2012 22:37, schrieb Jim Giner:
 ok - finally had to come up with my own regexp - and am failing.

 Trying to validate an input of a time value in the format hh:mm, wherein
 I'll accept anything like the following:
 hmm
 hhmm
 h:mm
 hh:mm

 in a 12 hour format.  My problem is my test is ok'ing an input of 1300.

 Here is my test:

  if (0 == preg_match(/([0][1-9]|[1][0-2]|[1-9]):[0-5][0-9]/,$t))
 return true;
 else
 return false;

 Can someone help me correct my regexp?




Nope - that didn't work.  Tested it against  1900, 1300 and 13:00 and all 
came thru as OK.
Also - I don't understand at all the following:

 FYI: ? is equal to {0,1}, and [1-9] to [123456789] (and therefore [1-2]
 to [12]).

I know (?) that [1-9] validates any digit from 1 to 9 - I was already using 
that.
And your point about [1-2] doesn't make sense to me since I need to validate 
10:00 which [1-2] in my usage would cause 10:00 to fail.
And I don't know what ? means at all.

FWIW - I couldn't find much in the way of tutorials on the meanings of the 
various chars in regexp's. 


---End Message---
---BeginMessage---
 
 FWIW - I couldn't find much in the way of tutorials on the meanings of the 
 various chars in regexp's. 

this helps alot:

http://www.gskinner.com/RegExr/

you can paste your pattern (needle) in  the top input, and hover over each char 
to see what it means in grep land.
Paste your haystack in the big box (input), under that, to see where all your 
needle will be found. 


 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

---End Message---
---BeginMessage---
Thank you !
Govinda govinda.webdnat...@gmail.com wrote in message 
news:3e5dce87-29c1-4679-ad3a-53326435f...@gmail.com...

 FWIW - I couldn't find much in the way of tutorials on the meanings of the
 various chars in regexp's.

this helps

php-general Digest 17 May 2012 20:39:55 -0000 Issue 7815

2012-05-17 Thread php-general-digest-help

php-general Digest 17 May 2012 20:39:55 - Issue 7815

Topics (messages 317879 through 317880):

Re: Performance / AB issue?
317879 by: Lars Nielsen

regexp novice
317880 by: Jim Giner

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---


 On Fri, May 11, 2012 at 9:53 AM, Camilo Sperberg unrea...@gmail.com
 wrote:


 Sent from my iPhone 5 Beta [Confidential use only]

 On 11 mei 2012, at 07:09, Lars Nielsen l...@lfweb.dk wrote:



 On 10 mei 2012, at 23:26, Lars Nielsen wrote:




 Sent from my iPhone 5 Beta [Confidential use only]

 On 10 mei 2012, at 17:40, Matijn Woudt tijn...@gmail.com wrote:

 On Thu, May 10, 2012 at 9:04 AM, Lars Nielsen l...@lfweb.dk
 wrote:
 Hi there,

 I have apache-2.22/php 5.3.10 set up on a dedicated server but I
 have
 a
 strange issue.

 I have made a Drupal 7 site with a mysql db.

 If I stress-test the site with : ab -c 1 -n 150 http://sitename/
 it
 works
 fine.
 If I stress-test the site with : ab -c 2 -n 20 http://sitename/
 it
 kills
 apache.
 If I stress-test the site with : ab -c 50 -n 1500
 http://sitename/static.html it works fine.

 I have set apache's errorlog to debug. But it writes nothing,
 either
 in
 the virtualhost or in the server-file.

 Can anyone give a hint about what can be wrong?



 What do you mean with 'kills apache', does it terminate apache or
 does
 apache hang (eg. 100% cpu), and respond normal after the stress
 test
 is over?
 And what is the index of your site? A php script, or..? Do you
 have
 ModRewrite redirects etc?

 - Matijn

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 Can you visit the site normally? Try less verbosing in apache, that
 is
 pretty intensive, but as you can benchmark a static file well (with
 moderate high settings), i assume it is some configuration problem
 in
 drupal.

 Greeting.
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



 Hi,

 I can visit the site normaly, but with 2-3 concurrent ab test it
 fails.
 seen from 'ps' and 'htop' it seems that both apache and mysql
 continues
 to
 run normaly but it doesnt respond.

 If i run netstat -an after the test it shows this :
 Active Internet connections (servers and established)
 Proto Recv-Q Send-Q Local Address           Foreign Address
  State
 tcp        0      0 0.0.0.0:22              0.0.0.0:*
        LISTEN
 tcp        0      0 127.0.0.1:25            0.0.0.0:*
  
      LISTEN
 tcp        0      0 127.0.0.1:3306          0.0.0.0:*  
      LISTEN
 tcp        0      0 0.0.0.0:80              0.0.0.0:*
        LISTEN
 tcp        1      0 x.x.x.x:80        x.x.x.x:39237  
 CLOSE_WAIT
 tcp        1      0 x.x.x.x:80        x.x.x.x:39236  
  CLOSE_WAIT
 tcp        0      0 x.x.x.x:22        x.x.x.x:47383  
  ESTABLISHED
 tcp        0      0 127.0.0.1:80          
  127.0.0.1:34775
 ESTABLISHED
 tcp        1      0 x.x.x.x:80        x.x.x.x:39300  
  CLOSE_WAIT
 ESTABLISHED
 tcp        0      0 127.0.0.1:34775         127.0.0.1:80
 ESTABLISHED
 tcp        0      0 x.x.x.x:80        x.x.x.x:39330  
  ESTABLISHED
 tcp6       0      0 :::22                   :::*
 LISTEN
 tcp6       0      0 ::1:25                  :::*
 LISTEN

 So it does seem like there should be room for new tcp connections?

 But if I restart apache then it works again... So I guess it is a
 apache/php configuration issue?

 --
 Med venlig hilsen / Best Regards

 LFWeb
 Lars Nielsen
 Thorsensvej 30
 4800 Nykøbing Falster
 Tlf: +45 20 64 85 76
 email : l...@lfweb.dk
 www : http://www.lfweb.dk


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 Have you tried benchmarking a really simple php page, such as

 ?php echo 'hello world'; ?

 ?

 It that works, than it is definitely an issue in Drupal's
 configuration
 and not in PHP/Apache. Additionally, you could check what happens
 when
 you
 try to establish a session or make a database call to rule out those
 as
 well, just make really simple tests that you know wouldn't fail and
 run ab
 on them.

 Greetings.


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 Thanks!

 Now I have made
 ?php
  echo Hey from PHP!;
 ?

 It runs fine from a little concurrency. But with -c 5 -n 500 it
 fails
 after 308 requests!



 Best Regards / Med venlig hilsen

 LFWeb
 Lars Nielsen


 --
 PHP General Mailing List (http

php-general Digest 14 May 2012 14:44:00 -0000 Issue 7813

2012-05-14 Thread php-general-digest-help

php-general Digest 14 May 2012 14:44:00 - Issue 7813

Topics (messages 317871 through 317876):

Re: Converting date string to unix timestamp
317871 by: Govinda

looking for some PECL PHP GTK tutorial
317872 by: Mihamina Rakotomandimby
317874 by: Matijn Woudt

Re: code deployment through php
317873 by: rene7705

Bug in DOMDocument schemaValidate() function?
317875 by: Voß, Marko
317876 by: Matijn Woudt

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---
 On another note, just curious why I keep getting your responses, but don't
 get the emails that I post.
 Anyone else having trouble with the list like that?
 
 That is how the mailing list works. You don't see the messages you send.

If you want to see your post, you can check (drill down) here:

http://marc.info/?l=php-general

-Govinda

---End Message---
---BeginMessage---

Hi all

As PHP-GTK has moved to the PECL, I suppose several part of this 
documentation are not relevent anymore: 
http://gtk.php.net/manual/en/tutorials.installation.linux.php


Would you know a place where I could find some way to work with it?

Thank you!


--
RMA.
---End Message---
---BeginMessage---
On Mon, May 14, 2012 at 7:05 AM, Mihamina Rakotomandimby
miham...@rktmb.org wrote:
 Hi all

 As PHP-GTK has moved to the PECL, I suppose several part of this
 documentation are not relevent anymore:
 http://gtk.php.net/manual/en/tutorials.installation.linux.php

 Would you know a place where I could find some way to work with it?

 Thank you!


Installing PECL packages under linux is as simple as:
$ pecl install packagename

- Matijn
---End Message---
---BeginMessage---
On Sun, May 6, 2012 at 3:32 PM, rene7705 rene7...@gmail.com wrote:
 On Sat, May 5, 2012 at 5:13 AM, tamouse mailing lists
 tamouse.li...@gmail.com wrote:

 On Wed, May 2, 2012 at 5:23 AM, rene7705 rene7...@gmail.com wrote:
  On Wed, May 2, 2012 at 11:47 AM, rene7705 rene7...@gmail.com wrote:
 
  I can't use anything like git on my shared hoster. But I suppose I
  could
  use something like git at home, and use a sync script like I posted in
  my
  OP on the shared hoster.
 
 
 
  Maybe you git gurus can help me along a bit further.
 
  I've managed to install msysgit and get it to work on my windows dev
  box,
  so far so good.
 
  Now, I'm wondering how to set up my repositories. The last cvs I used
  was
  Microsoft's visual source control back in the 90's, so I'm very rusty.
  At
  the same time, I'd prefer not to experiment too much..
 
  I've got a tree structure in a folder called simply code, that I have
  in
  several locations on my windows box.
 
  Each site that I develop for has a folder in
  .../htdocs/sites/somedomain.com,
  and many of these sites will need a copy of the common code folder in
  them. I can restrict myself to developing in one domain's subdir only.
  The non-common code for each domain is designed to run from any
  $_SERVER['SERVER_NAME'] and any sub-directory it happens to be in. In
  other
  words, http://my-dev-box.biz/sites/somedomain.com/ will show the same
  thing
  from windowze as http://somedomain.com will from shared hosted linux.
 
  I would also like to version control the non-common code for each
  domain.
 
  And I would like to store the entire repository on my windows box at
  home
  in 2 or 3 specific locations (on seperate disks encrypted with
  truecrypt.org,
  and also a truecrypted usb disk, if and when that's plugged in).
 
  For distributing the common code to the shared hosted live server (my
  workflow is to check finalized changes on my win box against all my
  sites
  that used the common code base, before deploying to the shared hoster
  live
  server), I can simply FTP one finalized copy and use the simplest of rm
  -rf
  and cp -r commands in a short script to distribute the changes. I could
  even do without the PHP filesync code I posted earlier (altho it was fun
  to
  build! :)
 
  That darn hoster of mine won't support git on shared hosting, only on
  much
  more expensive virtual dedicated and dedicated plans :(
  But I've also found
 
  http://serverfault.com/questions/26836/setting-up-a-git-repo-on-my-godaddy-hosting-plan
   and
 
  http://www.lyraphase.com/wp/uncategorized/how-to-build-git-for-a-host-with-no-compiler/
  that
  show me how I might get git running on my (kinda lame now) shared
  hosting
  account.
 
  Maybe a stupid question, but would perhaps copying the common code
  around
  with a simple script be faster than multiple pushes by git?


 Using git, you can set up either publicly hosted repositories on
 github.com or gitorious.org or perhaps other public repo places. If
 you don't want

php-general Digest 14 May 2012 00:13:33 -0000 Issue 7812

2012-05-13 Thread php-general-digest-help

php-general Digest 14 May 2012 00:13:33 - Issue 7812

Topics (messages 317859 through 317870):

Re: Variables via url
317859 by: Ashley Sheridan
317860 by: TR Shaw
317861 by: Tom Rogers
317862 by: Ashley Sheridan
317864 by: Adam Richardson
317868 by: Ashley M. Kirchner

Re: alias address in REMOTE_ADDR
317863 by: Mike Mackintosh

Time out issue
317865 by: admin
317866 by: Matijn Woudt
317867 by: admin
317869 by: Matijn Woudt

Re: Converting date string to unix timestamp
317870 by: tamouse mailing lists

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---
On Sat, 2012-05-12 at 09:21 -0400, Jim Giner wrote:

 Ashley M. Kirchner ash...@pcraft.com wrote in message 
 news:4fad9d8b.4020...@pcraft.com...
 
  Can someone point me at examples or directions on how I can pass a
  variable via a URL in the following way:
 
  http://server.domain.com//script///variable/
 
  I will only be passing one single /variable/.  And I want the
  /script/ to use that.
 
  I don't want to see what the script is, for example I don't want it
  to say 'script.php' or 'script.html' ...
 
  Is this possible through PHP only, or do I have to write a rewrite
  directive in Apache to accomplish this?
 
 
 A URL has to point to a script - how will your server know what to do with 
 the incoming URL if it doesn't point to something?  That said - format your 
 URL as a GET string and there's your variable.
 
 Ex.:
 
 http://server.domain.com/(scriptname)?variableanothervariableanothervariable
 
 Or - if this url is coming from an already running script, you could post 
 the var to a session var and then send a url without the script name and let 
 your server's default document (index.php ?) receive it and look up the 
 session var, but that's a pretty silly way to handle things just to hide the 
 scriptname.
 
 Of course, someone here with much more knowledge than I could very soon make 
 me look stupid  :) 
 
 
 


I think what you're looking for is URL rewriting. PHP by itself can't do
that, you need to do it at the server level, so an .htaccess file would
be along the right lines.
-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk


---End Message---
---BeginMessage---

On May 12, 2012, at 9:47 AM, Ashley Sheridan wrote:

 On Sat, 2012-05-12 at 09:21 -0400, Jim Giner wrote:
 
 Ashley M. Kirchner ash...@pcraft.com wrote in message 
 news:4fad9d8b.4020...@pcraft.com...
 
Can someone point me at examples or directions on how I can pass a
 variable via a URL in the following way:
 
http://server.domain.com//script///variable/
 
I will only be passing one single /variable/.  And I want the
 /script/ to use that.
 
I don't want to see what the script is, for example I don't want it
 to say 'script.php' or 'script.html' ...
 
Is this possible through PHP only, or do I have to write a rewrite
 directive in Apache to accomplish this?
 
 
 A URL has to point to a script - how will your server know what to do with 
 the incoming URL if it doesn't point to something?  That said - format your 
 URL as a GET string and there's your variable.
 
 Ex.:
 
 http://server.domain.com/(scriptname)?variableanothervariableanothervariable
 
 Or - if this url is coming from an already running script, you could post 
 the var to a session var and then send a url without the script name and let 
 your server's default document (index.php ?) receive it and look up the 
 session var, but that's a pretty silly way to handle things just to hide the 
 scriptname.
 
 Of course, someone here with much more knowledge than I could very soon make 
 me look stupid  :) 
 
 
 
 
 
 I think what you're looking for is URL rewriting. PHP by itself can't do
 that, you need to do it at the server level, so an .htaccess file would
 be along the right lines.

Ash is right; however you can leverage off of the index page  So your script 
would be in index.php and the url would be:

http://server.domain.com/some_optional_directory_path/?variable

Tom



---End Message---
---BeginMessage---
Hello Ashley,

Saturday, May 12, 2012, 9:15:23 AM, you wrote:


  Can someone point me at examples or directions on how I can pass a
 variable via a URL in the following way:

  http://server.domain.com//script///variable/

  I will only be passing one single /variable/.  And I want the 
 /script/ to use that.

  I don't want to see what the script is, for example I don't want it
 to say 'script.php' or 'script.html' ...

  Is this possible through PHP only, or do I have to write a rewrite
 directive in Apache to accomplish this?

You can add

php-general Digest 12 May 2012 13:22:02 -0000 Issue 7811

2012-05-12 Thread php-general-digest-help

php-general Digest 12 May 2012 13:22:02 - Issue 7811

Topics (messages 317847 through 317858):

Variables via url
317847 by: Ashley M. Kirchner
317858 by: Jim Giner

Re: Converting date string to unix timestamp
317848 by: Jim Lucas
317849 by: Karl DeSaulniers
317850 by: Karl DeSaulniers
317851 by: Jim Lucas
317852 by: Karl DeSaulniers

alias address in REMOTE_ADDR
317853 by: Tóth Csaba
317854 by: shiplu
317855 by: shiplu
317856 by: Jim Lucas

SOLVED: [PHP] alias address in REMOTE_ADDR
317857 by: Tóth Csaba

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---


Can someone point me at examples or directions on how I can pass a 
variable via a URL in the following way:


http://server.domain.com//script///variable/

I will only be passing one single /variable/.  And I want the 
/script/ to use that.


I don't want to see what the script is, for example I don't want it 
to say 'script.php' or 'script.html' ...


Is this possible through PHP only, or do I have to write a rewrite 
directive in Apache to accomplish this?
---End Message---
---BeginMessage---

Ashley M. Kirchner ash...@pcraft.com wrote in message 
news:4fad9d8b.4020...@pcraft.com...

 Can someone point me at examples or directions on how I can pass a
 variable via a URL in the following way:

 http://server.domain.com//script///variable/

 I will only be passing one single /variable/.  And I want the
 /script/ to use that.

 I don't want to see what the script is, for example I don't want it
 to say 'script.php' or 'script.html' ...

 Is this possible through PHP only, or do I have to write a rewrite
 directive in Apache to accomplish this?


A URL has to point to a script - how will your server know what to do with 
the incoming URL if it doesn't point to something?  That said - format your 
URL as a GET string and there's your variable.

Ex.:

http://server.domain.com/(scriptname)?variableanothervariableanothervariable

Or - if this url is coming from an already running script, you could post 
the var to a session var and then send a url without the script name and let 
your server's default document (index.php ?) receive it and look up the 
session var, but that's a pretty silly way to handle things just to hide the 
scriptname.

Of course, someone here with much more knowledge than I could very soon make 
me look stupid  :) 


---End Message---
---BeginMessage---

On 05/11/2012 04:11 PM, Karl DeSaulniers wrote:

Hello everyone,
Got a quick one (I hope), and probably an easy one.
For some reason it is eluding me at the moment.
Hoping someone can help.

I am building an ics file with PHP and the form that is submitting to
create this ics file has a jQuery date picker on it.
The date furnished comes to me like this Saturday, January 1, 2012,
and a time furnished like 4:20 pm with no seconds.

Now for the ics file, I need the date/time combo to be..

Ymd\THis\Z or in the case of the above date and time, 20120101T042000Z

Here is the block of code that I am using for this.



Why do you have so much code to do such a simple thing?

This works for me.

?php
$date = Saturday, January 1, 2012;
$time = 4:20 pm;

echo date('Ymd\THis\Z', strtotime($date.' '.$time));

// Outputs  20120107T162000Z

?

Check it out in action:
http://www.cmsws.com/examples/php/jquery_time_stamp.php
http://www.cmsws.com/examples/php/jquery_time_stamp.phps

Jim


CODE [
...
}
else {
$dt_start = $_POST[field20] ? $_POST[field20] : $_POST[field21];
//Saturday, January 1, 2012
$dt_end = $_POST[field22]; //Saturday, January 1, 2012
$t_start = $_POST[field24]; //4:20 pm
$t_end = $_POST[field25]; //5:55 pm
//date_default_timezone_set('UTC');
try {
$start_DT = new DateTime($dt_start .   . $t_start);
$st_date_fmt = new DateTime($start_DT-format(l, F d, Y\TH:ia T));
//$startdate_stamp = strtotime($st_date_fmt);
$startdate = $st_date_fmt-format('U');
//$startdate = date('Ymd\THis\Z', $startdate_stamp);
}
catch (Exception $e) {
trigger_error(startdate error:  . $e-getMessage(), E_USER_ERROR);
exit(1);
}
try {
if(empty($dt_end)) {
$enddate = $startdate + (60 * 60); //If no end date provided, enddate is
1 hour after startdate.
} else {
$end_DT = new DateTime($dt_end .   . $t_end);
$end_date_fmt = new DateTime($end_DT-format(l, F d, Y\TH:ia T));
//$enddate_stamp = strtotime($end_date_fmt);
$enddate = $end_date_fmt-format('U');
//$enddate = date('Ymd\THis\Z', $enddate_stamp);
}
}
catch (Exception $e) {
trigger_error(enddate error:  . $e-getMessage(), E_USER_ERROR);
exit(1);
}
$stampnow = date('Ymd\THis\Z', time());
//$datestampnow = strtotime($stampnow

php-general Digest 11 May 2012 07:53:24 -0000 Issue 7809

2012-05-11 Thread php-general-digest-help

php-general Digest 11 May 2012 07:53:24 - Issue 7809

Topics (messages 317837 through 317842):

Re: Performance / AB issue?
317837 by: Lars Nielsen
317838 by: Matijn Woudt
317840 by: Camilo Sperberg
317841 by: Lars Nielsen
317842 by: Camilo Sperberg

Re: Best practice question regarding set_include_path()
317839 by: tamouse mailing lists

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---



 Sent from my iPhone 5 Beta [Confidential use only]

 On 10 mei 2012, at 17:40, Matijn Woudt tijn...@gmail.com wrote:

 On Thu, May 10, 2012 at 9:04 AM, Lars Nielsen l...@lfweb.dk wrote:
 Hi there,

 I have apache-2.22/php 5.3.10 set up on a dedicated server but I have a
 strange issue.

 I have made a Drupal 7 site with a mysql db.

 If I stress-test the site with : ab -c 1 -n 150 http://sitename/ it
 works
 fine.
 If I stress-test the site with : ab -c 2 -n 20 http://sitename/ it
 kills
 apache.
 If I stress-test the site with : ab -c 50 -n 1500
 http://sitename/static.html it works fine.

 I have set apache's errorlog to debug. But it writes nothing, either in
 the virtualhost or in the server-file.

 Can anyone give a hint about what can be wrong?



 What do you mean with 'kills apache', does it terminate apache or does
 apache hang (eg. 100% cpu), and respond normal after the stress test
 is over?
 And what is the index of your site? A php script, or..? Do you have
 ModRewrite redirects etc?

 - Matijn

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 Can you visit the site normally? Try less verbosing in apache, that is
 pretty intensive, but as you can benchmark a static file well (with
 moderate high settings), i assume it is some configuration problem in
 drupal.

 Greeting.
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



Hi,

I can visit the site normaly, but with 2-3 concurrent ab test it fails.
seen from 'ps' and 'htop' it seems that both apache and mysql continues to
run normaly but it doesnt respond.

If i run netstat -an after the test it shows this :
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address   Foreign Address  State
tcp0  0 0.0.0.0:22  0.0.0.0:*LISTEN
tcp0  0 127.0.0.1:250.0.0.0:*LISTEN
tcp0  0 127.0.0.1:3306  0.0.0.0:*LISTEN
tcp0  0 0.0.0.0:80  0.0.0.0:*LISTEN
tcp1  0 x.x.x.x:80x.x.x.x:39237   CLOSE_WAIT
tcp1  0 x.x.x.x:80x.x.x.x:39236CLOSE_WAIT
tcp0  0 x.x.x.x:22x.x.x.x:47383ESTABLISHED
tcp0  0 127.0.0.1:80127.0.0.1:34775
ESTABLISHED
tcp1  0 x.x.x.x:80x.x.x.x:39300CLOSE_WAIT 
ESTABLISHED
tcp0  0 127.0.0.1:34775 127.0.0.1:80   
ESTABLISHED
tcp0  0 x.x.x.x:80x.x.x.x:39330ESTABLISHED
tcp6   0  0 :::22   :::*LISTEN
tcp6   0  0 ::1:25  :::*LISTEN

So it does seem like there should be room for new tcp connections?

But if I restart apache then it works again... So I guess it is a
apache/php configuration issue?

-- 
Med venlig hilsen / Best Regards

LFWeb
Lars Nielsen
Thorsensvej 30
4800 Nykøbing Falster
Tlf: +45 20 64 85 76
email : l...@lfweb.dk
www : http://www.lfweb.dk

---End Message---
---BeginMessage---
On Thu, May 10, 2012 at 11:26 PM, Lars Nielsen l...@lfweb.dk wrote:



 Sent from my iPhone 5 Beta [Confidential use only]

 On 10 mei 2012, at 17:40, Matijn Woudt tijn...@gmail.com wrote:

 On Thu, May 10, 2012 at 9:04 AM, Lars Nielsen l...@lfweb.dk wrote:
 Hi there,

 I have apache-2.22/php 5.3.10 set up on a dedicated server but I have a
 strange issue.

 I have made a Drupal 7 site with a mysql db.

 If I stress-test the site with : ab -c 1 -n 150 http://sitename/ it
 works
 fine.
 If I stress-test the site with : ab -c 2 -n 20 http://sitename/ it
 kills
 apache.
 If I stress-test the site with : ab -c 50 -n 1500
 http://sitename/static.html it works fine.

 I have set apache's errorlog to debug. But it writes nothing, either in
 the virtualhost or in the server-file.

 Can anyone give a hint about what can be wrong?



 What do you mean with 'kills apache', does it terminate apache or does
 apache hang (eg. 100% cpu), and respond normal after the stress test
 is over?
 And what is the index of your site? A php script, or..? Do you have
 ModRewrite redirects etc?

 - Matijn

 --
 PHP General

php-general Digest 11 May 2012 23:11:33 -0000 Issue 7810

2012-05-11 Thread php-general-digest-help

php-general Digest 11 May 2012 23:11:33 - Issue 7810

Topics (messages 317843 through 317846):

Re: Performance / AB issue?
317843 by: Matijn Woudt
317844 by: Mike Mackintosh
317845 by: Lars Nielsen

Converting date string to unix timestamp
317846 by: Karl DeSaulniers

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---
On Fri, May 11, 2012 at 9:53 AM, Camilo Sperberg unrea...@gmail.com wrote:


 Sent from my iPhone 5 Beta [Confidential use only]

 On 11 mei 2012, at 07:09, Lars Nielsen l...@lfweb.dk wrote:



 On 10 mei 2012, at 23:26, Lars Nielsen wrote:




 Sent from my iPhone 5 Beta [Confidential use only]

 On 10 mei 2012, at 17:40, Matijn Woudt tijn...@gmail.com wrote:

 On Thu, May 10, 2012 at 9:04 AM, Lars Nielsen l...@lfweb.dk wrote:
 Hi there,

 I have apache-2.22/php 5.3.10 set up on a dedicated server but I have
 a
 strange issue.

 I have made a Drupal 7 site with a mysql db.

 If I stress-test the site with : ab -c 1 -n 150 http://sitename/ it
 works
 fine.
 If I stress-test the site with : ab -c 2 -n 20 http://sitename/ it
 kills
 apache.
 If I stress-test the site with : ab -c 50 -n 1500
 http://sitename/static.html it works fine.

 I have set apache's errorlog to debug. But it writes nothing, either
 in
 the virtualhost or in the server-file.

 Can anyone give a hint about what can be wrong?



 What do you mean with 'kills apache', does it terminate apache or does
 apache hang (eg. 100% cpu), and respond normal after the stress test
 is over?
 And what is the index of your site? A php script, or..? Do you have
 ModRewrite redirects etc?

 - Matijn

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 Can you visit the site normally? Try less verbosing in apache, that is
 pretty intensive, but as you can benchmark a static file well (with
 moderate high settings), i assume it is some configuration problem in
 drupal.

 Greeting.
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



 Hi,

 I can visit the site normaly, but with 2-3 concurrent ab test it fails.
 seen from 'ps' and 'htop' it seems that both apache and mysql continues
 to
 run normaly but it doesnt respond.

 If i run netstat -an after the test it shows this :
 Active Internet connections (servers and established)
 Proto Recv-Q Send-Q Local Address           Foreign Address  State
 tcp        0      0 0.0.0.0:22              0.0.0.0:*        LISTEN
 tcp        0      0 127.0.0.1:25            0.0.0.0:*        LISTEN
 tcp        0      0 127.0.0.1:3306          0.0.0.0:*        LISTEN
 tcp        0      0 0.0.0.0:80              0.0.0.0:*        LISTEN
 tcp        1      0 x.x.x.x:80        x.x.x.x:39237   CLOSE_WAIT
 tcp        1      0 x.x.x.x:80        x.x.x.x:39236    CLOSE_WAIT
 tcp        0      0 x.x.x.x:22        x.x.x.x:47383    ESTABLISHED
 tcp        0      0 127.0.0.1:80            127.0.0.1:34775
 ESTABLISHED
 tcp        1      0 x.x.x.x:80        x.x.x.x:39300    CLOSE_WAIT
 ESTABLISHED
 tcp        0      0 127.0.0.1:34775         127.0.0.1:80
 ESTABLISHED
 tcp        0      0 x.x.x.x:80        x.x.x.x:39330    ESTABLISHED
 tcp6       0      0 :::22                   :::*
 LISTEN
 tcp6       0      0 ::1:25                  :::*
 LISTEN

 So it does seem like there should be room for new tcp connections?

 But if I restart apache then it works again... So I guess it is a
 apache/php configuration issue?

 --
 Med venlig hilsen / Best Regards

 LFWeb
 Lars Nielsen
 Thorsensvej 30
 4800 Nykøbing Falster
 Tlf: +45 20 64 85 76
 email : l...@lfweb.dk
 www : http://www.lfweb.dk


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 Have you tried benchmarking a really simple php page, such as

 ?php echo 'hello world'; ?

 ?

 It that works, than it is definitely an issue in Drupal's configuration
 and not in PHP/Apache. Additionally, you could check what happens when you
 try to establish a session or make a database call to rule out those as
 well, just make really simple tests that you know wouldn't fail and run ab
 on them.

 Greetings.


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 Thanks!

 Now I have made
 ?php
  echo Hey from PHP!;
 ?

 It runs fine from a little concurrency. But with -c 5 -n 500 it fails
 after 308 requests!



 Best Regards / Med venlig hilsen

 LFWeb
 Lars Nielsen


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 Have you tried benchmarking from localhost? Do you have any

php-general Digest 10 May 2012 07:05:04 -0000 Issue 7807

2012-05-10 Thread php-general-digest-help

php-general Digest 10 May 2012 07:05:04 - Issue 7807

Topics (messages 317829 through 317829):

Performance / AB issue?
317829 by: Lars Nielsen

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---
Hi there,

I have apache-2.22/php 5.3.10 set up on a dedicated server but I have a
strange issue.

I have made a Drupal 7 site with a mysql db.

If I stress-test the site with : ab -c 1 -n 150 http://sitename/ it works
fine.
If I stress-test the site with : ab -c 2 -n 20 http://sitename/ it kills
apache.
If I stress-test the site with : ab -c 50 -n 1500
http://sitename/static.html it works fine.

I have set apache's errorlog to debug. But it writes nothing, either in
the virtualhost or in the server-file.

Can anyone give a hint about what can be wrong?


Best regards
LFWeb
Lars Nielsen

---End Message---


php-general Digest 9 May 2012 07:03:47 -0000 Issue 7806

2012-05-09 Thread php-general-digest-help

php-general Digest 9 May 2012 07:03:47 - Issue 7806

Topics (messages 317824 through 317828):

Re: How to send XML requests from PHP?
317824 by: Jim Lucas
317825 by: Matijn Woudt
317826 by: Michelle Konzack
317827 by: Jim Lucas
317828 by: marco.behnke.biz

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---

On 05/08/2012 10:50 AM, Michelle Konzack wrote:

Hello *,

I have to implement an interface which must access a Domain-Registration
API.  From the manual I have for example:

8--
Example 2.8. Contact Update:valid(change password)

Change password from multipass to green

REQUEST:

Generic Operation: 
POST(http://backend.example.com/bdom/contact/update/DOJOB0001/1/,xml)

Where xml:

?xml version=1.0 encoding=UTF-8?
request xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   typePERS/type
   sexMALE/sex
   first-nameOtto/first-name
   last-nameNormalverbraucher/last-name
   organisationAcme Gmbh/organisation
   streetMain Strasse/street
   number13/number
   postcode55/postcode
   cityNewe Stad/city
   countryDE/country
   phone+040.0123456789/phone
   fax+040.0123456789/fax
   emailh...@nictest.de/email
   passwordnew_secret/password
/request


RESPONSE:

response1 updated/response
8--

The problem is (I am sitting on my line) that I do  not  understand  how
to send this XML stuff.

Any hints please?

Thanks, Greetings and nice Day/Evening
 Michelle Konzack



Look into cURL http://php.net/curl


--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/
---End Message---
---BeginMessage---
On Tue, May 8, 2012 at 7:50 PM, Michelle Konzack
linux4miche...@tamay-dogan.net wrote:
 Hello *,

 I have to implement an interface which must access a Domain-Registration
 API.  From the manual I have for example:

 8--
 Example 2.8. Contact Update:valid(change password)

 Change password from multipass to green

 REQUEST:

 Generic Operation: 
 POST(http://backend.example.com/bdom/contact/update/DOJOB0001/1/,xml)

 Where xml:

 ?xml version=1.0 encoding=UTF-8?
 request xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
  typePERS/type
  sexMALE/sex
  first-nameOtto/first-name
  last-nameNormalverbraucher/last-name
  organisationAcme Gmbh/organisation
  streetMain Strasse/street
  number13/number
  postcode55/postcode
  cityNewe Stad/city
  countryDE/country
  phone+040.0123456789/phone
  fax+040.0123456789/fax
  emailh...@nictest.de/email
  passwordnew_secret/password
 /request


 RESPONSE:

 response1 updated/response
 8--

 The problem is (I am sitting on my line) that I do  not  understand  how
 to send this XML stuff.

 Any hints please?

 Thanks, Greetings and nice Day/Evening
    Michelle Konzack


Try one of the available XML classes that are included in PHP [1].
Both XMLWriter [2] and SimpleXML [3] will do the job.

- Matijn

[1] www.php.net/XML
[2] www.php.net/XMLWriter
[3] www.php.net/SimpleXML
---End Message---
---BeginMessage---
Hello Jim Lucas,

Am 2012-05-08 11:08:13, hacktest Du folgendes herunter:
 Look into cURL http://php.net/curl

I know curl but I do not know, HOW to send the XML stuff.

The XML code is generated using a temp file for logging, which  mean,  I
can see any changes on the system...

Thanks, Greetings and nice Day/Evening
Michelle Konzack

-- 
# Debian GNU/Linux Consultant ##
   Development of Intranet and Embedded Systems with Debian GNU/Linux
   Internet Service Provider, Cloud Computing
http://www.itsystems.tamay-dogan.net/

itsystems@tdnet Jabber  linux4miche...@jabber.ccc.de
Owner Michelle Konzack

Gewerbe Strasse 3   Tel office: +49-176-86004575
77694 Kehl  Tel mobil:  +49-177-9351947
Germany Tel mobil:  +33-6-61925193  (France)

USt-ID:  DE 278 049 239

Linux-User #280138 with the Linux Counter, http://counter.li.org/


signature.pgp
Description: Digital signature
---End Message---
---BeginMessage---

On 05/08/2012 11:25 AM, Michelle Konzack wrote:

Hello Jim Lucas,

Am 2012-05-08 11:08:13, hacktest Du folgendes herunter:

Look into cURL http://php.net/curl


I know curl but I do not know, HOW to send the XML stuff.

The XML code is generated using a temp file for logging, which  mean,  I
can see any changes on the system...

Thanks, Greetings and nice Day

php-general Digest 8 May 2012 17:42:39 -0000 Issue 7805

2012-05-08 Thread php-general-digest-help

php-general Digest 8 May 2012 17:42:39 - Issue 7805

Topics (messages 317816 through 317823):

Re: IDE
317816 by: Simon Schick

I need a good access and error log..
317817 by: rene7705
317818 by: admin
317819 by: Lester Caine
317820 by: Ashley Sheridan
317821 by: rene7705
317822 by: marco.behnke.biz

How to send XML requests from PHP?
317823 by: Michelle Konzack

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---
On Mon, May 7, 2012 at 3:10 AM, Ethan Rosenberg eth...@earthlink.net wrote:


 ===
 Simon -

 Thanks.


 I don't think you're talking about auto-form-fill and stuff like
 that, are you?


 No, I am not.

 Please send me your xdebug-config file.

 Thanks

 Ethan



Hi, Ethan

I forgot to mention that the whole configuration of my test-webserver
is on github ;) There are my configuration-files for apache, mysql,
nginx, php, solr and so on.
But I have to say that my environment is a bit special as I am
developing on a windows-machine and this configuration is running on a
virtual linux machine. Don't hesitate to ask things about the
configuration :)
https://github.com/SimonSimCity/webserver-configuration
For each program I have an init.sh script which will install the
program exactly the way I use it.
Feel free to fork it and add your stuff.

If you're just looking for the xdebug-configuration:
https://github.com/SimonSimCity/webserver-configuration/blob/master/php/conf/conf.d/xdebug.ini
You might have to change it to use it on a windows-environment ... at
least you'd have to move it into your php.ini file instead of an
separate configuration-file as it is on Linux.

As I am the only one developing on this machine, I've configured
xdebug in that way, that anyone can open a xdebug-debug-session. This
is done by enabling xdebug.remote_connect_back. Please do not use this
on your live-server, but set an ip-limit using xdebug.remote_host!

Please read this part of the xdebug-configuration to get a better
understanding on how to set up a working environment (specially the
part Starting The Debugger):
http://xdebug.org/docs/remote

The only problem I can report so far is, that I can't debug
command-line scripts ... If someone else reading that post has an
answer, I'd be glad to hear it.

Bye
Simon
---End Message---
---BeginMessage---
Hi.

I've been using Google Analytics, and I'm sure I'm using the analytics
code correctly, but when I checked my dev server's apache access logs
(dozens of hits per day) against what Google Analytics reports (zip,
zero, nada), I realized I needed something different. BTW, I'm not the
only one to report this problem
(https://www.google.nl/search?aq=fsourceid=chromeie=UTF-8q=google+analytics+lower+number)

I thought of rolling something of my own, a PHP-MySQL based
access+error log, add a viewer for it (http://dygraphs.com/ perhaps),
and spend the next month perfecting it..
But before I start coding, I thought it would be better to ask you all
what you use to see who's visiting your sites and when.
Oh, I need something that will work on shared hosting (php+mysql).

Thanks for your input.

(and purists; I couldn't think of a better place to post this, as this
is a large community of web developers who use the same language as I
do. I may even end up writing an opensourced php logging facility for
you)
---End Message---
---BeginMessage---
-Original Message-
From: rene7705 [mailto:rene7...@gmail.com] 
Sent: Monday, May 07, 2012 3:00 AM
To: php-general
Subject: [PHP] I need a good access and error log..

Hi.

I've been using Google Analytics, and I'm sure I'm using the analytics code
correctly, but when I checked my dev server's apache access logs (dozens of
hits per day) against what Google Analytics reports (zip, zero, nada), I
realized I needed something different. BTW, I'm not the only one to report
this problem
(https://www.google.nl/search?aq=fsourceid=chromeie=UTF-8q=google+analyti
cs+lower+number)

I thought of rolling something of my own, a PHP-MySQL based
access+error log, add a viewer for it (http://dygraphs.com/ perhaps),
and spend the next month perfecting it..
But before I start coding, I thought it would be better to ask you all what
you use to see who's visiting your sites and when.
Oh, I need something that will work on shared hosting (php+mysql).

Thanks for your input.

(and purists; I couldn't think of a better place to post this, as this is a
large community of web developers who use the same language as I do. I may
even end up writing an opensourced php logging facility for
you)

--


I have seen and dealt with this for a few companies.
I have setup PHP scripting, JavaScript, Perl

php-general Digest 6 May 2012 12:54:43 -0000 Issue 7803

2012-05-06 Thread php-general-digest-help

php-general Digest 6 May 2012 12:54:43 - Issue 7803

Topics (messages 317805 through 317810):

I'm missing something
317805 by: Jim Giner
317806 by: Matijn Woudt
317807 by: Jim Giner
317808 by: Jim Giner
317809 by: Matijn Woudt

PHP Subroutine Call Blowing UP with Strings
317810 by: George R Smith

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---
I have a discrepancy in the number of elements in my arrays and can't see 
why.

Here is some code:
Note the lines with the ***

*** $plyrs = 0;
 unset($plyrnames_ar);
 unset($js_names);
 unset($js_seeds);
*** $rows = mysql_num_rows($qrslts);
***echo in mysql there are $rows rowsbr;
 while ($row = mysql_fetch_array($qrslts))
 {   // build the name value here
  $mi = ($row['MI']=='') ? '' :  .$row['MI'];
  $nm = $row['LastName']., .$row['FirstName'].$mi;
  if ($row['srtdbls']=='X')
  {
   $mi = ($row['partMI']=='') ? '' :  .$row['partMI'];
   $nm .= /.$row['partLN']., .$row['partFN'].$mi;
  }
***  $plyrs++;
  $plyrnames_ar[$nm] = $row['Draw_pos'];
 }
*** echo before sort there are .count($plyrnames_ar). in 
plyrsnames_arbr;
 ksort($plyrnames_ar);
 foreach ($plyrnames_ar as $nm=$sd)
 {
  $js_names[] = $nm;
  $js_seeds[] = $sd;
 }
*** echo plyrs is $plyrs and there are .count($js_names). entries in 
js_rnames and .count
***($plyrnames_ar). entries in plyrnames_ar and .count($js_seeds). in 
js_seeds;
 exit();

The problem is that my $plyrs field comes up 18, while in truth there are 
only 17 rows of data in my database.
All of the other array-size counts echo out as being only 17, but my $rows 
and $plyrs fields come up as 18.  I was having problems with my javascript 
showing an undefined array element and took a bit o time to determine what 
it was and where it was happening.

Questions - does mysql_num_rows return a extra row that somehow doesn't get 
processed in the while loop? And if it does how come the counter ($plyrs) 
that I put into the loop comes up higher than it should.? 


---End Message---
---BeginMessage---
On Sun, May 6, 2012 at 12:38 AM, Jim Giner jim.gi...@albanyhandball.com wrote:
 I have a discrepancy in the number of elements in my arrays and can't see
 why.

 Here is some code:
 Note the lines with the ***

 *** $plyrs = 0;
  unset($plyrnames_ar);
  unset($js_names);
  unset($js_seeds);
 *** $rows = mysql_num_rows($qrslts);
 ***echo in mysql there are $rows rowsbr;
  while ($row = mysql_fetch_array($qrslts))
  {   // build the name value here
  $mi = ($row['MI']=='') ? '' :  .$row['MI'];
  $nm = $row['LastName']., .$row['FirstName'].$mi;
  if ($row['srtdbls']=='X')
  {
   $mi = ($row['partMI']=='') ? '' :  .$row['partMI'];
   $nm .= /.$row['partLN']., .$row['partFN'].$mi;
  }
 ***  $plyrs++;
  $plyrnames_ar[$nm] = $row['Draw_pos'];
  }
 *** echo before sort there are .count($plyrnames_ar). in
 plyrsnames_arbr;
  ksort($plyrnames_ar);
  foreach ($plyrnames_ar as $nm=$sd)
  {
  $js_names[] = $nm;
  $js_seeds[] = $sd;
  }
 *** echo plyrs is $plyrs and there are .count($js_names). entries in
 js_rnames and .count
 ***($plyrnames_ar). entries in plyrnames_ar and .count($js_seeds). in
 js_seeds;
  exit();

 The problem is that my $plyrs field comes up 18, while in truth there are
 only 17 rows of data in my database.
 All of the other array-size counts echo out as being only 17, but my $rows
 and $plyrs fields come up as 18.  I was having problems with my javascript
 showing an undefined array element and took a bit o time to determine what
 it was and where it was happening.

 Questions - does mysql_num_rows return a extra row that somehow doesn't get
 processed in the while loop? And if it does how come the counter ($plyrs)
 that I put into the loop comes up higher than it should.?



My guess would be that you end up with 2 rows having the same $nm,
overwriting the value that's already in $plyrnames_ar.

- Matijn
---End Message---
---BeginMessage---


My guess would be that you end up with 2 rows having the same $nm,
overwriting the value that's already in $plyrnames_ar.

- Matijn

Genius at work!  Thanks - I'll look into that. 


---End Message---
---BeginMessage---
Yup that was it!  Something I knew would happen during my design, but forgot 
to code for now.

Jim Giner jim.gi...@albanyhandball.com wrote in message 
news:e2.dc.30075.c6ea5...@pb1.pair.com...


 My guess would be that you end up with 2 rows having the same $nm,
 overwriting the value that's already in $plyrnames_ar.

 - Matijn
 
 Genius at work!  Thanks - I'll look into that.
 


---End Message---
---BeginMessage---
On Sun, May 6, 2012 at 12:53 AM, Jim Giner jim.gi...@albanyhandball.com wrote:
 Yup

php-general Digest 7 May 2012 01:10:31 -0000 Issue 7804

2012-05-06 Thread php-general-digest-help

php-general Digest 7 May 2012 01:10:31 - Issue 7804

Topics (messages 317811 through 317815):

Re: PHP Subroutine Call Blowing UP with Strings
317811 by: Maciek Sokolewicz

Re: code deployment through php
317812 by: rene7705

IDE
317813 by: Ethan Rosenberg
317814 by: Simon Schick
317815 by: Ethan Rosenberg

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---

On 06-05-2012 14:54, George R Smith wrote:

root@dellT710:/var/www# php qm_get_clients.php
*** glibc detected *** php: free(): invalid next size (fast): 0x0a2c3998 ***


Sounds like a segfault to me, which is fully the fault of the extension, 
and not something you're doing in PHP. Try asking the developers of the 
QM extension for help.


- Tul
---End Message---
---BeginMessage---
On Sat, May 5, 2012 at 5:13 AM, tamouse mailing lists 
tamouse.li...@gmail.com wrote:

 On Wed, May 2, 2012 at 5:23 AM, rene7705 rene7...@gmail.com wrote:
  On Wed, May 2, 2012 at 11:47 AM, rene7705 rene7...@gmail.com wrote:
 
  I can't use anything like git on my shared hoster. But I suppose I could
  use something like git at home, and use a sync script like I posted in
 my
  OP on the shared hoster.
 
 
 
  Maybe you git gurus can help me along a bit further.
 
  I've managed to install msysgit and get it to work on my windows dev box,
  so far so good.
 
  Now, I'm wondering how to set up my repositories. The last cvs I used was
  Microsoft's visual source control back in the 90's, so I'm very rusty. At
  the same time, I'd prefer not to experiment too much..
 
  I've got a tree structure in a folder called simply code, that I have
 in
  several locations on my windows box.
 
  Each site that I develop for has a folder in .../htdocs/sites/
 somedomain.com,
  and many of these sites will need a copy of the common code folder in
  them. I can restrict myself to developing in one domain's subdir only.
  The non-common code for each domain is designed to run from any
  $_SERVER['SERVER_NAME'] and any sub-directory it happens to be in. In
 other
  words, http://my-dev-box.biz/sites/somedomain.com/ will show the same
 thing
  from windowze as http://somedomain.com will from shared hosted linux.
 
  I would also like to version control the non-common code for each domain.
 
  And I would like to store the entire repository on my windows box at home
  in 2 or 3 specific locations (on seperate disks encrypted with
 truecrypt.org,
  and also a truecrypted usb disk, if and when that's plugged in).
 
  For distributing the common code to the shared hosted live server (my
  workflow is to check finalized changes on my win box against all my sites
  that used the common code base, before deploying to the shared hoster
 live
  server), I can simply FTP one finalized copy and use the simplest of rm
 -rf
  and cp -r commands in a short script to distribute the changes. I could
  even do without the PHP filesync code I posted earlier (altho it was fun
 to
  build! :)
 
  That darn hoster of mine won't support git on shared hosting, only on
 much
  more expensive virtual dedicated and dedicated plans :(
  But I've also found
 
 http://serverfault.com/questions/26836/setting-up-a-git-repo-on-my-godaddy-hosting-plan
   and
 
 http://www.lyraphase.com/wp/uncategorized/how-to-build-git-for-a-host-with-no-compiler/
  that
  show me how I might get git running on my (kinda lame now) shared hosting
  account.
 
  Maybe a stupid question, but would perhaps copying the common code around
  with a simple script be faster than multiple pushes by git?


 Using git, you can set up either publicly hosted repositories on
 github.com or gitorious.org or perhaps other public repo places. If
 you don't want you code to be publicly available, you can set up
 private repositories as well.

 Not being familiar with Windows implementations much at all, I can't
 tell you specifically what to do with msysgit, so these will be more
 generic instructions.

 I'm going to assume you don't have a host somewhere with ssh access.
 In this case you'll most likely want/need to set up your repository on
 your local system. (Note that it isn't *strictly* necessary to have a
 repository -- you can clone a new tree from the existing code tree,
 however having a repository can ensure a clean code set in case your
 working tree gets out of sync somehow.)

 (These instructions are modified from

 http://tumblr.intranation.com/post/766290565/how-set-up-your-own-private-git-server-linux
 )

 First, create a directory you want to hold all of your local
 repositories (such as C:\User\rene\MyRepositories). Then create a
 subdirectory off that to hold your server/application common code
 (C

php-general Digest 5 May 2012 22:35:42 -0000 Issue 7802

2012-05-05 Thread php-general-digest-help

php-general Digest 5 May 2012 22:35:42 - Issue 7802

Topics (messages 317793 through 317804):

Re: Calculating driving distance between UK postcodes
317793 by: tamouse mailing lists

Re: function
317794 by: tamouse mailing lists
317797 by: Jim Giner
317801 by: tamouse mailing lists
317802 by: tamouse mailing lists

Re: PHP  Emacs
317795 by: tamouse mailing lists

Re: Retrieve pages from an ASP driven site
317796 by: tamouse mailing lists

Re: Running through an enormous SQL file
317798 by: Brian Dunning
317800 by: tamouse mailing lists

Re: get content rss feed
317799 by: tamouse mailing lists

Re: code deployment through php
317803 by: tamouse mailing lists

Re: PHP  Database Problems -- Code Snippets
317804 by: Matijn Woudt

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---
On Fri, May 4, 2012 at 9:18 AM, Terry Ally (Gmail) terrya...@gmail.com wrote:
 Google works in Javascript extensively - not a language with which I
 have in-depth experience hence my reason for asking for PHP solution.

 For example the following will get me a JSON output with the distance in
 Kms and time. I don't know how to get PHP to read this information and
 extract just the distance. I need the distance so that I can calculate cost
 of a trip.

 form id=google action=
 http://maps.googleapis.com/maps/api/distancematrix/json; method=get
 input type=text name=origins value= /
 input type=text name=destinations value= /
 input type=hidden name=sensor value=false
 input type=hidden name=submitted value=1
 bra type=submit
 onClick=document.getElementById('google').submit()strongstrongGet
 Distance/strong/strong/a
 /form

Using Google Maps API is pretty straight-forward. You don't need to
set up a form or a use a POST to get the info. This page should
describes how to use a standard GET query to get the info you want:

 https://developers.google.com/maps/documentation/distancematrix/ 

Setting up the proper URL to call, you can activate it using
file_get_contents provided you have allow_url_fopen set to true in
php.ini. (Do make sure to check for possible errors returned.)

You can get the response back as either JSON or XML, both of which PHP
can parse into useful data structures:

 http://us.php.net/manual/en/function.json-decode.php 

 http://us.php.net/manual/en/book.simplexml.php 
---End Message---
---BeginMessage---
On Thu, May 3, 2012 at 9:12 PM, Ron Piggott
ron.pigg...@actsministries.org wrote:
 I need to access a FUNCTION I programmed within a different FUNCTION.  Are 
 these able to be passed like a variable?  Or are they able to become like a 
 $_SESSION variable in nature?  How am I able to do this?

 I am essentially programming:

 ===
 function name( $flag1, $flag2 ) {

 # some PHP

 echo name_of_a_different_function( $flag1 , $flag2 );

 }
 ===

 The error I am receiving is “Call to undefined function 
 name_of_a_different_function”

Where is name_of_a_different_function defined? If it is somewhere in
the same file as name, that shouldn't be a problem, provided it is
defined in the same namespace/scope as name. If it is defined in a
different file, you need to include that file before you make the echo
statement.

For example:

function func1 ($flag1, $flag2) {

   # blah blah

   echo func2($flag1, $flag2);
}

function func2 ($flag1, $flag2) {

   #blah blah

   return some string value;
}

in the same file should be just fine. It doesn't really matter what
order func1 and func2 are declared in.

However, if func2 is defined in some_other_file.php, you need to
include it in this_file.php (where func1 is defined) first:

this_file.php:
include('some_other_file.php');

function func1 ($flag1, $flag2) {

   #blah blah

   echo func2 ($flag1, $flag2);
}


some_other_file.php:
function func2 ($flag1, $flag2) {

   #blah blah

   return some string value;
}

If func2 is a method for an object/class, you'll have to access it
that way in func1:

this_file.php:
include('MyClass.php');
function func1 ($flag1, $flag2) {

   # blah blah, instantiate object?
   $myobj = new MyClass();

   echo $myobj-func2 ($flag1, $flag2);
}

MyClass.php:
class MyClass
{
   function func2 ($flag1, $flag2) {

  #blah blah
  return some string value;
   }
}
---End Message---
---BeginMessage---
But the OP says function is defined inside a different function.  Your 
theories to a solution don't fit that problem.
tamouse mailing lists tamouse.li...@gmail.com wrote in message 
news:cahuc_t-416_-lpcn3mo8qqxwrh4pnq5fmwouhwpdk+hmkgh...@mail.gmail.com...
On Thu, May 3, 2012 at 9:12 PM, Ron Piggott
ron.pigg...@actsministries.org wrote:

Where

php-general Digest 4 May 2012 12:43:41 -0000 Issue 7800

2012-05-04 Thread php-general-digest-help

php-general Digest 4 May 2012 12:43:41 - Issue 7800

Topics (messages 317763 through 317772):

Re: PHP Mailto() - Google now displaying HTML as Plain Text
317763 by: Terry Ally (Gmail)

Re: PHP  Database Problems -- Code Snippets
317764 by: Ethan Rosenberg

PDF Form Field
317765 by: Dan Joseph
317766 by: David OBrien
317767 by: David OBrien
317768 by: Dan Joseph

function
317769 by: Ron Piggott
317770 by: Dan Joseph
317771 by: Simon Schick

Re: PHP  Emacs
317772 by: Gerardo Benitez

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---
Hi all,

This question is now closed.

There is nothing wrong with my script.

It was an error by Google when they switched over to the new-look email and
have since rectified the issue and all is back to normal.

Thanks to all who have responded.

Terry



On 3 May 2012 21:05, Gerardo Benitez gerardobeni...@gmail.com wrote:

 Do you know if the mailto script allow set headers?

 Probably you must set a html header, something like this
 $headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n;


 Regards,
 Gerardo.

 On Tue, May 1, 2012 at 5:14 PM, Marco Behnke ma...@behnke.biz wrote:

 
 
  Am 29.04.2012 22:31, schrieb Terry Ally (Gmail):
 
  Hi all,
 
  I have been using a mailto() script for the last three years and from
  April
  25, 2012 incoming HTML email in Goggle mail is displaying as Plain Text.
   Something clearly changed with Google. Perhaps there is some change I
  need
  to make with my script??
 
  $message .= pbMessage:/b**blockquote  .$m./blockquote/p;
 
 
  As far as I can see your main html tags are missing?
 
  $message = 'htmlbody' . $message . '/body/html';
 
 
  --
  Marco Behnke
  Dipl. Informatiker (FH), SAE Audio Engineer
  Zend Certified Engineer PHP 5.3
 
  Tel.: 0174 / 9722336
  e-Mail: ma...@behnke.biz
 
  Softwaretechnik Behnke
  Heinrich-Heine-Str. 7D
  21218 Seevetal
 
  http://www.behnke.biz
 
 
 


 --
 Gerardo Benitez
 -
 Programador Web Freelance




-- 
*Terry Ally*
Twitter.com/terryally
Facebook.com/terryally
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
To print or not to print this email is the environmentally-searching
question!
Which has the highest ecological cost? A sheet of paper or constantly
switching on your computer and connecting to the Internet to read your
email?
---End Message---
---BeginMessage---

At 06:47 PM 5/2/2012, Matijn Woudt wrote:
On Wed, May 2, 2012 at 11:43 PM, Ethan Rosenberg 
eth...@earthlink.net wrote:  Dear list -   
Sorry for the attachment. Â Here are code 
snippets --- Ethan, I don't want to sound rude, 
but it appears to me you don't have any 
understanding of what you're doing. It might 
help if you understand what the code is doing... 
Let me explain.   GET THE DATA FROM 
INTAKE3:   Â  Â function handle_data()  Â  Â 
{  Â  Â  Â  global $cxn;  Â  Â  Â  $query = 
select * from Intake3 where  1; 
      if(isset($_Request['Sex']) 
trim($_POST['Sex']) != '' ) $_Request does not 
exists, you're looking for $_REQUEST. And why 
are you mixing $_REQUEST and $_POST here?  
      {             if 
($_REQUEST['Sex'] === 0)  Â  Â  Â  Â  Â  Â 
{  Â  Â  Â  Â  Â  Â  Â  $sex = 'Male';  
           }             else  
           {                $sex = 
'Female';  Â  Â  Â  Â  Â  Â }  Â  Â  Â  }   
   } What is the point of the handle_data 
function above? It doesn't do anything.  Â  Â 
$allowed_fields = array  Â  Â  Â  ( Â 'Site' 
=$_POST['Site'], 'MedRec' = $_POST['MedRec'], 
'Fname' =  $_POST['Fname'], 'Lname' = 
$_POST['Lname'] ,  Â  Â  Â  Â  Â  Â  'Phone' = 
$_POST['Phone'] , 'Sex' = $_POST['Sex'] Â , 
'Height'  = $_POST['Height'] Â );   Â  Â 
if(empty($allowed_fields))  Â  Â {  
         echo ouch;     }      
$query = select * from Intake3  where  1 
;   Â  Â foreach ( $allowed_fields as $key = 
$val )  Â  Â {  Â  Â  Â  if ( (($val != '')) 
)      {        $query .=  AND ($key  
= '$val') ;  Â  Â }  Â  Â  Â  $result1 = 
mysqli_query($cxn, $query);  Â  Â } First, this 
will allow SQL injections, because you insert 
the values directly from the browser. Second, 
you should move the last line ($result1=...), 
outside of the foreach loop, now you're 
executing the query multiple times. Third, you 
should check if $result1 === FALSE, in case the 
query fails   Â  Â $num = 
mysqli_num_rows($result1);  Â  Â if(($num = 
mysqli_num_rows($result1)) == 0) Doing the same 
thing twice?  Â  Â {  ?  Â  Â br /br 
/centerbp style=color: red; 
font-size:14pt; No Records  Retrieved 
#1/center/b/style/p  ?php  Â  Â 
exit();  Â  Â }   DISPLAY

php-general Digest 3 May 2012 20:05:51 -0000 Issue 7799

2012-05-03 Thread php-general-digest-help

php-general Digest 3 May 2012 20:05:51 - Issue 7799

Topics (messages 317758 through 317762):

Re: Retrieve pages from an ASP driven site
317758 by: Terry Ally (Gmail)
317759 by: Lester Caine
317761 by: EPA WC

Why might fclose() block?
317760 by: Andy Theuninck

Re: PHP Mailto() - Google now displaying HTML as Plain Text
317762 by: Gerardo Benitez

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---
Tom,

Here is how you would paginate in PHP.

//
// Number of records to show per page:
$display = 4;
// Determine how many records there are.
if (isset($_GET['np'])) {
$num_pages = $_GET['np'];
} else {
$query = SELECT * FROM mytable;
$query_result = mysql_query ($query) or die (mysql_error());
$num_records = @mysql_num_rows ($query_result);
 if ($num_records  $display) {
$num_pages = ceil ($num_records/$display);
} else {
$num_pages = 1;
}
}
 // Determine where in the database to start returning results.
if (isset($_GET['s'])) {
$start = $_GET['s'];
} else {
$start = 0;
}


// Number of records to show per page:
$display = 4;
// Determine how many records there are.
if (isset($_GET['np'])) {
$num_pages = $_GET['np'];
} else {
$query3 = SELECT * FROM mytable;
$query_result = mysql_query ($query3) or die (mysql_error());
$num_records = @mysql_num_rows ($query_result);
 if ($num_records  $display) {
$num_pages = ceil ($num_records/$display);
} else {
$num_pages = 1;
}
}
 // Determine where in the database to start returning results.
if (isset($_GET['s'])) {
$start = $_GET['s'];
} else {
$start = 0;
}
//




On 3 May 2012 05:37, EPA WC epawc...@gmail.com wrote:

 Hi List,

 I am trying to write a crawler to go through web pages at
 http://www.freebookspot.es/CompactDefault.aspx?Keyword=. But I am not
 quite familiar with how asp uses _doPostBack function with the next
 button below the book list to advance to the next page. I hope someone
 who knows ASP well can help out here. I need to know how to retrieve
 next page with PHP code.

 Kind regards,
 Tom

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
*Terry Ally*
Twitter.com/terryally
Facebook.com/terryally
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
To print or not to print this email is the environmentally-searching
question!
Which has the highest ecological cost? A sheet of paper or constantly
switching on your computer and connecting to the Internet to read your
email?
---End Message---
---BeginMessage---

Terry Ally (Gmail) wrote:

Here is how you would paginate in PHP.


Terry - Tom is not trying to create this in PHP, but read existing ASP pages.

Tom - I don't think that it's simply a matter of the ASP code here, but rather 
how they have constructed the set of information they are sending back. That is 
done in javascript, but the navigation buttons are simple form submit. BNext is 
submitted for 'next'.


Interestingly, the sales side seems to be .php ;)

--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
---End Message---
---BeginMessage---
Thanks Lester.

On Thu, May 3, 2012 at 3:49 AM, Lester Caine les...@lsces.co.uk wrote:
 Terry Ally (Gmail) wrote:

 Here is how you would paginate in PHP.


 Terry - Tom is not trying to create this in PHP, but read existing ASP
 pages.

 Tom - I don't think that it's simply a matter of the ASP code here, but
 rather how they have constructed the set of information they are sending
 back. That is done in javascript, but the navigation buttons are simple form
 submit. BNext is submitted for 'next'.

 Interestingly, the sales side seems to be .php ;)

 --
 Lester Caine - G8HFL
 -
 Contact - http://lsces.co.uk/wiki/?page=contact
 L.S.Caine Electronic Services - http://lsces.co.uk
 EnquirySolve - http://enquirysolve.com/
 Model Engineers Digital Workshop - http://medw.co.uk//
 Firebird - http://www.firebirdsql.org/index.php


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

---End Message---
---BeginMessage---
I'm currently seeing this in 5.3.10, although it's an intermittent
problem I've seen earlier versions too. Occasionally I get a maximum
execution time error when calling fclose() on a parallel port file
descriptor. Code looks like this:

$fp = fopen('/dev/lp0','w');
if ($fp){
   fwrite

php-general Digest 2 May 2012 06:45:47 -0000 Issue 7796

2012-05-02 Thread php-general-digest-help

php-general Digest 2 May 2012 06:45:47 - Issue 7796

Topics (messages 317727 through 317734):

Re: code deployment through php
317727 by: Camilo Sperberg
317728 by: rene7705
317729 by: Stuart Dallas
317730 by: admin
317731 by: Larry Garfield
317732 by: Lester Caine

Re: PHP Mailto() - Google now displaying HTML as Plain Text
317733 by: Marco Behnke

problem loading php extension: undefined reference to __gxx_personality_v0þ
317734 by: Nathan Ridge

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---

On 1 mei 2012, at 10:59, rene7705 wrote:

 Hi folks.
 
 I was here a while ago, trying to figure out how to keep deployment
 instances of my common code, running on more than 1 site, in sync with
 eachother.
 
 I've looked at rsync which was recommended here, but didn't like it much,
 nor could I find a good windows version of it.
 
 So yesterday, I decided to try a pure PHP solution. My thinking was: run a
 PHP sync script once on each physical machine that holds possibly multiple
 copies of my common code, and FTP the common code only 1 time because I use
 only 1 shared hosting account besides my windows development machine.
 
 I've gotten it so far that it creates an imo good list of what to copy
 where.
 
 The only problem I can foresee is that the copy command will take more than
 30 seconds, which makes it hard to run at the shared hoster.
 
 And obviously, it's going to need some good input checking to prevent
 abuse.
 
 I've put up a demo at
 http://skatescene.biz/sites/mediabeez.ws/sync_secret_cndj593n2/ , you can
 execute the code job to see it in action.
 
 I'll also post the working copy of my sync library at the bottom of this
 post. The only thing missing is the actual copy($source,$dest), I think.
 
 But, I'm wondering if this is a good approach to code deployment. It
 certainly seems easier and more convenient to me than using rsync. Maybe
 i'm an amateur indeed ;)  Anyways, all criticism is welcome here. Thanks
 for your time! :)
 
 ?php
 function sync_echo_jobs ($path) {
 $jobs = sync_read_jobs ($path);
 echo 'div id=rajmvSync_jobs_json!-- '.json_encode($jobs).' --/div';
 echo 'ul class=rajmvSync_jobs';
 foreach ($jobs['jobs'] as $jobName = $job) {
 echo 'li'.$jobName.' (a
 href=javascript:rscg.executeJob(\''.$jobName.'\');execute/a) (a
 href=javascript:rscg.showEditJobForm(\''.$jobName.'\');edit/a)/li';
 }
 echo '/ul';
 ?
 ?php
 }
 
 function sync_read_jobs ($path) {
 $filepath = $path.'/rajmvSync_jobs.json';
 if (file_exists($filepath)) {
 $r = json_decode (file_get_contents($filepath), true);
 } else {
 $r = array (
 'jobs' = array()
 );
 }
 return $r;
 }
 
 function sync_write_jobs ($path, $jobs) {
 $filepath = $path.'/rajmvSync_jobs.json';
 file_put_contents ($filepath, json_encode($jobs));
 }
 
 function sync_addOrEditJob ($path, $name, $paths) {
 $jobs = sync_read_jobs ($path);
 $jobs['jobs'][$name] = array (
 'paths' = $paths
 );
 sync_write_jobs ($path, $jobs);
 }
 
 function sync_executeJob ($path, $name) {
 $jobs = sync_read_jobs ($path);
 if (array_key_exists($name, $jobs['jobs'])) {
 $job = $jobs['jobs'][$name];
 $paths = explode (\n, $job['paths']);
 // work only on approved paths;
 $pathsApproved = array();
 foreach ($paths as $idx=$pathToSync) {
 $drive = strtolower(substr($pathToSync,0,2));
 if ($drive=='m:') $pathsApproved[]=$pathToSync;
 }
 $paths = $pathsApproved;
 
 // get a list of files for each path to sync with the other paths in the
 same list/var
 $fileLists = array();
 foreach ($paths as $idx = $pathToSync) {
 $fileLists[$pathToSync] = getFilePathList ($pathToSync, true, /(.*)/,
 array('file'));
 }
 // get all the last modified timestamps for each of the found files
 $fileList = array();
 foreach ($paths as $idx = $pathToSync) {
 foreach ($fileLists[$pathToSync] as $idx2 = $filepathToSync) {
 $fileRelativePath = str_replace ($pathToSync, '', $filepathToSync);
 if (!array_key_exists($fileRelativePath, $fileList))
 $fileList[$fileRelativePath] = array();
 $fileList[$fileRelativePath][$pathToSync] = filemtime($filepathToSync);
 }
 }
 // $copyList will hold all the copy commands, initialize;
 $copyList = array();
 foreach ($fileList as $fileRelativePath = $locationResults) {
 foreach ($locationResults as $pathToSync = $filemtime) {
 if (!array_key_exists($fileRelativePath, $copyList))
 $copyList[$fileRelativePath] = array(
 'latest' = null,
 'source' = null,
 'destinations' = array()
 );
 if (is_null($copyList[$fileRelativePath]['latest']) || $filemtime 
 $copyList[$fileRelativePath]['latest']) {
 $copyList[$fileRelativePath]['source'] = $pathToSync;
 $copyList[$fileRelativePath]['latest'] = $filemtime

php-general Digest 29 Apr 2012 20:31:53 -0000 Issue 7793

2012-04-29 Thread php-general-digest-help

php-general Digest 29 Apr 2012 20:31:53 - Issue 7793

Topics (messages 317715 through 317723):

Re: url string being split
317715 by: Chris Stinemetz
317716 by: Shawn McKenzie
317717 by: Tim Streater
317718 by: Chris Stinemetz

Array_diff problems
317719 by: Rick Dwyer
317720 by: Jim Giner
317721 by: admin
317722 by: Rick Dwyer

PHP Mailto() - Google now displaying HTML as Plain Text
317723 by: Terry Ally (Gmail)

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---
On Thu, Apr 26, 2012 at 12:58 PM, Stuart Dallas stu...@3ft9.com wrote:
 On 26 Apr 2012, at 18:37, Jim Giner wrote:

 Im no expert, but why would you expose a query to the world thru the use of
 a GET?  Why not just collect the params and build the string in your code?
 That is how people hack into your database - via a re-formed query.  You're
 giving someone an open invitation.

 A query string has nothing to do with databases.

 -Stuart


I still haven't been able to find a solution. Is there anyone out
there that knows how to keep the query string intact?

Thank you,

Chris
---End Message---
---BeginMessage---
On 04/27/2012 10:56 AM, Chris Stinemetz wrote:
 I still haven't been able to find a solution. Is there anyone out
 there that knows how to keep the query string intact?
 
 Thank you,
 
 Chris

urlencode($storerow['store_subject'])

-- 
Thanks!
-Shawn
http://www.spidean.com
---End Message---
---BeginMessage---
On 27 Apr 2012 at 16:56, Chris Stinemetz chrisstinem...@gmail.com wrote: 

 On Thu, Apr 26, 2012 at 12:58 PM, Stuart Dallas stu...@3ft9.com wrote:
 On 26 Apr 2012, at 18:37, Jim Giner wrote:

 Im no expert, but why would you expose a query to the world thru the use of
 a GET?  Why not just collect the params and build the string in your code?
 That is how people hack into your database - via a re-formed query.  You're
 giving someone an open invitation.

 A query string has nothing to do with databases.

 I still haven't been able to find a solution. Is there anyone out
 there that knows how to keep the query string intact?

As was posted previously, you need to encode the query string. If you have:

   http://westeng/forum/store.php?id=Wiser Communication, LLC - - Sprague Ave

that is going to be split in two unless you encode the Wiser Communication, 
LLC - - Sprague Ave portion. I would do that with JavaScript on the html page.

This is not a PHP question.

--
Cheers  --  Tim
---End Message---
---BeginMessage---
On Fri, Apr 27, 2012 at 11:09 AM, Shawn McKenzie nos...@mckenzies.net wrote:
 On 04/27/2012 10:56 AM, Chris Stinemetz wrote:
 I still haven't been able to find a solution. Is there anyone out
 there that knows how to keep the query string intact?

 Thank you,

 Chris

 urlencode($storerow['store_subject'])

 --
 Thanks!
 -Shawn
 http://www.spidean.com

Thank you. That is what I was looking for.

-Chris
---End Message---
---BeginMessage---
Hello all.

I have two arrays and when compared against each other via array_diff, I do not 
get any output:

$myarray1 = Array ( 
[0] = Array ( [id] = 1 [Funding_Type] = Federal [Amount] = 10 
[Frequency_Description] = Total [Other_Funding] = ) 
[1] = Array ( [id] = 2 [Funding_Type] = Trust [Amount] = 20 
[Frequency_Description] = Per Year [Other_Funding] = ) 
[2] = Array ( [id] = 3 [Funding_Type] = Other Funding [Amount] = 30 
[Frequency_Description] = Other [Other_Funding] = some )) 

$myarray2 = Array 
( 
[0] = Array ( [id] = 1 [Funding_Type] = Federal [Amount] = 10 
[Frequency_Description] = Total [Other_Funding] = ) 
[1] = Array ( [id] = 2 [Funding_Type] = Trust [Amount] = 20 
[Frequency_Description] = Per Year [Other_Funding] = ) 
[2] = Array ( [id] = 3 [Funding_Type] = Other Funding [Amount] = 50 
[Frequency_Description] = Other [Other_Funding] = none )) 

$arraydifferences = (array_diff($myarray1,$myarray2));

I need $arraydifferences to record the differences between the two.

Any help is appreciated.

Thanks,
 
 --Rick


---End Message---
---BeginMessage---

Rick Dwyer rpdw...@earthlink.net wrote in message 
news:0c0e6cc9-089d-4938-8b50-c9e12dfb3...@earthlink.net...
Hello all.

I have two arrays and when compared against each other via array_diff, I do 
not get any output:

$myarray1 = Array (
[0] = Array ( [id] = 1 [Funding_Type] = Federal [Amount] = 10 
[Frequency_Description] = Total [Other_Funding] = )
[1] = Array ( [id] = 2 [Funding_Type] = Trust [Amount] = 20 
[Frequency_Description] = Per Year [Other_Funding] = )
[2] = Array ( [id] = 3 [Funding_Type] = Other Funding [Amount] = 30 
[Frequency_Description] = Other [Other_Funding] = some ))

$myarray2 = Array
(
[0] = Array ( [id] = 1 [Funding_Type

php-general Digest 27 Apr 2012 15:38:19 -0000 Issue 7792

2012-04-27 Thread php-general-digest-help

php-general Digest 27 Apr 2012 15:38:19 - Issue 7792

Topics (messages 317711 through 317714):

Re: Should I check imput for bad chars in this case?
317711 by: marco.behnke.biz

Re: Insert group by
317712 by: Lester Caine
317714 by: admin

Re: Serving a .dmg via readfile?
317713 by: Matijn Woudt

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---


Simon Schick simonsimc...@googlemail.com hat am 27. April 2012 um 00:47
geschrieben:

 On Thu, Apr 26, 2012 at 3:59 PM, mirrys.net mirrys@gmail.com wrote:
  Thank you for your help Marco  Simon. No doubt, your code is much
  cleaner and better.
 
  One more question, without any filter or something could be my
  original code somehow compromised (mean some security bug)? Or rather
  was a major problem in the possibility of a script crash?
 

 Hi, Mirrys

 I personally can not see a security-hole at the first view ...
 Stuff in the global server-variable should only be set by the
 webserver and therefore it should be kind-of save (depending on the
 quality of the configuration of the webserver ;))

No, that is not correct. The Forwarded IP for example is generated by the
requesting Proxy Server and can therefor be manipulated.

But as far as your code simply writes this data into some textfile which is
never read inside you application or executed on your shell , there should
be no security reason.


 That was also the main reason why I would do a validation-check for this.
 Talking about a script-crash ... I don't know ... I just found this
 line in a comment for the function gethostbyaddress()

  If you use gethostbyaddr() with a bad IP address then it will send an
error message to the error log.

 Bye
 Simon
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz
---End Message---
---BeginMessage---

Rick Dwyer wrote:

This is more of a MySQL question, but I'm hoping it can be answered here.
On one of my pages, I issue a SQL command to group data as such:

$sql='select count(*) as count, searchkeywords from searchkeywords group by 
searchkeywords order by count desc'

Works well... but I would like it to groups plurals with singular words as well.  So 
hats are grouped with hat.

Since I'm doing a group by column name, I don't know that this can be done.

Any help is appreciated.


This IS a more appropriate question for ANY of the other database lists ;)

Normal practice is to create a search field that has your preferred search 
style, so add 'filtered_searchwords' and populate it with say a lower case copy 
of searchkeywords with any s or 's text removed. That is unless you want 
Hat's counted separately?


Expecting the database to process this type of filtering with any speed is being 
a bit hopeful. What any database does is processes raw fields fast, so providing 
extra data at insert or edit time is much more efficient than trying to do that 
process on every row of data later.


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
---End Message---
---BeginMessage---
$sql='select count(*) as count, searchkeywords 
from searchkeywords 
group by searchkeywords 
having searchkeywords LIKE searchkeywords
order by count desc'


Ir this does not work for you explore the HAVING CLAUSE





-Original Message-
From: Rick Dwyer [mailto:rpdw...@earthlink.net] 
Sent: Thursday, April 26, 2012 8:23 PM
To: PHP-General
Subject: [PHP] Insert group by

Hello all.

This is more of a MySQL question, but I'm hoping it can be answered here.
On one of my pages, I issue a SQL command to group data as such:

$sql='select count(*) as count, searchkeywords from searchkeywords group by
searchkeywords order by count desc'

Works well... but I would like it to groups plurals with singular words as
well.  So hats are grouped with hat.

Since I'm doing a group by column name, I don't know that this can be
done.

Any help is appreciated.

Thanks,
 
 --Rick



--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

---End Message---
---BeginMessage---
On Thu, Apr 26, 2012 at 8:20 PM, Brian Dunning br...@briandunning.com wrote:
 Thanks, this suggestion from Dante completely solved the problem.

 Replaced:

 readfile('/var/www/mypath/My Cool Image.dmg');

 With:

 $fd = fopen ('/var/www

php-general Digest 27 Apr 2012 00:23:27 -0000 Issue 7791

2012-04-26 Thread php-general-digest-help

php-general Digest 27 Apr 2012 00:23:27 - Issue 7791

Topics (messages 317695 through 317710):

Re: Should I check imput for bad chars in this case?
317695 by: marco.behnke.biz
317696 by: Simon Schick
317698 by: mirrys.net
317709 by: Simon Schick

Segmentation fault while fetching BLOB data from mysql with ODBC
317697 by: Leandro Dardini
317704 by: shiplu

url string being split
317699 by: Chris Stinemetz
317700 by: Vikash Kumar
317701 by: Jim Giner
317702 by: Stuart Dallas

Re: Serving a .dmg via readfile?
317703 by: Brian Dunning

undefined offset
317705 by: Jim Giner
317706 by: Stuart Dallas
317707 by: Jim Giner

FPDF ?
317708 by: Jim Giner

Insert group by
317710 by: Rick Dwyer

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---


mirrys.net mirrys@gmail.com hat am 26. April 2012 um 14:15
geschrieben:

 Hi all,

 this is more question than real problem (I hope :)). I include this
 script into my pages to log IPs of visitors (they are saved info txt
 file and send to e-mail later):

You definitly should. There were some bugs (even in bigger applications
like Coppermine f.e.) that have been introduced by clients sending
manipulated ip oder hostname Strings.

For the IP address simply check if it is a valid IP4 or IP6 tupel. There
are checks for that.



 function getIPadress()
 {
 if (isset($_SERVER[HTTP_CLIENT_IP]))
 {
 return $_SERVER[HTTP_CLIENT_IP];
 }
 elseif (isset($_SERVER[HTTP_X_FORWARDED_FOR]))
 {
 return $_SERVER[HTTP_X_FORWARDED_FOR];
 }
 elseif (isset($_SERVER[HTTP_X_FORWARDED]))
 {
 return $_SERVER[HTTP_X_FORWARDED];
 }
 elseif (isset($_SERVER[HTTP_FORWARDED_FOR]))
 {
 return $_SERVER[HTTP_FORWARDED_FOR];
 }
 elseif (isset($_SERVER[HTTP_FORWARDED]))
 {
 return $_SERVER[HTTP_FORWARDED];
 }
 else
 {
 return $_SERVER[REMOTE_ADDR];
 }
 }

 // save log to txt
 $fh = fopen($fileWithLog, 'a+') or die(Oups  . $fileWithLog . !);
 $IPAdress = getIPadress();
 fwrite($fh, date('j.n.Y G:i:s') . $IPAdress .  ( .
 gethostbyaddr($IPAdress) . )\n);
 fclose($fh);

 ...can this be some possible security risk (XSS or so..), becose I
 does not check chars in IP adress and host name mainly. It is probably
 crazy, but on the other side I think it isn't imposibble to use some
 bad strings in host name.

 Would you recommend use $IPAdress = htmlspecialchars(getIPadress());
 or something like? Or is it nonsense?

 Thx and excuse me, if this question is too stupid :(. Br, Mir R.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz
---End Message---
---BeginMessage---
On Thu, Apr 26, 2012 at 2:15 PM, mirrys.net mirrys@gmail.com wrote:
 Hi all,

 this is more question than real problem (I hope :)). I include this
 script into my pages to log IPs of visitors (they are saved info txt
 file and send to e-mail later):

 function getIPadress()
 {
    if (isset($_SERVER[HTTP_CLIENT_IP]))
    {
        return $_SERVER[HTTP_CLIENT_IP];
    }
    elseif (isset($_SERVER[HTTP_X_FORWARDED_FOR]))
    {
        return $_SERVER[HTTP_X_FORWARDED_FOR];
    }
    elseif (isset($_SERVER[HTTP_X_FORWARDED]))
    {
        return $_SERVER[HTTP_X_FORWARDED];
    }
    elseif (isset($_SERVER[HTTP_FORWARDED_FOR]))
    {
        return $_SERVER[HTTP_FORWARDED_FOR];
    }
    elseif (isset($_SERVER[HTTP_FORWARDED]))
    {
        return $_SERVER[HTTP_FORWARDED];
    }
    else
    {
        return $_SERVER[REMOTE_ADDR];
    }
 }

 // save log to txt
 $fh = fopen($fileWithLog, 'a+') or die(Oups  . $fileWithLog . !);
 $IPAdress = getIPadress();
 fwrite($fh, date('j.n.Y G:i:s') . $IPAdress .  ( .
 gethostbyaddr($IPAdress) . )\n);
 fclose($fh);

 ...can this be some possible security risk (XSS or so..), becose I
 does not check chars in IP adress and host name mainly. It is probably
 crazy, but on the other side I think it isn't imposibble to use some
 bad strings in host name.

 Would you recommend use $IPAdress = htmlspecialchars(getIPadress());
 or something like? Or is it nonsense?

 Thx and excuse me, if this question is too stupid :(. Br, Mir R.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


Hi, mirrys

Why not use the function filter_input()? This would

php-general Digest 25 Apr 2012 08:45:18 -0000 Issue 7788

2012-04-25 Thread php-general-digest-help

php-general Digest 25 Apr 2012 08:45:18 - Issue 7788

Topics (messages 317668 through 317673):

Re: NULL Problem
317668 by: Matijn Woudt
317669 by: Serge Fonville
317670 by: David Stoltz
317671 by: David Stoltz

What is wrong here?
317672 by: Karl-Arne Gjersøyen
317673 by: marco.behnke.biz

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---
On Tue, Apr 24, 2012 at 7:29 PM, David Stoltz dsto...@shh.org wrote:
 Here's my code (using MSSQL):

 $conn = new COM (ADODB.Connection)or die(Cannot start ADO);
 $conn-open($connStr);
 $query = SELECT * FROM TABLE WHERE id = .$id;
 $rs = $conn-execute($query);

 This code works fine, and I retrieve the values like this:

 $tmp1 = $rs-fields(column1);
 $tmp2 = $rs-fields(column2);
 Etc...


 Here's the problem - I'm trying to get a date column that I know is
 NULL, but I can't seem to get my code right:

 $tmp = $rs-fields(followup_on);
 if(is_null($tmp)){
        $followup = ;
 }else{
        $followup = $rs-fields(followup_on);
 }

 //this results in: Catchable fatal error: Object of class variant could
 not be converted to string
 //When I try to ECHO the $followup results (and I know the database
 value is NULL)


 So confused - any advice?


It's been a long time ago I worked with ADO (Thank god), but shouldn't
you echo $followup-value instead of $followup?
If that's not working, try a var_dump($followup), so you can check
exactly what it is.

- Matijn
---End Message---
---BeginMessage---
Have you considered the PHP MSSQL driver?
http://www.microsoft.com/download/en/details.aspx?id=20098

Kind regards/met vriendelijke groet,

Serge Fonville

http://www.sergefonville.nl

Convince Google!!
They need to add GAL support on Android (star to agree)
http://code.google.com/p/android/issues/detail?id=4602


2012/4/24 Matijn Woudt tijn...@gmail.com:
 On Tue, Apr 24, 2012 at 7:29 PM, David Stoltz dsto...@shh.org wrote:
 Here's my code (using MSSQL):

 $conn = new COM (ADODB.Connection)or die(Cannot start ADO);
 $conn-open($connStr);
 $query = SELECT * FROM TABLE WHERE id = .$id;
 $rs = $conn-execute($query);

 This code works fine, and I retrieve the values like this:

 $tmp1 = $rs-fields(column1);
 $tmp2 = $rs-fields(column2);
 Etc...


 Here's the problem - I'm trying to get a date column that I know is
 NULL, but I can't seem to get my code right:

 $tmp = $rs-fields(followup_on);
 if(is_null($tmp)){
        $followup = ;
 }else{
        $followup = $rs-fields(followup_on);
 }

 //this results in: Catchable fatal error: Object of class variant could
 not be converted to string
 //When I try to ECHO the $followup results (and I know the database
 value is NULL)


 So confused - any advice?


 It's been a long time ago I worked with ADO (Thank god), but shouldn't
 you echo $followup-value instead of $followup?
 If that's not working, try a var_dump($followup), so you can check
 exactly what it is.

 - Matijn

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

---End Message---
---BeginMessage---
Matijn - it worked! Geez...

Strange - I don't need the -value if it actually has a value, only if it's 
NULL...

But it works! Thanks!

-Original Message-
From: Matijn Woudt [mailto:tijn...@gmail.com] 
Sent: Tuesday, April 24, 2012 1:40 PM
To: David Stoltz
Cc: php-gene...@lists.php.net
Subject: Re: [PHP] NULL Problem

On Tue, Apr 24, 2012 at 7:29 PM, David Stoltz dsto...@shh.org wrote:
 Here's my code (using MSSQL):

 $conn = new COM (ADODB.Connection)or die(Cannot start ADO);
 $conn-open($connStr);
 $query = SELECT * FROM TABLE WHERE id = .$id;
 $rs = $conn-execute($query);

 This code works fine, and I retrieve the values like this:

 $tmp1 = $rs-fields(column1);
 $tmp2 = $rs-fields(column2);
 Etc...


 Here's the problem - I'm trying to get a date column that I know is
 NULL, but I can't seem to get my code right:

 $tmp = $rs-fields(followup_on);
 if(is_null($tmp)){
        $followup = ;
 }else{
        $followup = $rs-fields(followup_on);
 }

 //this results in: Catchable fatal error: Object of class variant could
 not be converted to string
 //When I try to ECHO the $followup results (and I know the database
 value is NULL)


 So confused - any advice?


It's been a long time ago I worked with ADO (Thank god), but shouldn't
you echo $followup-value instead of $followup?
If that's not working, try a var_dump($followup), so you can check
exactly what it is.

- Matijn
---End Message---
---BeginMessage---

Serge,

We don't use MSSQL for much, mostly use MySQL...

But I don't want to switch out all the drivers for this one issue, which is now 
resolved (thanks Matijn

php-general Digest 24 Apr 2012 17:29:44 -0000 Issue 7787

2012-04-24 Thread php-general-digest-help

php-general Digest 24 Apr 2012 17:29:44 - Issue 7787

Topics (messages 317655 through 317667):

session lost problem
317655 by: bug zhu
317656 by: Stuart Dallas
317657 by: Stuart Dallas
317658 by: Adam Richardson
317659 by: bug zhu
317660 by: marco.behnke.biz
317661 by: bug zhu

Re: No error reporting on
317662 by: Jim Giner

Hmm.. this is strange..
317663 by: Karl-Arne Gjersøyen
317664 by: Serge Fonville
317665 by: Karl-Arne Gjersøyen
317666 by: Karl-Arne Gjersøyen

NULL Problem
317667 by: David Stoltz

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---
hi all:

there are tow php files a.php and b.php,

content of a.php as follows:
?php
session_start();
if (!isset($_GET['flag']))
{
header('Location: b.php');
}
else
{
var_dump($_SESSION);
}

content of  b.php as follows:
?php
session_start();
session_commit();
$_SESSION['test'] = 'test';
session_commit();
header('Location: a.php?flag=1');

when i visit a.php, the dumped $_SESSION array is empty
but if i commented the first session_commit() in b.php and then visit
a.php, i cound see the $_SESSION array,which is not empty
i wish i have descibed  clear about my problem and someone could give me a
feedback~

-- 

thanks,
bugzhu
---End Message---
---BeginMessage---
On 24 Apr 2012, at 05:58, bug zhu wrote:

 there are tow php files a.php and b.php,
 
 content of a.php as follows:
 ?php
 session_start();
 if (!isset($_GET['flag']))
 {
 header('Location: b.php');
 }
 else
 {
 var_dump($_SESSION);
 }
 
 content of  b.php as follows:
 ?php
 session_start();
 session_commit();
 $_SESSION['test'] = 'test';
 session_commit();
 header('Location: a.php?flag=1');
 
 when i visit a.php, the dumped $_SESSION array is empty
 but if i commented the first session_commit() in b.php and then visit
 a.php, i cound see the $_SESSION array,which is not empty
 i wish i have descibed  clear about my problem and someone could give me a
 feedback~


I'm really not clear on what you're trying to do here, but the behaviour you're 
describing is as designed. When you call session_commit() you are saving and 
closing the session, so nothing done to $_SESSION after that point will be 
saved, even if you call session_commit() again.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
---End Message---
---BeginMessage---
Please don't top-post, and please include the list when replying.

On 24 Apr 2012, at 06:35, bug zhu wrote:
 2012/4/24 Stuart Dallas stu...@3ft9.com
 On 24 Apr 2012, at 05:58, bug zhu wrote:
 
  there are tow php files a.php and b.php,
 
  content of a.php as follows:
  ?php
  session_start();
  if (!isset($_GET['flag']))
  {
  header('Location: b.php');
  }
  else
  {
  var_dump($_SESSION);
  }
 
  content of  b.php as follows:
  ?php
  session_start();
  session_commit();
  $_SESSION['test'] = 'test';
  session_commit();
  header('Location: a.php?flag=1');
 
  when i visit a.php, the dumped $_SESSION array is empty
  but if i commented the first session_commit() in b.php and then visit
  a.php, i cound see the $_SESSION array,which is not empty
  i wish i have descibed  clear about my problem and someone could give me a
  feedback~
 
 
 I'm really not clear on what you're trying to do here, but the behaviour 
 you're describing is as designed. When you call session_commit() you are 
 saving and closing the session, so nothing done to $_SESSION after that 
 point will be saved, even if you call session_commit() again.
 
 but in a single file without redirect, code as follows
 ?php
 session_start();
 session_commit();
 $_SESSION['test'] = 'test';
 session_commit();
 var_dump($_SESSION);
 
 could dump the $_SESSION array.

Yes, because $_SESSION is not special in any way other than that it's used by 
the session system; it's no more than a superglobal array. So within one 
request that array contains whatever you put into it, but that doesn't mean it 
is stored in whatever session storage mechanism you're using (files by 
default). When you redirect to another URL that's a whole new request so the 
contents of $_SESSION have to be loaded from the session storage.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/---End Message---
---BeginMessage---
On Tue, Apr 24, 2012 at 12:58 AM, bug zhu bugw...@gmail.com wrote:
 there are tow php files a.php and b.php,

 content of a.php as follows:
 ?php
 session_start();
 if (!isset($_GET['flag']))
 {
 header('Location: b.php');
 }
 else
 {
 var_dump($_SESSION);
 }

 content of  b.php as follows:
 ?php
 session_start();
 session_commit();
 $_SESSION['test'] = 'test';
 session_commit();
 header('Location: a.php?flag=1');

 when i

php-general Digest 23 Apr 2012 11:15:40 -0000 Issue 7785

2012-04-23 Thread php-general-digest-help

php-general Digest 23 Apr 2012 11:15:40 - Issue 7785

Topics (messages 317646 through 317649):

Re: [PHP-DB] School timetable in php
317646 by: tamouse mailing lists
317649 by: Tony Marston

Re: Blocking URL hacking attemps
317647 by: Mihamina Rakotomandimby
317648 by: admin

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---
On Sun, Apr 22, 2012 at 1:41 AM, Vinay Kannan viny...@gmail.com wrote:
 Weekly subject wise lecture schedule, subject wise / faculty wise.


 On Sun, Apr 22, 2012 at 12:02 PM, tamouse mailing lists
 tamouse.li...@gmail.com wrote:

 On Fri, Apr 20, 2012 at 7:00 AM, Vinay Kannan viny...@gmail.com wrote:
  I am trying to develop a school time table system in php mysql, anybody
  has
  any headsup on the same, i was thinking about some existing scripts to
  take
  a look at.

 Not entirely clear what is meant by time table -- do you mean
 schedule of classes? Important dates in the school year? or...?

 Also, what is it you want to be able to do with this? Who will be
 using this? There are many different approaches one can take,
 depending on what needs to happen. Hard to know what to suggest
 without a little more info?



I modified an application that was originally set up for scheduling
conference rooms, my version was to schedule appointments at a
convention. You can grab it at https://github.com/tamouse/cdmacal  .
It is probably *way* more complex than you need, but it might give
some ideas?
---End Message---
---BeginMessage---
tamouse mailing lists  wrote in message 
news:CAHUC_t-cch8cBXZvzWtx42ZPFEuVkMPG=50jkwv+gygelk_...@mail.gmail.com...


On Sun, Apr 22, 2012 at 1:41 AM, Vinay Kannan viny...@gmail.com wrote:

Weekly subject wise lecture schedule, subject wise / faculty wise.


On Sun, Apr 22, 2012 at 12:02 PM, tamouse mailing lists
tamouse.li...@gmail.com wrote:


On Fri, Apr 20, 2012 at 7:00 AM, Vinay Kannan viny...@gmail.com wrote:
 I am trying to develop a school time table system in php mysql, 
 anybody
 has  any headsup on the same, i was thinking about some existing 
 scripts to

 take a look at.


snip

I have a sample application called Classroom Scheduling which comes with 
the Radicore framework. Even if you don't want to use the code, the database 
design might be useful.


If you visit the Radicore website at http://www.radicore.org you can logon 
to the demonstration system, click on the PROTO button, then select 
Classroom. This has functions for rooms, teachers, subjects, lessons, 
classes and students.


--
Tony Marston

http://www.tonymarston.net
http://www.radicore.org 

---End Message---
---BeginMessage---

On 04/22/2012 07:55 PM, sono...@fannullone.us wrote:

Is there a way that I can trap the extra info in the URL's and pass it to the


I miss the interest of that system: the URL doesnt exist, so the nasty 
client will get a 404 and you're done.


If you want to do more filtering, I would suggest coupling with 
fail2ban, so that filtering will occur at TCP level.


--
RMA.
---End Message---
---BeginMessage---
-Original Message-
From: sono...@fannullone.us [mailto:sono...@fannullone.us] 
Sent: Sunday, April 22, 2012 12:55 PM
To: PHP General
Subject: [PHP] Blocking URL hacking attemps

I'm using a script called BlackHole that uses PHP and a hidden
directory to catch bad bots and block them by their IP address from the site
[http://perishablepress.com/blackhole-bad-bots/].  It's working very well,
but I'd like to expand on the idea.

When looking at our access logs, I see someone adding code to our
URL's in hopes to, apparently, hack into our site.  If our URL is like this:

http://www.example.com/pages/bolts.php

they are adding to it like this:

http://www.example.com/pages/bolts.php/wp-content/themes/functions/thumb.php
.cache/external_e19f4bb51bc2262e07d23b79b916c12c.php
or
http://www.example.com/pages/bolts.php/cart.php
or
http://www.example.com/pages/bolts.php/wp-content/themes/functions/thumb.php
timthumb.php
or
http://www.example.com/pages/bolts.php/bratislava/stare-mesto

Is there a way that I can trap the extra info in the URL's and
pass it to the BlackHole script to ban these attempts as well?  I'm thinking
I'll need to compare the entered URL with $_SERVER[PHP_SELF] and if
there's extra info, like another *.php, after the page name, then ban the
IP.  I realize that's a rather simplistic explanation and there may be a
better way to accomplish this.

If anyone has any examples they can share, I'd really appreciate.

Thanks,
Marc
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php




Marc,
First I would suggest

php-general Digest 20 Apr 2012 20:00:33 -0000 Issue 7783

2012-04-20 Thread php-general-digest-help

php-general Digest 20 Apr 2012 20:00:33 - Issue 7783

Topics (messages 317619 through 317640):

Re: SqLite INSERT want not write
317619 by: Stuart Dallas
317620 by: Silvio Siefke
317621 by: Stuart Dallas
317624 by: tamouse mailing lists
317625 by: Silvio Siefke
317626 by: Steven Staples
317627 by: Stuart Dallas
317628 by: Stuart Dallas
317630 by: Silvio Siefke
317631 by: Steven Staples
317632 by: tamouse mailing lists
317633 by: Silvio Siefke
317634 by: Stuart Dallas
317635 by: Steven Staples
317636 by: Silvio Siefke
317637 by: Tommy Pham
317638 by: Silvio Siefke
317639 by: Bastien

Re: sms class
317622 by: tamouse mailing lists
317623 by: Matijn Woudt
317629 by: Lester Caine

preg_replace_callback
317640 by: TR Shaw

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---
On 19 Apr 2012, at 18:31, Silvio Siefke wrote:

 i have a script which should write articles in a Sqlite 0database. The script 
 runs without errors, but nothing is written to the database.
 
 
 The Script: http://nopaste.info/09e68c7e37.html
 The db.php: http://nopaste.info/afd4dee47a.html
 
 The Database file has right 777. Has someone an idea? Thank u. 

The script has syntax errors in it. You won't see those errors because PHP 
won't run a script with syntax errors, so it won't modify the error_reporting 
and display_errors settings.

You can run php -l script.php to see those errors, but it would be better to 
set the error_reporting and display_errors values in php.ini on your 
development system/server.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
---End Message---
---BeginMessage---
Hello,

On Thu, 19 Apr 2012 18:39:00 +0100
Stuart Dallas stu...@3ft9.com wrote:

 The script has syntax errors in it. You won't see those errors because PHP 
 won't run a script with syntax errors, so it won't modify the error_reporting 
 and display_errors settings.
 
 You can run php -l script.php to see those errors, but it would be better to 
 set the error_reporting and display_errors values in php.ini on your 
 development system/server.


gentoo-desk siefke # php -l test.php *
No syntax errors detected in test.php

gentoo-desk blog # php -l manage.php
No syntax errors detected in manage.php

gentoo-desk php # php -l db.php
No syntax errors detected in db.php


* I have written in this file only the php code. No syntax errors. 

gentoo-desk blog # php -v
PHP 5.3.10-pl0-gentoo with Suhosin-Patch (cli) (built: Apr  5 2012 00:31:12)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies   

Regards
Silvio
---End Message---
---BeginMessage---
On 19 Apr 2012, at 18:54, Silvio Siefke wrote:

 On Thu, 19 Apr 2012 18:39:00 +0100
 Stuart Dallas stu...@3ft9.com wrote:
 
 The script has syntax errors in it. You won't see those errors because PHP 
 won't run a script with syntax errors, so it won't modify the 
 error_reporting and display_errors settings.
 
 You can run php -l script.php to see those errors, but it would be better to 
 set the error_reporting and display_errors values in php.ini on your 
 development system/server.
 
 
 gentoo-desk siefke # php -l test.php *
 No syntax errors detected in test.php
 
 gentoo-desk blog # php -l manage.php
 No syntax errors detected in manage.php
 
 gentoo-desk php # php -l db.php
 No syntax errors detected in db.php
 
 
 * I have written in this file only the php code. No syntax errors. 
 
 gentoo-desk blog # php -v
 PHP 5.3.10-pl0-gentoo with Suhosin-Patch (cli) (built: Apr  5 2012 00:31:12)
 Copyright (c) 1997-2012 The PHP Group
 Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies 


I took the code on http://nopaste.info/09e68c7e37.html and put it in test.php.

stuart@fred:~$ php -l test.php 
Parse error: parse error in test.php on line 28
Errors parsing test.php

You really can't see the mismatched quotes here?

$sql = 'INSERT INTO bloggen (date, autor, title, teaser, content)
  VALUES ('' . date( 'Y-m-s H:i:s', time() ) . '', :autor, :title, :teaser, 
:content);';

I'm using PHP 5.3.8 on this particular machine, not that it matters with basic 
syntax errors like this.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/---End Message---
---BeginMessage---
Maybe this will make the syntax errors stand out more:

http://dl.dropbox.com/u/571329/Screenshots/Picture%209.png
---End Message---
---BeginMessage---
Hello,

On Thu, 19 Apr 2012 13:21:46 -0500
tamouse mailing lists tamouse.li...@gmail.com wrote:

 Maybe this will make the syntax errors stand out more

php-general Digest 19 Apr 2012 17:30:55 -0000 Issue 7782

2012-04-19 Thread php-general-digest-help

php-general Digest 19 Apr 2012 17:30:55 - Issue 7782

Topics (messages 317607 through 317618):

Re: sms class
317607 by: tamouse mailing lists

Re: Email Antispam
317608 by: tamouse mailing lists
317610 by: Bastien
317612 by: Matijn Woudt
317613 by: Ashley Sheridan

Re: tempnam() not working as expected...
317609 by: marco.behnke.biz
317611 by: Matijn Woudt

Variable Question
317614 by: Ron Piggott
317615 by: Stuart Dallas
317616 by: Christoph Boget
317617 by: Shawn McKenzie

SqLite INSERT want not write
317618 by: Silvio Siefke

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---
On Tue, Apr 17, 2012 at 2:08 PM, DZvonko Nikolov dzvo...@yahoo.com wrote:
 I need a class that sends sms messages to list of numbers.
 I'm quite new to that issue, so I need to know what I need
 more. Thanks in advance.

If this is very low volume, would using email-sms work?
---End Message---
---BeginMessage---
On Wed, Apr 18, 2012 at 8:47 PM, Ross McKay ro...@zeta.org.au wrote:
 On Wed, 18 Apr 2012 11:08:00 -0400, Jim Giner wrote:

He literally wants the addresses visible on the sight?  [...]

 Yes, they want the addresses visible and clickable on the website. They
 have contact forms, but they also want the email addresses (of their
 scientists and other consultants) available to their clients. And they
 want the addresses to be shielded against harvesting for spam.

Ob/Deobfuscation schemes that use javascript are a partial solution.
Many spam harvesters are smart enough these days to know enough about
decoding email addresses even obfuscated with javascript, with or
without the mailto: scheme. Any that do obfuscation by substituting
html entities for the characters are quite easily cracked. (Just
appearance of a string of html entities is often enough to indicate
there is something there to decode.) There is no 100% solution here.
Coming up with clever ways to obfuscate the address on download, and
deobfuscate it afterwards to display to the user will work for a
while, however, the people writing spam harvesters are just as clever
as we are. If the application is going to end up with email addresses
displayed on the screen, some spam harvester is going to be able to
get them. Even if you come up with a method that will stop them now,
it won't stop them forever.

 As I said, I don't like doing it this way, but the client gets what they
 want after the options have been explained to them.

They need to understand the options, but even more important, the
risks of any solution, and of the concept as a whole. After you've
presented the risks, and the lack of a 100% solution, if they still
want to do something against their own policies, you have to decide if
your liability in giving it to them is going to be a problem.
---End Message---
---BeginMessage---


Bastien Koert

On 2012-04-19, at 1:54 AM, tamouse mailing lists tamouse.li...@gmail.com 
wrote:

 On Wed, Apr 18, 2012 at 8:47 PM, Ross McKay ro...@zeta.org.au wrote:
 On Wed, 18 Apr 2012 11:08:00 -0400, Jim Giner wrote:
 
 He literally wants the addresses visible on the sight?  [...]
 
 Yes, they want the addresses visible and clickable on the website. They
 have contact forms, but they also want the email addresses (of their
 scientists and other consultants) available to their clients. And they
 want the addresses to be shielded against harvesting for spam.
 
 Ob/Deobfuscation schemes that use javascript are a partial solution.
 Many spam harvesters are smart enough these days to know enough about
 decoding email addresses even obfuscated with javascript, with or
 without the mailto: scheme. Any that do obfuscation by substituting
 html entities for the characters are quite easily cracked. (Just
 appearance of a string of html entities is often enough to indicate
 there is something there to decode.) There is no 100% solution here.
 Coming up with clever ways to obfuscate the address on download, and
 deobfuscate it afterwards to display to the user will work for a
 while, however, the people writing spam harvesters are just as clever
 as we are. If the application is going to end up with email addresses
 displayed on the screen, some spam harvester is going to be able to
 get them. Even if you come up with a method that will stop them now,
 it won't stop them forever.
 
 As I said, I don't like doing it this way, but the client gets what they
 want after the options have been explained to them.
 
 They need to understand the options, but even more important, the
 risks of any solution, and of the concept as a whole. After you've
 presented the risks, and the lack of a 100

php-general Digest 19 Apr 2012 05:10:50 -0000 Issue 7781

2012-04-18 Thread php-general-digest-help

php-general Digest 19 Apr 2012 05:10:50 - Issue 7781

Topics (messages 317599 through 317606):

Re: Email Antispam
317599 by: Jim Giner
317605 by: Ross McKay

Re: sms class
317600 by: Lester Caine
317602 by: Matijn Woudt

Re: learning resources for PHP
317601 by: Henry Martinez
317603 by: sono-io.fannullone.us
317604 by: Tim Dunphy

Re: tempnam() not working as expected...
317606 by: tamouse mailing lists

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---

Ross McKay ro...@zeta.org.au wrote in message 
news:795so7t0avn28a5m8i373h9tursk15c...@4ax.com...
 On Tue, 17 Apr 2012 21:11:45 -0400, Jim Giner wrote:

So - does that mean you building the site from information contained in a
database?

 Yes. Client wanted email addresses on the website, but not available to
 SPAM harvesters. And not all addresses are in the database as
 structured data, many are embedded in page content (I have a WordPress
 shortcode that encodes the email address for those).
 -- 
 Ross McKay, Toronto, NSW Australia
 Faced with a choice between the survival of the planet
 and a new set of matching tableware, most people would
 choose the tableware - George Monbiot

He literally wants the addresses visible on the sight?  Or just an a 
using the person's name that would then generate the email by referencing 
the data table?  This is basic contact form methodology as mentioned by an 
earlier post.

As for the missing ones, use that WP thingie to extract them and post them 
to a speicifc email addr field in your table.


---End Message---
---BeginMessage---
On Wed, 18 Apr 2012 11:08:00 -0400, Jim Giner wrote:

He literally wants the addresses visible on the sight?  [...]

Yes, they want the addresses visible and clickable on the website. They
have contact forms, but they also want the email addresses (of their
scientists and other consultants) available to their clients. And they
want the addresses to be shielded against harvesting for spam.

As I said, I don't like doing it this way, but the client gets what they
want after the options have been explained to them.
-- 
Ross McKay, Toronto, NSW Australia
Nobody expects the Spanish inquisition - Cardinal Ximénez
---End Message---
---BeginMessage---

Matijn Woudt wrote:

It should be possible to hack up an android phone and write some
software that sends messages from there, though using one of the
provided services is much simpler.


I have the phone already configured, but it requires a SIM card that ALLOWS 
sending messages via the data port. All UK SIM's are locked to only work from 
the phone itself :( This service IS available in other countries which is where 
the data came from ...


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
---End Message---
---BeginMessage---
On Wed, Apr 18, 2012 at 9:53 PM, Lester Caine les...@lsces.co.uk wrote:
 Matijn Woudt wrote:

 It should be possible to hack up an android phone and write some
 software that sends messages from there, though using one of the
 provided services is much simpler.


 I have the phone already configured, but it requires a SIM card that ALLOWS
 sending messages via the data port. All UK SIM's are locked to only work
 from the phone itself :( This service IS available in other countries which
 is where the data came from ...



That's why I said, hack an android phone. You can simulate it is send
by the phone itself with enough programming skills.

Matijn
---End Message---
---BeginMessage---

On 05/04/12 13:41, tamouse mailing lists wrote:

On Wed, Apr 4, 2012 at 6:16 AM, Bastienphps...@gmail.com  wrote:


Bastien Koert

On 2012-04-03, at 10:39 PM, Tim Dunphybluethu...@gmail.com  wrote:


Hello list,

  I am quite sure that you've heard this question at least a few times
before. :) But I have been dabbling a bit in PHP for years and I've
decided that its' high time that became serious about getting a solid
grounding in it. Currently I work as a Sysadmin and have modest but
reliable skills in bash and perl. But I consider PHP more of an
artform and I really need to 'pick up a brush and start painting' so
to speak.

  So what I was wondering what websites, and books you'd recommend to
someone who (for all intents and purpose) is just starting out.

  On my hit list of things to learn are basic php / database
interaction (mysql mainly).. then how to accelerate php interraction
through memcache.. and eventually one I have

php-general Digest 16 Apr 2012 14:20:40 -0000 Issue 7777

2012-04-16 Thread php-general-digest-help

php-general Digest 16 Apr 2012 14:20:40 - Issue 

Topics (messages 317563 through 317572):

Re: Customized Session Handler can not work for PHP 5.1.6 and CentOS5.5
317563 by: Mingda
317564 by: Mingda
317565 by: Tommy Pham
317566 by: Alain Williams
317567 by: Mingda
317568 by: Mingda
317569 by: Mingda
317570 by: Mingda

Re: tempnam() not working as expected...
317571 by: marco.behnke.biz

Re: php in windows
317572 by: Steven Staples

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---

Sorry, wrong stackoverflow link. Here is the correct one:

http://stackoverflow.com/questions/10150296/cant-make-custom-session-save-handler-workno-registered-method-called-in-cent#comment13018050_10150327


And here is the code for session:

?php
class session
{
  public static function init()
  {
session_set_save_handler('session::open', 'session::close', 
'session::read', 'session::write', 'session::destroy', 'session::gc');

  }

  public static function open($save_path, $session_name)
  {
 if (!is_dir($save_path)) {
mkdir($save_path, 0777);
 }
return true;
  }

  public static function close()
  {
return true;
  }

  public static function read($sid)
  {
global $db, $user;
register_shutdown_function('session_write_close');
if (!isset($_COOKIE[session_name()])) {
  $user = anonymousUser($sid);
  return '';
}
$result = $db-query('SELECT s.data as session_data, s.* , u.* FROM 
users u INNER JOIN sessions s ON u.uid = s.uid WHERE s.sid = ' . 
$db-escape($sid) .
  ' AND timestamp = ' . $db-escape(TIMESTAMP - 
Bl_Config::get('session.lifetime', 10800)));

$user = $result-row();

if ($user) {
  $data = $user-session_data;
  unset($user-passwd, $user-session_data);
  if ($user-uid  0  $user-status == 1) {
$userInstance = User_Model::getInstance();
$user-roles = $userInstance-getUserRoles($user-uid);
$user-roles[] = User_Model::ROLE_AUTHENTICATED_USER;
$user-permissions = array();
$user-data = (isset($user-data)  $user-data) ? 
unserialize($user-data) : array();

foreach ($user-roles as $rid) {
  $user-permissions = array_merge($user-permissions, 
$userInstance-getRolePermissions($rid));

}
$user-permissions = array_unique($user-permissions);
  } else {
$user = anonymousUser($sid);
  }
  return $data;
} else {
  $user = anonymousUser($sid);
  return '';
}
  }

  public static function write($sid, $data)
  {
global $db, $user;
if (!isset($user) || ($user-uid == 0  
empty($_COOKIE[session_name()])  empty($data))) {

  return true;
}
$uri = '/' . Bl_Core::getUri();
$db-exec('UPDATE sessions SET uid = ' . $db-escape($user-uid) . 
', ip = ' . $db-escape(ipAddress()) .
  ', uri = ' . $db-escape($uri) . ', data = ' . 
$db-escape($data) . ', timestamp = ' .

  $db-escape(TIMESTAMP) . ' WHERE sid = ' . $db-escape($sid) . '');
if (!$db-affected()) {
  $db-exec('INSERT IGNORE INTO sessions (sid, uid, ip, uri, data, 
timestamp) VALUES (' . $db-escape($sid) .
', ' . $db-escape($user-uid) . ', ' . 
$db-escape(ipAddress()) . ', ' . $db-escape($uri) . ', ' .

$db-escape($data) . ', ' . $db-escape(TIMESTAMP) . ')');
}
return true;
  }

  public static function destroy($sid)
  {
global $db;
$db-exec('DELETE FROM sessions WHERE sid = ' . $db-escape($sid) 
. '');

return true;
  }

  public static function gc($lifetime)
  {
global $db;
$db-exec('DELETE FROM sessions WHERE timestamp  ' . 
$db-escape(TIMESTAMP - Bl_Config::get('session.lifetime', 10800)));

return true;
  }

  public static function count($timestamp = 0, $hasAnonymous = true)
  {
global $db;
if (!$hasAnonymous) {
  $cond = ' AND uid  0';
} else {
  $cond = '';
}
$result = $db-query('SELECT COUNT(0) FROM sessions WHERE timestamp 
 ' . $timestamp . $cond);

return $result-one();
  }
}



On 2012/4/15 14:53, Mingda wrote:

Hi, All,

I can't see the post I sent several hours ago, if repeated, please reply
to this one. Thanks!

System: CentOS 5.5; PHP version is 5.1.6.

I met a strange problem associate with session_save_handler in current
environment(The same code can work well in my local windows platform and
ubuntu system).

I just want to use a customized session save handler to be triggered, so
that I can call my own logic to handling the session. The testing in
local is pretty great but when migration to the VPS, it bring me the
following error:

Fatal error: session_start() [a
href

php-general Digest 17 Apr 2012 05:54:56 -0000 Issue 7778

2012-04-16 Thread php-general-digest-help

php-general Digest 17 Apr 2012 05:54:56 - Issue 7778

Topics (messages 317573 through 317575):

Re: Upcoming Outage: php.net
317573 by: Daniel Brown
317574 by: Daniel Brown

Re: Customized Session Handler can not work for PHP 5.1.6 andCentOS 5.5
317575 by: Mingda

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---
Just a reminder, see the below message.
On Apr 13, 2012 3:43 PM, Daniel Brown danbr...@php.net wrote:

Greetings, all;

This coming Monday, 16 April, 2012, between the hours of 18:00 and
 20:00 EDT (22:00 to 00:00 GMT), the one of the primary php.net servers
 will be undergoing a critical preventative maintenance operation.  In
 this two-hour maintenance window, we do expect a period of
 interruption lasting up to thirty minutes, during which certain core
 services will be partially or totally unavailable.

The system that will experience the downtime is OSU1PHP.PHP.NET
 which, among other things, is the primary system for our mail exchange
 and master database.  As such, a sample of services that will likely
 be unavailable for a short period of time will include:

* Email (including mailing lists)
* Events, user, and mirror management
* User note submissions from userland
* Et cetera

We are informed by the on-site staff in Oregon State University's
 Open Source Lab, who quite generously provide this system
 free-of-charge, that while the maintenance is anticipated to take up
 to thirty minutes, they will be making all attempts to limit the
 downtime to a period of just five to ten minutes.

My apologies for any inconvenience this may cause any of you, but
 as stated, this is critical preventative maintenance that is required
 to protect the integrity of the system, and to ensure that these
 services are not negatively impacted in the future.

Please contact me directly if you have any questions or concerns.

Thanks, all, and have a great weekend.

 --
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/

---End Message---
---BeginMessage---
 and we're back.

Sorry for the interruption.  I know many of you were missing the RFC
discussions and debates on Internals.  I'll try not to let it happen
again.  ;-P

If anyone sees any issues that could be related to the below, please let us
know ASAP on syst...@php.net and/or https://bugs.php.net/.

Thank you.
 On Apr 16, 2012 6:15 PM, Daniel Brown paras...@gmail.com wrote:

 Just a reminder, see the below message.
 On Apr 13, 2012 3:43 PM, Daniel Brown danbr...@php.net wrote:

Greetings, all;

This coming Monday, 16 April, 2012, between the hours of 18:00 and
 20:00 EDT (22:00 to 00:00 GMT), the one of the primary php.net servers
 will be undergoing a critical preventative maintenance operation.  In
 this two-hour maintenance window, we do expect a period of
 interruption lasting up to thirty minutes, during which certain core
 services will be partially or totally unavailable.

The system that will experience the downtime is OSU1PHP.PHP.NET
 which, among other things, is the primary system for our mail exchange
 and master database.  As such, a sample of services that will likely
 be unavailable for a short period of time will include:

* Email (including mailing lists)
* Events, user, and mirror management
* User note submissions from userland
* Et cetera

We are informed by the on-site staff in Oregon State University's
 Open Source Lab, who quite generously provide this system
 free-of-charge, that while the maintenance is anticipated to take up
 to thirty minutes, they will be making all attempts to limit the
 downtime to a period of just five to ten minutes.

My apologies for any inconvenience this may cause any of you, but
 as stated, this is critical preventative maintenance that is required
 to protect the integrity of the system, and to ensure that these
 services are not negatively impacted in the future.

Please contact me directly if you have any questions or concerns.

Thanks, all, and have a great weekend.

 --
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/


---End Message---
---BeginMessage---

Hi, Tommy,

Thank you!

You are great that after all other methods tried, I finally upgrade my 
php version, and found it's worked!!!


The CentOS VPS use Cent OS 5.5 and PHP 5.1.6 as default, but it has 
problem for supporting custom session save handlers. It's weird that no 
one and no doc mentioned this!!!


My suggestions is using PHP Version 5.2.6 or later to using such feature.

Mingda

On 2012/4/16 10:45, Tommy Pham wrote:

On Sat, Apr 14, 2012 at 9

php-general Digest 15 Apr 2012 10:46:04 -0000 Issue 7775

2012-04-15 Thread php-general-digest-help

php-general Digest 15 Apr 2012 10:46:04 - Issue 7775

Topics (messages 317546 through 317552):

Re: case-insensitive $_REQUEST,$_GET,$_POST keys?
317546 by: David OBrien
317550 by: tamouse mailing lists

Upcoming Outage: php.net
317547 by: Daniel Brown
317548 by: Govinda

tempnam() not working as expected...
317549 by: tamouse mailing lists
317551 by: Matijn Woudt

strict nannying ...
317552 by: Lester Caine

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---
On Fri, Apr 13, 2012 at 1:13 PM, tamouse mailing lists 
tamouse.li...@gmail.com wrote:

 Anyone have a quick-and-dirty way to check $_REQUEST keys that is
 case-insensitive?

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


this what you asking?

foreach ( $_REQUEST as $key = $value ) {
  if ( strtolower($key) in array('name','username','password')) $data[
strtolower($key) ] = $value;
}
---End Message---
---BeginMessage---
On Fri, Apr 13, 2012 at 12:22 PM, David OBrien dgobr...@gmail.com wrote:
 On Fri, Apr 13, 2012 at 1:13 PM, tamouse mailing lists
 tamouse.li...@gmail.com wrote:

 Anyone have a quick-and-dirty way to check $_REQUEST keys that is
 case-insensitive?

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 this what you asking?

 foreach ( $_REQUEST as $key = $value ) {
       if ( strtolower($key) in array('name','username','password')) $data[
 strtolower($key) ] = $value;
 }

That would do it! Thanks.
---End Message---
---BeginMessage---
Greetings, all;

This coming Monday, 16 April, 2012, between the hours of 18:00 and
20:00 EDT (22:00 to 00:00 GMT), the one of the primary php.net servers
will be undergoing a critical preventative maintenance operation.  In
this two-hour maintenance window, we do expect a period of
interruption lasting up to thirty minutes, during which certain core
services will be partially or totally unavailable.

The system that will experience the downtime is OSU1PHP.PHP.NET
which, among other things, is the primary system for our mail exchange
and master database.  As such, a sample of services that will likely
be unavailable for a short period of time will include:

* Email (including mailing lists)
* Events, user, and mirror management
* User note submissions from userland
* Et cetera

We are informed by the on-site staff in Oregon State University's
Open Source Lab, who quite generously provide this system
free-of-charge, that while the maintenance is anticipated to take up
to thirty minutes, they will be making all attempts to limit the
downtime to a period of just five to ten minutes.

My apologies for any inconvenience this may cause any of you, but
as stated, this is critical preventative maintenance that is required
to protect the integrity of the system, and to ensure that these
services are not negatively impacted in the future.

Please contact me directly if you have any questions or concerns.

Thanks, all, and have a great weekend.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/
---End Message---
---BeginMessage---
This coming Monday, 16 April, 2012, between the hours of 18:00 and
 20:00 EDT (22:00 to 00:00 GMT), the one of the primary php.net servers
 will be undergoing a critical preventative maintenance operation.
 [snip]


thanks for the heads up!
:-)

---End Message---
---BeginMessage---
Can someone explain the following to me:


?php
$d=tempnam(.,dir);  /* create a temp named file */
unlink($d); /* unlink it because we're going to make it a 
directory */
mkdir($d,777,true); /* make the directory */
echo $d is . (is_dir($d)?'':'NOT'). a directory\n;


$f=tempnam($d,file);  /* using the first directory, create a new
temp named file */
unlink($f); /* unlink it as we're going to make it a 
directory */
mkdir($f,777,true); /* make the directory */
echo $f is . (is_dir($f)?'':'NOT'). a directory\n;
?

/Users/tamara/Sites/gallery/lib/common/t/dirGuWOLW is  a directory
/private/var/folders/pI/pIx-p0mhH5eEQ64yAiDQmE+++TI/-Tmp-/fileC7Rnzg
is  a directory

Why isn't the second tempnam using the directory path I pass to it?

The strange thing I notice is that if I pass in a directory path to
tempnam that was NOT created initially by tempnam, it works:

miishka:t tamara$ mkdir a
miishka:t tamara$ php -r 'echo
tempnam(/Users/tamara/Sites/gallery/lib/common/t/a,file).PHP_EOL;'
/Users/tamara/Sites/gallery/lib/common/t/a/filepSwRzF
miishka:t tamara$
---End Message

php-general Digest 16 Apr 2012 02:00:11 -0000 Issue 7776

2012-04-15 Thread php-general-digest-help

php-general Digest 16 Apr 2012 02:00:11 - Issue 7776

Topics (messages 317553 through 317562):

Re: strict nannying ...
317553 by: Stuart Dallas
317554 by: Lester Caine
317555 by: Stuart Dallas
317556 by: Lester Caine
317557 by: Stuart Dallas
317558 by: Lester Caine
317559 by: Stuart Dallas

Customized Session Handler can not work for PHP 5.1.6 and CentOS 5.5
317560 by: Mingda
317561 by: Mingda
317562 by: Mingda

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---
On 15 Apr 2012, at 11:44, Lester Caine wrote:

 I've got a machine set up with PHP5.4 and left the strict errors showing, and 
 I'm falling at the first hurdle :)
 
 The functions for generating URL's are used both statically and as part of 
 the class. STRICT complains because they are not marked 'static' ( and I'm 
 assuming 'public static' is the correct addition here ) but then of cause the 
 $this fallback fails because '$this' is not allowed IN the static use of the 
 function?
 
 How do others get around this problem? I've some 120 static instances to fix 
 in parallel with about the same number of class uses across about 40 odd 
 functions. Do I really have to duplicate the code and rename every static use?

If the class can be used both statically and as an instance why is it referring 
to $this? When called statically $this will not exist.

To refer to the class when in a static method use self...

?php
class StaticClass
{
  public static $staticVariable = 1234;

  public static function staticMethod()
  {
return self::otherStaticMethod();
  }

  public static function otherStaticMethod()
  {
return self::$staticVariable;
  }
}

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
---End Message---
---BeginMessage---

Stuart Dallas wrote:

On 15 Apr 2012, at 11:44, Lester Caine wrote:


I've got a machine set up with PHP5.4 and left the strict errors showing, and 
I'm falling at the first hurdle :)

The functions for generating URL's are used both statically and as part of the 
class. STRICT complains because they are not marked 'static' ( and I'm assuming 
'public static' is the correct addition here ) but then of cause the $this 
fallback fails because '$this' is not allowed IN the static use of the function?

How do others get around this problem? I've some 120 static instances to fix in 
parallel with about the same number of class uses across about 40 odd 
functions. Do I really have to duplicate the code and rename every static use?


If the class can be used both statically and as an instance why is it referring 
to $this? When called statically $this will not exist.

To refer to the class when in a static method use self...

?php
class StaticClass
{
   public static $staticVariable = 1234;

   public static function staticMethod()
   {
 return self::otherStaticMethod();
   }

   public static function otherStaticMethod()
   {
 return self::$staticVariable;
   }
}


This is all legacy code only some of which I wrote, and the function IS working 
happily with 'STRICT' switched off. I'm just trying to work out how to remove 
the messages that switching 'STRICT' on creates - which in this case is 
complaining when the function IS called statically without being defined as 
such. The function creates a url based on the information supplied, and if no 
information is supplied it uses $this to access the data directly. The problem 
now is getting both uses of the function working, but it looks like I HAVE to 
duplicate the code ... or rather work out how to get the correct values selected 
before calling the static version of the code.


With reference to the above, does self:: replace parent:: when trying to call 
the base functionality which is where I think I am trying to head ... 
getDisplayUrl() gives me a url in one of a number of formats depending what 
style of url is selected, and the base package that created it, so the use both 
statically and 'dynamically' made perfect sense 10 years ago :)


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
---End Message---
---BeginMessage---
On 15 Apr 2012, at 13:30, Lester Caine wrote:

 Stuart Dallas wrote:
 On 15 Apr 2012, at 11:44, Lester Caine wrote:
 
 I've got a machine set up with PHP5.4 and left the strict errors showing, 
 and I'm falling at the first hurdle :)
 
 The functions for generating URL's are used both statically and as part

php-general Digest 13 Apr 2012 17:13:26 -0000 Issue 7774

2012-04-13 Thread php-general-digest-help

php-general Digest 13 Apr 2012 17:13:26 - Issue 7774

Topics (messages 317545 through 317545):

case-insensitive $_REQUEST,$_GET,$_POST keys?
317545 by: tamouse mailing lists

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---
Anyone have a quick-and-dirty way to check $_REQUEST keys that is
case-insensitive?
---End Message---


php-general Digest 9 Apr 2012 13:58:06 -0000 Issue 7767

2012-04-09 Thread php-general-digest-help

php-general Digest 9 Apr 2012 13:58:06 - Issue 7767

Topics (messages 317489 through 317492):

Re: php books
317489 by: Jason Pruim
317490 by: Jason Pruim

insteadof considered harmful
317491 by: Szczepan Hołyszewski
317492 by: TR Shaw

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---


On Apr 8, 2012, at 8:53 PM, Kirk Bailey kbai...@howlermonkey.net wrote:

 Revisiting said dead horse, it's interesting there is no clear  consensus of 
 opinion about what is the best book to use to learn php. Generally, you get 
 several people chiming in talking about the website. Now the website is the 
 bomb indeed, BUT IT'S NOT A BOUND BOOK! So that's a terrific answer to a 
 totally different question.
 
 It's interesting really; it suggests there is a wide range of perspectives 
 and mindsets about wha is the best way to come to understand php. Possibly 
 this suggests something about the general mindset of the php community- wide 
 ranging individualism?

By our nature as programmers we all have very different ways to look at things. 
And if we don't like the way things are being done with the current tools we 
change it... We fix it  

That being said I've been considering a project that would take sample code and 
explain why it dos what it does... Make it reviewed by the big wigs here and 
possibly go as far as printing it... But definitely an ebook type thing.

Anyone interested in helping on a project like that?---End Message---
---BeginMessage---


On Apr 8, 2012, at 9:15 PM, Jason Pruim li...@pruimphotography.com wrote:

 
 
 On Apr 8, 2012, at 8:53 PM, Kirk Bailey kbai...@howlermonkey.net wrote:
 
 Revisiting said dead horse, it's interesting there is no clear  consensus of 
 opinion about what is the best book to use to learn php. Generally, you get 
 several people chiming in talking about the website. Now the website is the 
 bomb indeed, BUT IT'S NOT A BOUND BOOK! So that's a terrific answer to a 
 totally different question.
 
 It's interesting really; it suggests there is a wide range of perspectives 
 and mindsets about wha is the best way to come to understand php. Possibly 
 this suggests something about the general mindset of the php community- wide 
 ranging individualism?
 
 By our nature as programmers we all have very different ways to look at 
 things. And if we don't like the way things are being done with the current 
 tools we change it... We fix it  
 
 That being said I've been considering a project that would take sample code 
 and explain why it dos what it does... Make it reviewed by the big wigs here 
 and possibly go as far as printing it... But definitely an ebook type thing.
 
 Anyone interested in helping on a project like that?

And I just realized I hijacked your thread... I apologize! My brain has not 
started up from the weekend yet If there is interest I'll start a specific 
thread for it! :)

*slaps his own wrist*

---End Message---
---BeginMessage---

I must admit with embarrassment that after months of googling and posting 
questions to various forums I still fail to understand the purpose of the 
insteadof keyword and the insteadof clause.

As I currently see it, the whole insteadof clause is completely redundant. In 
a clause like this:

Foo::tweak insteadof Bar;

the insteadof Bar part does not specify any information that is not already 
unambiguously specified by the Foo::tweak part. Foo::tweak; already 
conveys the intention of using tweak from the trait Foo instead of any other 
trait that has a member named tweak. What if we are using seven such traits? 
Do we have to list them all after insteadof? Why do we have to explicitly 
enumerate things that we DON'T want to use?

I would like to see a small code example where the insteadof clause provides  
information that is BOTH necessary to make the program unambiguous AND cannot 
be conveyed with the simple Foo::tweak; syntax. Absent such example, I 
consider insteadof harmful because it does nothing and adds a maintenance 
chore. It should be made optional and deprecated ASAP, and removed at some 
point in the future.

Szczepan Hołyszewski
---End Message---
---BeginMessage---

On Apr 9, 2012, at 7:15 AM, Szczepan Hołyszewski wrote:

 
 I must admit with embarrassment that after months of googling and posting 
 questions to various forums I still fail to understand the purpose of the 
 insteadof keyword and the insteadof clause.
 
 As I currently see it, the whole insteadof clause is completely redundant. In 
 a clause like this:
 
 Foo::tweak insteadof Bar;
 
 the insteadof Bar part does not specify any information that is not already 
 unambiguously specified by the Foo

php-general Digest 9 Apr 2012 00:54:28 -0000 Issue 7766

2012-04-08 Thread php-general-digest-help

php-general Digest 9 Apr 2012 00:54:28 - Issue 7766

Topics (messages 317484 through 317488):

Re: image inventoryer
317484 by: tamouse mailing lists
317486 by: Kirk Bailey
317487 by: Tedd Sperling

Re: Watch out for automatic type casting
317485 by: tamouse mailing lists

php books
317488 by: Kirk Bailey

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---
On Sat, Apr 7, 2012 at 10:35 PM, Kirk Bailey kbai...@howlermonkey.net wrote:
 html
 head
 titleImage inventory of this directory/title
 style TYPE=text/css
 body { margin-left: 10; margin-right: 10%; }
 body {background-attachment:fixed;}
 A:link, A:visited,  A:active { text-decoration:none; }
 A:hover { text-decoration:underline; }
 .justify{text-align:justify;}
 .center{text-align:center;}
 /style
 /head
 body bgcolor=#A0A0A0 TEXT=BLACK LINKS=BLUE
 CENTERThis page inventories the contents of this directory and lists all
 image files in order- as
 the computer determines such matters. Here is the full inventory.
 hr align=center
 P
 ?php
 foreach (glob(*.*) as $filename) {
    echo 'img src='.$filename.''.br\n$filename\nP\n;
 }
 ?
 /body/html


 This works nicely. copied code from online manual, chainsaw editing to fit,
 superglue in the spare parts needed and it lists them all and composes
 proper img links to display on the inventory page. NOW I have the tool i
 needed; can someone else put this to good work?

Well, congrats on a first somewhat useful program. All I have to say
now is: you have a long way to go.
---End Message---
---BeginMessage---

Thank you!
Not QUITE the first; I have used snippets and small routines for a 
while; however I did not know how to do this in php.


Turns out there are at least 2 methods: glob, and an iteration of 
the directory with readdir() to build up an array, then one by one 
print the elements in the array. In python this is not hard. 
Iteration in python is somewhat different- not to mention getting 
used to do blocks. Being so used to snake charming, learning a new 
way means getting used to different procedures.


On 4/8/2012 2:18 AM, tamouse mailing lists wrote:

On Sat, Apr 7, 2012 at 10:35 PM, Kirk Baileykbai...@howlermonkey.net  wrote:

html
head
titleImage inventory of this directory/title
style TYPE=text/css
body { margin-left: 10; margin-right: 10%; }
body {background-attachment:fixed;}
A:link, A:visited,  A:active { text-decoration:none; }
A:hover { text-decoration:underline; }
.justify{text-align:justify;}
.center{text-align:center;}
/style
/head
body bgcolor=#A0A0A0 TEXT=BLACK LINKS=BLUE
CENTERThis page inventories the contents of this directory and lists all
image files in order- as
the computer determines such matters. Here is the full inventory.
hr align=center
P
?php
foreach (glob(*.*) as $filename) {
echo 'img src='.$filename.''.br\n$filename\nP\n;
}
?
/body/html


This works nicely. copied code from online manual, chainsaw editing to fit,
superglue in the spare parts needed and it lists them all and composes
proper img links to display on the inventory page. NOW I have the tool i
needed; can someone else put this to good work?

Well, congrats on a first somewhat useful program. All I have to say
now is: you have a long way to go.

---End Message---
---BeginMessage---
Kirk:

Okay, you took the first step. Now please review this:

?php
foreach (glob(images/*.jpg) as $filename)
{
   echo(img src=\$filename\br$filename brbr);
}
?

Note:

1. This example does not put in all the embedded formatting shown in your 
example. What you did was simply bad form -- you should learn css as well. 
Also, you don't need to place the code within a bunch of html -- it will work 
as-is.

2. I always want my students to place images in an image directory -- the above 
conforms to that.

3. The example also shows how to separate the jpg's from other files in the 
directory.


So, where do you want to go now?

Cheers,

tedd


_
tedd.sperl...@gmail.com
http://sperling.com





---End Message---
---BeginMessage---
On Sat, Apr 7, 2012 at 1:55 PM, Maciek Sokolewicz
maciek.sokolew...@gmail.com wrote:
 On 07-04-2012 16:37, Bogdan Ribic wrote:
[snip]

 Bogdan,
 you are reviving a thread over a week old, and repeating what 4 other people
 have already stated. Please don't do that, it just results in
 mailinglist-noise.

 - Tul

plus, you top-posted /piling-on
---End Message---
---BeginMessage---
Revisiting said dead horse, it's interesting there is no clear  
consensus of opinion about what is the best book to use to learn 
php. Generally, you get several people chiming in talking about the 
website. Now the website is the bomb indeed, BUT IT'S NOT A BOUND

php-general Digest 7 Apr 2012 14:37:39 -0000 Issue 7764

2012-04-07 Thread php-general-digest-help

php-general Digest 7 Apr 2012 14:37:39 - Issue 7764

Topics (messages 317474 through 317481):

Re: image inventoryer
317474 by: David OBrien
317475 by: Jim Giner
317476 by: David OBrien
317477 by: Tedd Sperling
317479 by: tamouse mailing lists
317480 by: Jim Giner

Re: foreach
317478 by: tamouse mailing lists

Re: Watch out for automatic type casting
317481 by: Bogdan Ribic

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---
On Fri, Apr 6, 2012 at 8:34 AM, Jim Giner jim.gi...@albanyhandball.comwrote:

 Kirk Bailey kbai...@howlermonkey.net wrote in message
 news:4f7e5d2f.3050...@howlermonkey.net...
  jim, I am a novice at this language as I said.
 

 Then you are taking on too big of a task.

 When I decided to pick up some web programming skills I bought a $50
 book/manual on learning PHP and another on MySQL.  I read them - cover to
 cover.  Then I made up simple tasks to develop in order to LEARN how it's
 actually done.  Sounds like you not only want someone to program it for
 you,
 but probably help you implement it too.  Sure - I or someone with time on
 their hands - could reply back with a couple hundred lines of code and give
 you your answer.  Then what would you have gained?

 Hey - I gave you the outline of how this goal of yours could be
 accomplished.  No need for your own pseudo-code at this point.  Take mine
 and go do some research!  Have fun!  Then come back for clarification on
 what you're doing wrong once you have some actual code written.

 
  And were people this nice to you when YOU asked beginner questions?
 
 When I asked beginner questions, it was AFTER I had written something and
 ran into a roadblock.  NOT before I had set pen to paper.  You're asking
 how
 to get to California without having consulted a map yet.  This site will be
 there for you when you have a problem - don't worry.  Me included, not that
 my input is that worthy.



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


I googled php show images in folder and lo and behold  the first was was
a script almost exactly what you are wanting to do
---End Message---
---BeginMessage---
David OBrien dgobr...@gmail.com wrote in message 
news:CAF=yD_06vDEHLP-nyEJxUNt6nHexA42X90U5-6+MBzc0=tc...@mail.gmail.com...

 I googled php show images in folder and lo and behold  the first was was
 a script almost exactly what you are wanting to do

Damn - now the OP missed a golden opportunity to do some research!  :) 


---End Message---
---BeginMessage---
On Apr 6, 2012 9:51 AM, Jim Giner jim.gi...@albanyhandball.com wrote:

 David OBrien dgobr...@gmail.com wrote in message
 news:CAF=yD_06vDEHLP-nyEJxUNt6nHexA42X90U5-6+MBzc0=tc...@mail.gmail.com...
 
  I googled php show images in folder and lo and behold  the first was
was
  a script almost exactly what you are wanting to do
 
 Damn - now the OP missed a golden opportunity to do some research!  :)



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


It's been my experience if they haven't even used google to see what
premade scripts are available to do something similar then the research
ain't gonna happen.

They'd just post on ee or another forum where they could get the answer
easier
---End Message---
---BeginMessage---
On Apr 5, 2012, at 10:26 PM, Kirk Bailey wrote:

 I need a page that will live in a directory and list all image files in 
 there. That is, the page has
 img src=./foo.typeP
 tags emitted in it's structure, one per file in the directory with a saught 
 file type- .png, .gif, .jpg, you get the idea.
 this should use relative addressing so once the tool is built I can use it in 
 other directories as is.
 
 Now ai am still a novice at p[hp, how can I do this ?
 
 -- 
 end
 
 Very Truly yours,
 - Kirk Bailey,


Kirk:

That will be a good exercise for you. If you want help, then show us something 
where you did something other than ask for the code.

For example, show us *your* code (or attempt) to list all the files in a 
directory. That's pretty simple. After you do that, then we can move on to the 
next step.

Please realize we are not here to write code for you  but rather to help you 
with *your* code.

Cheers,

tedd

_
tedd.sperl...@gmail.com
http://sperling.com
---End Message---
---BeginMessage---
On Thu, Apr 5, 2012 at 10:04 PM, Kirk Bailey kbai...@howlermonkey.net wrote:
 jim, I am a novice at this language as I said.
 And were people this nice to you when YOU asked beginner questions?

When I ask beginner questions, I spend time doing

php-general Digest 8 Apr 2012 03:36:04 -0000 Issue 7765

2012-04-07 Thread php-general-digest-help

php-general Digest 8 Apr 2012 03:36:04 - Issue 7765

Topics (messages 317482 through 317483):

Re: Watch out for automatic type casting
317482 by: Maciek Sokolewicz

image inventoryer
317483 by: Kirk Bailey

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---

On 07-04-2012 16:37, Bogdan Ribic wrote:

This is *not* typecasting at all, this is assignment of a result of
boolean operator, and it boils down to operator precedence.

It's equivalent to this code:

$b = $x == 11;

in the part that right side of equation sign is calculated first, then
assigned to lvalue. In effect, you wrote this:

$pos = (strpos($sText, test) !== FALSE);

You would often use something like this in code:

$isSame = $x == $y;

which would put a boolean into $isSame, not put value of $x and then
compare it.


Bogdan,
you are reviving a thread over a week old, and repeating what 4 other 
people have already stated. Please don't do that, it just results in 
mailinglist-noise.


- Tul

---End Message---
---BeginMessage---

html
head
titleImage inventory of this directory/title
style TYPE=text/css
body { margin-left: 10; margin-right: 10%; }
body {background-attachment:fixed;}
A:link, A:visited,  A:active { text-decoration:none; }
A:hover { text-decoration:underline; }
.justify{text-align:justify;}
.center{text-align:center;}
/style
/head
body bgcolor=#A0A0A0 TEXT=BLACK LINKS=BLUE
CENTERThis page inventories the contents of this directory and 
lists all image files in order- as

the computer determines such matters. Here is the full inventory.
hr align=center
P
?php
foreach (glob(*.*) as $filename) {
echo 'img src='.$filename.''.br\n$filename\nP\n;
}
?
/body/html


This works nicely. copied code from online manual, chainsaw editing 
to fit, superglue in the spare parts needed and it lists them all 
and composes proper img links to display on the inventory page. NOW 
I have the tool i needed; can someone else put this to good work?


--
end

Very Truly yours,
 - Kirk Bailey,
   Largo Florida

   kniht
  +-+
  | BOX |
  +-+
   think

---End Message---


php-general Digest 6 Apr 2012 12:34:03 -0000 Issue 7763

2012-04-06 Thread php-general-digest-help

php-general Digest 6 Apr 2012 12:34:03 - Issue 7763

Topics (messages 317462 through 317473):

foreach
317462 by: Ethan Rosenberg
317463 by: Jim Giner
317465 by: Al

Re: [PHP-DB] Re: foreach
317464 by: Karl DeSaulniers
317466 by: Kris Carlson

image inventoryer
317467 by: Kirk Bailey
317468 by: Tommy Pham
317469 by: Jim Giner
317470 by: Kirk Bailey
317471 by: Kirk Bailey
317472 by: Tommy Pham
317473 by: Jim Giner

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---

Dear Lists -

I know I am missing something fundamental - but I have no idea where 
to start to look.


Here are code snippets:

I have truncated the allowed_fields to make it easier to debug.

 $allowed_fields = array(  'Site' ='POST[Site]', 'MedRec' = 
'$_POST[MedRec]', 'Fname' = '$_POST[Fname]'   );

 echo post #1\n;
 print_r($_POST);

RESPONSE:

 post #1
Array
(
[Site] = AA
[MedRec] = 10002
[Fname] =
[Lname] =
[Phone] =
[Height] =
[welcome_already_seen] = already_seen
[next_step] = step10
)



//  $allowed_fields = array(Site, MedRec, 
Fname, Lname, // previous statement of $allowed_fields

  //  Phone, Sex, Height);



Key Site, Value POST[Site]
Key MedRec, Value $_POST[MedRec]
Key Fname, Value $_POST[Fname]



foreach ($allowed_fields as $key = $val) {
print Key $key, Value $val\n;
}


if(isset($_Request['Sex']) trim($_POST['Sex']) != '' )
{
if ($_REQUEST['Sex'] === 0)
{
$sex = 'Male';
}
else
{
$sex = 'Female';
}
}
 }
echo Post#2;
print_r($_POST);
   if(empty($allowed_fields))
//RESPONSE

Post#2Array
(
[Site] = AA
[MedRec] = 10002
[Fname] =
[Lname] =
[Phone] =
[Height] =
[welcome_already_seen] = already_seen
[next_step] = step10
)



   {
 echo ouch;
   }

foreach ( $allowed_fields as $key = $val ) //This is line 198
{
if ( ! empty( $_POST['val'] ) )
{
print Key $key, Value $val\n;
$cxn = mysqli_connect($host,$user,$password,$db);
$value = mysql_real_escape_string( $_POST[$fld] );
$query .=  AND $fld = '$_POST[value]' ;
   echo #1 $query; //never echos the query
}
}

These are the messages I receive on execution of the script:

Notice: Undefined variable: allowed_fields in 
/var/www/srchrhsptl5.php on line 198
Warning: Invalid argument supplied for foreach() in 
/var/www/srchrhsptl5.php on line 198


Advice and help, please.

Thank you.

Ethan Rosenberg



---End Message---
---BeginMessage---
I don't know about others, but I can't make sense of this - way too much 
presented with no idea of what I am looking at - code or output.

One thing:  $_Request is not the same var as $_REQUEST. 


---End Message---
---BeginMessage---



On 4/5/2012 4:15 PM, Ethan Rosenberg wrote:

Dear Lists -

I know I am missing something fundamental - but I have no idea where to start to
look.

Here are code snippets:

I have truncated the allowed_fields to make it easier to debug.

$allowed_fields = array( 'Site' ='POST[Site]', 'MedRec' = '$_POST[MedRec]',
'Fname' = '$_POST[Fname]' );
echo post #1\n;
print_r($_POST);

RESPONSE:

post #1
Array
(
[Site] = AA
[MedRec] = 10002
[Fname] =
[Lname] =
[Phone] =
[Height] =
[welcome_already_seen] = already_seen
[next_step] = step10
)



// $allowed_fields = array(Site, MedRec, Fname, Lname, // previous
statement of $allowed_fields
// Phone, Sex, Height);



Key Site, Value POST[Site]
Key MedRec, Value $_POST[MedRec]
Key Fname, Value $_POST[Fname]



foreach ($allowed_fields as $key = $val) {
print Key $key, Value $val\n;
}


if(isset($_Request['Sex']) trim($_POST['Sex']) != '' )
{
if ($_REQUEST['Sex'] === 0)
{
$sex = 'Male';
}
else
{
$sex = 'Female';
}
}
}
echo Post#2;
print_r($_POST);
if(empty($allowed_fields))
//RESPONSE

Post#2Array
(
[Site] = AA
[MedRec] = 10002
[Fname] =
[Lname] =
[Phone] =
[Height] =
[welcome_already_seen] = already_seen
[next_step] = step10
)



{
echo ouch;
}

foreach ( $allowed_fields as $key = $val ) //This is line 198
{
if ( ! empty( $_POST['val'] ) )
{
print Key $key, Value $val\n;
$cxn = mysqli_connect($host,$user,$password,$db);
$value = mysql_real_escape_string( $_POST[$fld] );
$query .=  AND $fld = '$_POST[value]' ;
echo #1 $query; //never echos the query
}
}

These are the messages I receive on execution of the script:

Notice: Undefined variable: allowed_fields

php-general Digest 3 Apr 2012 06:13:26 -0000 Issue 7758

2012-04-03 Thread php-general-digest-help

php-general Digest 3 Apr 2012 06:13:26 - Issue 7758

Topics (messages 317428 through 317435):

Re: Thinking out loud - a continuation...
317428 by: Jay Blanchard
317429 by: Matijn Woudt
317430 by: Robert Cummings

Re: Could apc_fetch return a pointer to data in shared memory ?
317431 by: Stuart Dallas
317435 by: Simon

Re: Variable representation
317432 by: tamouse mailing lists

Adding Rows In PHPMYADMIN
317433 by: Karl James
317434 by: Tommy Pham

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---
[snip]
 function getTiersJson( $company )
 {
$tiers = getTiers( $company );
$json = JSON_encode( $tiers );
 }
 
 $tiersJson = getTiersJson( 1 );
 
 ?
 
 This will output JSON with the following structure:
 
[/snip]

OK, now I know I am being dense - but don't I have to add return $json; to 
getTiersJson() ?---End Message---
---BeginMessage---
On Mon, Apr 2, 2012 at 10:36 PM, Jay Blanchard
jay.blanch...@sigmaphinothing.org wrote:
 [snip]
 function getTiersJson( $company )
 {
    $tiers = getTiers( $company );
    $json = JSON_encode( $tiers );
 }

 $tiersJson = getTiersJson( 1 );

 ?

 This will output JSON with the following structure:

 [/snip]

 OK, now I know I am being dense - but don't I have to add return $json; to 
 getTiersJson() ?

Of course ;)
---End Message---
---BeginMessage---

On 12-04-02 04:36 PM, Jay Blanchard wrote:

[snip]

function getTiersJson( $company )
{
$tiers = getTiers( $company );
$json = JSON_encode( $tiers );
}

$tiersJson = getTiersJson( 1 );

?

This will output JSON with the following structure:


[/snip]

OK, now I know I am being dense - but don't I have to add return $json; to 
getTiersJson() ?


yeah, *lol* in my testing I had a print_r() in the getTiersJson() so 
didn't notice I wasn't returning since I didn't do anything with the 
captured value (null without a proper return).


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.
---End Message---
---BeginMessage---
On 2 Apr 2012, at 15:37, Simon wrote:

 On 2 April 2012 14:27, Stuart Dallas stu...@3ft9.com wrote:
 On 2 Apr 2012, at 14:12, Simon wrote:
 
  Thanks Maciek
 
  On 2 April 2012 10:37, Maciek Sokolewicz 
  maciek.sokolew...@gmail.comwrote:
 
  On 02-04-2012 10:12, Simon wrote:
 
  Thanks Simon. you got my hopes up there for a second.
 
  From the php docs page:
 
  Critics further argue that it is pointless to use a Singleton in a Shared
 
  Nothing Architecture like PHP where objects are uniquewithin the Request
  only anyways.
 
  I want the the singleton class to be global to the entire application (ie
  shared by reference across all requests). I'd agree with the above
  critics that if you have to instantiate your singleton for each request,
  it's rather pointless.
 
  Well, that's simply not possible due to the shared nothing paradigm.
  If you want to share, you need to either share it via another medium (such
  as a database, as has been suggested a dozen times already) or switch to a
  different language.
 
 
 
  PHP is based on this paradigm, and you should not expect of it to violate
  it just because you want to do things a certain way, which is not the PHP
  way.
 
 
  The existence of memcached, shm and apc_fetch tell me that PHP already
  accepts the need for sharing data between processes. All I'm arguing for is
  the ability to share the data by reference rather than by copy.
 
 
 As already mentioned several times the closest you will get is shared memory 
 (as used by APC), but you can't access that by reference because shared 
 read/write resources need controlled access for stability.
 
 I know. I understand that (and the issues with locking that might arise if 
 truly shared memory was available).
 
 I can't find any material that explains how the .net framework implements 
 application variables. You mentioned earlier that you *know* that when you 
 access them you do so by reference. Do you have a source for this knowledge 
 or is it some sort of sixth sense?
 
 Source: 10+ years as an ASP and ASP.NET developer. 

Wow. As knowledge goes that's up there with I believe it therefore it is.

 Having looked for documentation, I agree, it's utterly terrible. It's as if 
 even Microsoft themselves don't fully understand the advantages that 
 application variables give them over the competition. (Though they're hardly 
 likely to be forthcoming about helping others implement similar features

php-general Digest 3 Apr 2012 19:16:36 -0000 Issue 7759

2012-04-03 Thread php-general-digest-help

php-general Digest 3 Apr 2012 19:16:36 - Issue 7759

Topics (messages 317436 through 317437):

Re: learning resources for PHP
317436 by: Daniel Brown

Re: Node.PHP
317437 by: Joseph Moniz

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---
On Mon, Apr 2, 2012 at 23:53, Tim Dunphy bluethu...@gmail.com wrote:
 Hello list,

  I am quite sure that you've heard this question at least a few times
 before. :) But I have been dabbling a bit in PHP for years and I've
 decided that its' high time that became serious about getting a solid
 grounding in it. Currently I work as a Sysadmin and have modest but
 reliable skills in bash and perl. But I consider PHP more of an
 artform and I really need to 'pick up a brush and start painting' so
 to speak.

  So what I was wondering what websites, and books you'd recommend to
 someone who (for all intents and purpose) is just starting out.

  On my hit list of things to learn are basic php / database
 interaction (mysql mainly).. then how to accelerate php interraction
 through memcache.. and eventually one I have all that down onto using
 some of the NoSQLs (mongo/cassandra/membase, etc).

 Thanks!

 -tim


 --
 GPG me!!

 gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B

Your question is better asked (and will certainly be better
answered) on the general list at php-gene...@lists.php.net, Tim, and
I've CC'd the list for you.  If you haven't already, please subscribe
to that list to ensure you receive all the responses.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/
---End Message---
---BeginMessage---
On Fri, Mar 30, 2012 at 5:56 PM, German Geek geek...@gmail.com wrote:
 Maybe stupid question, but is node.php really necessary? If you can program
 PHP and it performs better than node.js, why would you need to have another
 wrapper around things. Why not just program normal PHP?

This is normal PHP in the same sense that node.js is normal
javascript, python-tornado is normal python and ruby-event-machine is
normal ruby. The only difference as stated by micheal was the async
IO.

On Fri, Mar 30, 2012 at 6:33 PM, Michael Save
savetheinter...@omegasdg.com wrote:
 Also, I kind of doubt you can outperform node.js with standard PHP.

On Sat, Mar 31, 2012 at 9:37 AM, Daniel Brown danbr...@php.net wrote:
 On Fri, Mar 30, 2012 at 21:33, Michael Save
 savetheinter...@omegasdg.com wrote:
 Because normal PHP is not asynchronous.

 Also, I kind of doubt you can outperform node.js with standard PHP.

    Your doubts are indeed well-grounded.  Using node.js (indeed,
 V8-based apps in general) are compiled as native machine code, which
 don't require the added overhead of a parser, such as PHP.

This has been an on the side just for fun project for me mostly and as
such i originally had the same performance assumptions as stated in
this thread. Basically i was writing this to get familar with php
internals and to understand what goes into designing such a system.

You can imagine my surprise when i ran bench marks against the example
server against an equivelant node.js http server and the node.php
implementation was able to respond to twice as many requests per
second (14k req/s) then node.js could (7k req/s). Though i would take
this with a grain of salt as the benchmark is largely unfair seeing
how node.js is much more feature complete and hardend from production
use. Never the less, i was absolutely shocked that this completely
unoptomized and memory leaky node.php implementation i hacked together
in one night was able to run circles around node.js in naive
benchmarks.

So i was absolutely confused to the performance boost with php so i
started poking around asking people in various freenode channels if
they had any hypothesis on why node.php was able to perform against
node.js.

I stumbled across a similar project to create a node.lua
implemantation called luvit ( http://www.luvit.io ) and it also
boasted the same exact performance boost vs node.js, thats is luvit
was able to do 2x the requests as node.js in the same amount of time.

From my exploration on nodes 1/2x performance vs node.php and luvit
(node.lua) it turns out that V8 is fast only when it has to stay in JS
mode. The problem with node like systems is the JS to native code
boundary must be crossed several times to perform IO. So nodejs-core
get's some of it's best performance boosts from reducing the amount of
times JS has to call out to C++. The unfortunate detail is that
node.js like systems get their power from doing lots of IO and every
IO operation has to call out to C/C++ so node.js performance really
drags around this gotcha in V8.

I hold out some hope

php-general Digest 2 Apr 2012 14:38:52 -0000 Issue 7757

2012-04-02 Thread php-general-digest-help

php-general Digest 2 Apr 2012 14:38:52 - Issue 7757

Topics (messages 317410 through 317427):

Variable representation
317410 by: Ron Piggott
317413 by: Adam Randall
317414 by: Mihamina Rakotomandimby
317415 by: Mihamina Rakotomandimby
317416 by: tamouse mailing lists
317417 by: tamouse mailing lists
317418 by: tamouse mailing lists
317421 by: Maciek Sokolewicz

PHP ISSUE!!!
317411 by: Karl James
317412 by: tamouse mailing lists

Re: Could apc_fetch return a pointer to data in shared memory ?
317419 by: Simon Schick
317420 by: Simon
317422 by: Maciek Sokolewicz
317424 by: Simon
317425 by: Stuart Dallas
317427 by: Simon

Dynamic open_basedir and mod_vhost_alias
317423 by: Alex Domoradov

building php x64 for windows
317426 by: СÓãϺ

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---
Hi Everyone:

I am assigning the value of 4 images to variables following a database query: 

$image_1 = stripslashes( $row['image_1'] );
$image_2 = stripslashes( $row['image_2'] );
$image_3 = stripslashes( $row['image_3'] );
$image_4 = stripslashes( $row['image_4'] );

What I need help with is how to represent the variable using $i for the number 
portion in the following WHILE loop.  I am not sure of how to correctly do it.  
I am referring to: $image_{$i}

===
$i = 1;
while ( $i = 4 ) {

if ( trim( $image_{$i} )   ) { 

echo lia href=\http://www.theverseoftheday.info/store-images/; . 
$image_{$i} . \ title=\Image  . $i . \Image  . $i . /a/li\r\n;

}

++$i;
}
===

How do I substitute $i for the # so I may use a WHILE loop to display the 
images?  (Not all 4 variables have an image.)

Ron Piggott



www.TheVerseOfTheDay.info 
---End Message---
---BeginMessage---
It would better to just use an array, and then iterate through that.

$images[] =  stripslashes( $row['image_1'] );
$images[] =  stripslashes( $row['image_2'] );
$images[] =  stripslashes( $row['image_3'] );
$images[] =  stripslashes( $row['image_4'] );

foreach( $images as $k = $v ) {
$k++; // increment k since it starts at 0, instead of 1
if ( strlen( trim( $v ) ) ) {
echo lia href=\http://www.theverseoftheday.info/store-images/;
. $v . \ title=\Image  . $k . \Image  . $k . /a/li\r\n;
}
}

Adam.

On Sun, Apr 1, 2012 at 8:52 PM, Ron Piggott
ron.pigg...@actsministries.orgwrote:

 Hi Everyone:

 I am assigning the value of 4 images to variables following a database
 query:

 $image_1 = stripslashes( $row['image_1'] );
 $image_2 = stripslashes( $row['image_2'] );
 $image_3 = stripslashes( $row['image_3'] );
 $image_4 = stripslashes( $row['image_4'] );

 What I need help with is how to represent the variable using $i for the
 number portion in the following WHILE loop.  I am not sure of how to
 correctly do it.  I am referring to: $image_{$i}

 ===
 $i = 1;
 while ( $i = 4 ) {

if ( trim( $image_{$i} )   ) {

echo lia href=\http://www.theverseoftheday.info/store-images/;
 . $image_{$i} . \ title=\Image  . $i . \Image  . $i .
 /a/li\r\n;

}

 ++$i;
 }
 ===

 How do I substitute $i for the # so I may use a WHILE loop to display the
 images?  (Not all 4 variables have an image.)

 Ron Piggott



 www.TheVerseOfTheDay.info




-- 
Adam Randall
http://www.xaren.net
AIM: blitz574
Twitter: @randalla0622

To err is human... to really foul up requires the root password.
---End Message---
---BeginMessage---

On 04/02/2012 07:46 AM, Adam Randall wrote:

$images[] =  stripslashes( $row['image_1'] );
$images[] =  stripslashes( $row['image_2'] );
$images[] =  stripslashes( $row['image_3'] );
$images[] =  stripslashes( $row['image_4'] );


$images[1] =  stripslashes( $row['image_1'] );
$images[2] =  stripslashes( $row['image_2'] );
$images[3] =  stripslashes( $row['image_3'] );
$images[4] =  stripslashes( $row['image_4'] );

would force the order.

--
RMA.
---End Message---
---BeginMessage---

On 04/02/2012 06:52 AM, Ron Piggott wrote:

$image_1 = stripslashes( $row['image_1'] );
$image_2 = stripslashes( $row['image_2'] );
$image_3 = stripslashes( $row['image_3'] );
$image_4 = stripslashes( $row['image_4'] );
[...] (Not all 4 variables have an image.)


How is it meant in the database?
If it's NULL have a look at this http://goo.gl/89fYv


--
RMA.
---End Message---
---BeginMessage---
On Sun, Apr 1, 2012 at 10:52 PM, Ron Piggott
ron.pigg...@actsministries.org wrote:
 Hi Everyone:

 I am assigning the value of 4 images to variables following a database query:

 $image_1 = stripslashes( $row['image_1'] );
 $image_2 = stripslashes( $row['image_2'] );
 $image_3

php-general Digest 1 Apr 2012 11:56:20 -0000 Issue 7755

2012-04-01 Thread php-general-digest-help

php-general Digest 1 Apr 2012 11:56:20 - Issue 7755

Topics (messages 317396 through 317403):

Re: Watch out for automatic type casting
317396 by: Maciek Sokolewicz

Websocket using php
317397 by: Leandro Dardini
317401 by: Matijn Woudt
317403 by: Tim Streater

Re: Thinking out loud - a continuation...
317398 by: Jay Blanchard

Re: Node.PHP
317399 by: Daniel Brown

Re: some good deals on good books
317400 by: Daniel Brown

Re: Could apc_fetch return a pointer to data in shared memory ?
317402 by: Stuart Dallas

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---

On 30-03-2012 09:47, Arno Kuhl wrote:

-Original Message-
From: Simon Schick [mailto:simonsimc...@googlemail.com]
Sent: 29 March 2012 07:19 PM
To: a...@dotcontent.net
Cc: php-gene...@lists.php.net
Subject: Re: [PHP] Watch out for automatic type casting

Hi, Arno

FYI: I found a page in the php-manual that's exactly for that:
http://www.php.net/manual/en/language.operators.precedence.php

p.s. some of them were also new to me  Thanks for getting me to read it.

Bye
Simon


Thanks Simon and others, thought it was typecasting, but precedence makes more 
sense.

I remember seeing that table when I first started using php, which is why I always use 
AND and OR rather than  and || because it's lower precedence than the 
assignment and the ternary operators, but I couldn't remember where I'd seen it. So 
thanks for linking to it.

Cheers
Arno
--

BTW interesting to note on that precedence page that ! has a higher precedence than 
= (which you'd expect it to be) but you can still do
if (!$a = foo())

I use that form often (as I'm sure many others do) and just took it for granted 
that it works even though the order of precedence says it shouldn't.

It could be expanded to
if ($a = foo() != TRUE)
But that wouldn't get the expected result due to order of precedence, though at 
first glance you could reasonably expect it to work because of
if (!$a = foo())
being valid.

I think that's why it's so easy to be caught out (at least for me) by the 
similar form of
if ( $pos = strpos($sText, test) !== FALSE)

Cheers
Arno

I would still suggest to explicitly supply the precedence you expect. 
Ie: if(($foo = $var) == true) { }

or if($a + (15*$b) ) { }

I know you can write it with fewer parentheses, but this at least makes 
it 100% clear you at all times WHAT is supposed to happen and you're 
100% sure that PHP will understand what you WANT it to do aswell instead 
of having to guess, and fail at it because you don't know how guessing 
is implemented in the Zend Engine.
---End Message---
---BeginMessage---
Hello,
I have the need to use websockets for the server part of an application I
am developing and I found with a big surprise no websocket class or
procedure is available on the net. Have I missed looking in some place?

Being really interested in using this protocol with PHP, I start from the
closest working thing: http://code.google.com/p/phpwebsocket/ and start
adapting it to the lastest RFC describing the protocol
http://tools.ietf.org/html/rfc6455, but it is really heavy to code and I
feel like reinventing the wheel.

Is there anyone out there who has already written a websocket server in PHP
and like to share the code?

Leandro
---End Message---
---BeginMessage---
On Sat, Mar 31, 2012 at 5:14 PM, Leandro Dardini ldard...@gmail.com wrote:
 Hello,
 I have the need to use websockets for the server part of an application I
 am developing and I found with a big surprise no websocket class or
 procedure is available on the net. Have I missed looking in some place?

 Being really interested in using this protocol with PHP, I start from the
 closest working thing: http://code.google.com/p/phpwebsocket/ and start
 adapting it to the lastest RFC describing the protocol
 http://tools.ietf.org/html/rfc6455, but it is really heavy to code and I
 feel like reinventing the wheel.

 Is there anyone out there who has already written a websocket server in PHP
 and like to share the code?

 Leandro

Have you tried http://code.google.com/p/phpws/ ?

It seems to work pretty simple..

- Matijn
---End Message---
---BeginMessage---
On 31 Mar 2012 at 16:14, Leandro Dardini ldard...@gmail.com wrote: 

 Hello,
 I have the need to use websockets for the server part of an application I
 am developing and I found with a big surprise no websocket class or
 procedure is available on the net. Have I missed looking in some place?

 Being really interested in using this protocol with PHP, I start from the
 closest working thing: http://code.google.com/p/phpwebsocket/ and start
 adapting it to the lastest RFC

php-general Digest 2 Apr 2012 02:25:33 -0000 Issue 7756

2012-04-01 Thread php-general-digest-help

php-general Digest 2 Apr 2012 02:25:33 - Issue 7756

Topics (messages 317404 through 317409):

Command line has no network access
317404 by: Lester Caine
317406 by: David OBrien
317407 by: Matijn Woudt
317408 by: Lester Caine

Re: Could apc_fetch return a pointer to data in shared memory ?
317405 by: Simon

Re: whats wrong
317409 by: tamouse mailing lists

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---
OK I probably know how to do this 10 years ago, but I'm not finding any prompts 
to remind me.


Windows 2000, PHP5.2.10 cli ...
I'm trying to set up a simple dump to run from scheduler. The code runs 
perfectly via the browser so I'm manually having to log in each day to run it. 
I've got an entry in the scheduler to run it, but I simply can't get it running 
from the command line prompt. It can't find even 'localhost' so will not connect 
to the database :(


It's picking up the same ini file, and the same modules are loading, so it is 
just the network access from the command prompt ...


( changes from W2k are simply not possible since the main text to speech engine 
used on the site will not run on anything later and the supplier no longer 
exists :( )


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
---End Message---
---BeginMessage---
On Apr 1, 2012 12:11 PM, Lester Caine les...@lsces.co.uk wrote:

 OK I probably know how to do this 10 years ago, but I'm not finding any
prompts to remind me.

 Windows 2000, PHP5.2.10 cli ...
 I'm trying to set up a simple dump to run from scheduler. The code runs
perfectly via the browser so I'm manually having to log in each day to run
it. I've got an entry in the scheduler to run it, but I simply can't get it
running from the command line prompt. It can't find even 'localhost' so
will not connect to the database :(

 It's picking up the same ini file, and the same modules are loading, so
it is just the network access from the command prompt ...

 ( changes from W2k are simply not possible since the main text to speech
engine used on the site will not run on anything later and the supplier no
longer exists :( )

 --
 Lester Caine - G8HFL
 -
 Contact - http://lsces.co.uk/wiki/?page=contact
 L.S.Caine Electronic Services - http://lsces.co.uk
 EnquirySolve - http://enquirysolve.com/
 Model Engineers Digital Workshop - http://medw.co.uk//
 Firebird - http://www.firebirdsql.org/index.php

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


Find wget for windows and call that with the script in a batch file

wget http://localhost/script.php

Will be like a browser hit it
---End Message---
---BeginMessage---
On Sun, Apr 1, 2012 at 6:10 PM, Lester Caine les...@lsces.co.uk wrote:
 OK I probably know how to do this 10 years ago, but I'm not finding any
 prompts to remind me.

 Windows 2000, PHP5.2.10 cli ...
 I'm trying to set up a simple dump to run from scheduler. The code runs
 perfectly via the browser so I'm manually having to log in each day to run
 it. I've got an entry in the scheduler to run it, but I simply can't get it
 running from the command line prompt. It can't find even 'localhost' so will
 not connect to the database :(

 It's picking up the same ini file, and the same modules are loading, so it
 is just the network access from the command prompt ...

 ( changes from W2k are simply not possible since the main text to speech
 engine used on the site will not run on anything later and the supplier no
 longer exists :( )

 --
 Lester Caine - G8HFL
 -
 Contact - http://lsces.co.uk/wiki/?page=contact
 L.S.Caine Electronic Services - http://lsces.co.uk
 EnquirySolve - http://enquirysolve.com/
 Model Engineers Digital Workshop - http://medw.co.uk//
 Firebird - http://www.firebirdsql.org/index.php


This is usually because of security settings. You might want to check
under which user the scheduler starts the php script.
---End Message---
---BeginMessage---

Matijn Woudt wrote:

This is usually because of security settings. You might want to check
under which user the scheduler starts the php script.
Runs as administrator, it's on a secure internal network so it's not locked 
down. There aren't any other users on the machine anyway.


wget has solved the problem ... running nicely now! Thanks David ...

--
Lester Caine - G8HFL

php-general Digest 31 Mar 2012 11:36:52 -0000 Issue 7754

2012-03-31 Thread php-general-digest-help

php-general Digest 31 Mar 2012 11:36:52 - Issue 7754

Topics (messages 317381 through 317395):

Re: Node.PHP
317381 by: German Geek
317382 by: Michael Save

Could apc_fetch return a pointer to data in shared memory ?
317383 by: Simon
317394 by: Stuart Dallas

Re: securing a script that exec()s
317384 by: tamouse mailing lists
317385 by: rene7705
317390 by: tamouse mailing lists

whats wrong
317386 by: saeed ahmed
317388 by: Tommy Pham
317391 by: Duken Marga
317393 by: tamouse mailing lists
317395 by: Maciek Sokolewicz

some good deals on good books
317387 by: tamouse mailing lists
317389 by: Tommy Pham

Re: saeed ahmed
317392 by: Karl-Arne Gjersøyen

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---
Maybe stupid question, but is node.php really necessary? If you can program
PHP and it performs better than node.js, why would you need to have another
wrapper around things. Why not just program normal PHP?

twitter: geekdenz
Blog: http://www.thheuer.com

On Sat, Mar 31, 2012 at 10:39 AM, Hiyarli Baba root...@gmail.com wrote:

 As like Micheal's said said just keep up alive the project
 I was preferes node.js to pho only when i needed send millions of ssl
 api requests.
 nodejs sends 1k https request in onky 2 second including parsing
 required elements from database , check the returned source write to
 file

 if you want develope / clone more modules for that please start from
 http|s.req :p and let me coninue at php

 http://stackoverflow.com/a/9199961 my nodejs + php thing

 2012/3/22, Michael Save savetheinter...@omegasdg.com:
  Very nice!
 
  I'll have a proper look at this in the morning, and I'll try it out
  for myself. Looking forward to seeing more development on this.
 
  Michael
 
  On Thu, Mar 22, 2012 at 11:40 AM, Joseph Moniz joseph.mo...@gmail.com
  wrote:
  Hey,
 
  So i had my first Hackathon at work last week and my project was to
  prototype making a node.js clone using PHP instead of V8. So i
  snatched up libuv and joyent's HTTP parser and set off on a 24 hour
  coding spree to get something workable. By the time the sun was coming
  out the next morning the following code was working.
 
 ?php
 
 $http = new node_http();
 
 $http-listen(8080, function($request, $response) {
 $response-end(yay, super awesome response);
 });
 
 nodephp_run();
 
 ?
 
  The C code that powers it was whipped together really fast and is kind
  of hackish as a result. The code has some memory leaks that i haven't
  had time to fully track down yet. Some small portions of the code were
  borrowed from the phode project.
 
  In a naive benchmark on this simple server VS an equally simple server
  in node.js this implementation already out performs node.js in
  throughput by being able to serve just under 200% the amount of
  requests per second that node.js could. Take that with a grain of salt
  though because node.js has much more feature and is much more hardend
  from production use. I do believe the PHP binary will have some major
  performance gains over V8 as crossing the PHP -- C barrier seems to
  be a much lighter operation then crossing the V8 -- C++ barrier.
 
  Any help or feedback will be greatly appreciated. The projects source
  code can be found here: https://github.com/JosephMoniz/node.php
 
  - Joseph Moniz
 
  --
  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
 
 

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


---End Message---
---BeginMessage---
Because normal PHP is not asynchronous.

Also, I kind of doubt you can outperform node.js with standard PHP.

On Sat, Mar 31, 2012 at 11:56 AM, German Geek geek...@gmail.com wrote:
 Maybe stupid question, but is node.php really necessary? If you can program
 PHP and it performs better than node.js, why would you need to have another
 wrapper around things. Why not just program normal PHP?

 twitter: geekdenz
 Blog: http://www.thheuer.com

 On Sat, Mar 31, 2012 at 10:39 AM, Hiyarli Baba root...@gmail.com wrote:

 As like Micheal's said said just keep up alive the project
 I was preferes node.js to pho only when i needed send millions of ssl
 api requests.
 nodejs sends 1k https request in onky 2 second including parsing
 required elements from database , check the returned source write to
 file

 if you want develope / clone more modules for that please start from
 http|s.req

php-general Digest 30 Mar 2012 06:23:29 -0000 Issue 7752

2012-03-30 Thread php-general-digest-help

php-general Digest 30 Mar 2012 06:23:29 - Issue 7752

Topics (messages 317338 through 317362):

Watch out for automatic type casting
317338 by: Arno Kuhl
317342 by: Simon Schick
317344 by: Simon Schick
317345 by: Stuart Dallas
317351 by: tamouse mailing lists

Re: DateTime wierdness
317339 by: David OBrien
317340 by: Martín Marqués
317341 by: David OBrien
317343 by: David OBrien
317346 by: Martín Marqués
317350 by: tamouse mailing lists

Re: [PHP-DB] Flow of PHP testClass
317347 by: tamouse mailing lists
317348 by: tamouse mailing lists
317349 by: tamouse mailing lists

pcntl_fork behavior with php version 5.1.2
317352 by: Ralf Gnädinger
317353 by: Jim Lucas
317354 by: Stuart Dallas
317355 by: Ralf Gnädinger
317356 by: Ralf Gnädinger

Updating Google Plus
317357 by: Brian Dunning
317358 by: Stuart Dallas
317359 by: Brian Dunning
317360 by: Stuart Dallas
317361 by: Brian Dunning

PHP 5.4.1 RC1 Released
317362 by: Stas Malyshev

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---
I found automatic typecasting can be a bit of a gotcha.

 

$sText = this.is.a.test.text;

if ( $pos = strpos($sText, test) !== FALSE) {

echo  substr($sText, 0, $pos)..substr($sText, $pos,
strlen(test))..substr($sText, $pos+strlen(test));

}

 

The code seems logical enough, and the expected result would be:

this.is.a.test.text

 

In fact it ends up being:

this.is.a.test.text

 

The reason is $pos is typecast as TRUE, not int 10, presumably because it's
in the same scope as the boolean test.

Then when $pos is later used as an int it's converted from TRUE to 1.

 

You have to bracket the $pos setting to move it into its own scope to
prevent it being typecast:

if ( ($pos = strpos($sText, test)) !== FALSE) {

 

No doubt it's mentioned somewhere in the php manual, I just never came
across it.

Just thought I'd highlight one of the gotchas of auto typecasting for any
other simpletons like me.

 

Cheers

Arno

---End Message---
---BeginMessage---
Hi, Arno

I don't know if this is written somewhere in the php-manual, but I
really like this table:
http://en.wikipedia.org/wiki/Order_of_operations#Programming_languages

I do not really understand why this has some special stuff to do with
typecasting ... This is just an order like the operators + and * in
math.
If you'd ask me, this is exactly what I would expect to happen.

Bye
Simon

2012/3/29 Arno Kuhl a...@dotcontent.net:
 I found automatic typecasting can be a bit of a gotcha.



 $sText = this.is.a.test.text;

 if ( $pos = strpos($sText, test) !== FALSE) {

                echo  substr($sText, 0, $pos)..substr($sText, $pos,
 strlen(test))..substr($sText, $pos+strlen(test));

 }



 The code seems logical enough, and the expected result would be:

 this.is.a.test.text



 In fact it ends up being:

 this.is.a.test.text



 The reason is $pos is typecast as TRUE, not int 10, presumably because it's
 in the same scope as the boolean test.

 Then when $pos is later used as an int it's converted from TRUE to 1.



 You have to bracket the $pos setting to move it into its own scope to
 prevent it being typecast:

 if ( ($pos = strpos($sText, test)) !== FALSE) {



 No doubt it's mentioned somewhere in the php manual, I just never came
 across it.

 Just thought I'd highlight one of the gotchas of auto typecasting for any
 other simpletons like me.



 Cheers

 Arno

---End Message---
---BeginMessage---
Hi, Arno

FYI: I found a page in the php-manual that's exactly for that:
http://www.php.net/manual/en/language.operators.precedence.php

p.s. some of them were also new to me  Thanks for getting me to read it.

Bye
Simon

2012/3/29 Simon Schick simonsimc...@googlemail.com:
 Hi, Arno

 I don't know if this is written somewhere in the php-manual, but I
 really like this table:
 http://en.wikipedia.org/wiki/Order_of_operations#Programming_languages

 I do not really understand why this has some special stuff to do with
 typecasting ... This is just an order like the operators + and * in
 math.
 If you'd ask me, this is exactly what I would expect to happen.

 Bye
 Simon

 2012/3/29 Arno Kuhl a...@dotcontent.net:
 I found automatic typecasting can be a bit of a gotcha.



 $sText = this.is.a.test.text;

 if ( $pos = strpos($sText, test) !== FALSE) {

                echo  substr($sText, 0, $pos)..substr($sText, $pos,
 strlen(test))..substr($sText, $pos+strlen(test));

 }



 The code seems logical enough, and the expected result would be:

 this.is.a.test.text

php-general Digest 30 Mar 2012 21:39:48 -0000 Issue 7753

2012-03-30 Thread php-general-digest-help

php-general Digest 30 Mar 2012 21:39:48 - Issue 7753

Topics (messages 317363 through 317380):

Re: Watch out for automatic type casting
317363 by: Arno Kuhl
317365 by: Arno Kuhl

PHP 5.4.1 RC1 Released
317364 by: Stas Malyshev

request for feedback on logAndHandler
317366 by: rene7705
317367 by: marco.behnke.biz
317372 by: rene7705

securing a script that exec()s
317368 by: rene7705
317370 by: Bastien
317371 by: David OBrien
317373 by: Peter Bauer
317374 by: David OBrien
317375 by: rene7705
317377 by: Mike Mackintosh

Re: [PHP-DEV] PHP 5.4.1 RC1 Released
317369 by: Nikita Popov

Surge 2012 CFP is Open!
317376 by: Katherine Jeschke

PHP preg_replace_callback with unicode
317378 by: Jimmy Chen

Re: Thinking out loud - a continuation...
317379 by: Robert Cummings

Re: Node.PHP
317380 by: Hiyarli Baba

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---
-Original Message-
From: Simon Schick [mailto:simonsimc...@googlemail.com] 
Sent: 29 March 2012 07:19 PM
To: a...@dotcontent.net
Cc: php-gene...@lists.php.net
Subject: Re: [PHP] Watch out for automatic type casting

Hi, Arno

FYI: I found a page in the php-manual that's exactly for that:
http://www.php.net/manual/en/language.operators.precedence.php

p.s. some of them were also new to me  Thanks for getting me to read it.

Bye
Simon


Thanks Simon and others, thought it was typecasting, but precedence makes more 
sense.

I remember seeing that table when I first started using php, which is why I 
always use AND and OR rather than  and || because it's lower precedence than 
the assignment and the ternary operators, but I couldn't remember where I'd 
seen it. So thanks for linking to it.

Cheers
Arno

---End Message---
---BeginMessage---
-Original Message-
From: Simon Schick [mailto:simonsimc...@googlemail.com]
Sent: 29 March 2012 07:19 PM
To: a...@dotcontent.net
Cc: php-gene...@lists.php.net
Subject: Re: [PHP] Watch out for automatic type casting

Hi, Arno

FYI: I found a page in the php-manual that's exactly for that:
http://www.php.net/manual/en/language.operators.precedence.php

p.s. some of them were also new to me  Thanks for getting me to read it.

Bye
Simon


Thanks Simon and others, thought it was typecasting, but precedence makes more 
sense.

I remember seeing that table when I first started using php, which is why I 
always use AND and OR rather than  and || because it's lower precedence than 
the assignment and the ternary operators, but I couldn't remember where I'd 
seen it. So thanks for linking to it.

Cheers
Arno
--

BTW interesting to note on that precedence page that ! has a higher 
precedence than = (which you'd expect it to be) but you can still do 
if (!$a = foo())

I use that form often (as I'm sure many others do) and just took it for granted 
that it works even though the order of precedence says it shouldn't.

It could be expanded to
if ($a = foo() != TRUE)
But that wouldn't get the expected result due to order of precedence, though at 
first glance you could reasonably expect it to work because of 
if (!$a = foo())
being valid.

I think that's why it's so easy to be caught out (at least for me) by the 
similar form of
if ( $pos = strpos($sText, test) !== FALSE)

Cheers
Arno

---End Message---
---BeginMessage---
Hi!

We would like to announce the first RC of the 5.4.1 version. This is
mainly a bugfix release, including all fixes that did not make the
cut for 5.4.0 and new issues since then. Please test it and notify us of
any problems you may encounter.
The full list of the fixes is as always in the NEWS file.

You can download the packages from:

http://downloads.php.net/stas

The Windows team provides windows binaries for the release.
As always you find them at:

http://windows.php.net/qa/

This is also the first release we are making from our brand new Git
setup, please tell us if you notice any glitches. You can
read more about the Git migration here:
http://www.php.net/archive/2012.php#id2012-03-20-1

We plan the next RC for 5.4.1 in two weeks, on April 12th.

Regards,
  Stas  David
---End Message---
---BeginMessage---
Hi.

I've recently got rid of some bugs in an older component of mine called
logAndHandler.
Basically, logAndHandler will catch errors, warning and notices in PHP code
and present them in an attractive interface in the browser.

Although it does not work in Internet Explorer, and may never work in that
browser, I still find it useful for development purposes.

I thought now would be a good time to get some early feedback on what else

php-general Digest 27 Mar 2012 23:45:09 -0000 Issue 7748

2012-03-27 Thread php-general-digest-help

php-general Digest 27 Mar 2012 23:45:09 - Issue 7748

Topics (messages 317291 through 317310):

Re: updating code asap to multiple domains, windows to unix, with source 
control software (was: Re: [PHP] including PHP code from another server..)
317291 by: rene7705
317292 by: marco.behnke.biz
317293 by: rene7705
317294 by: Matijn Woudt
317295 by: rene7705
317296 by: Matijn Woudt
317297 by: rene7705
317298 by: rene7705
317299 by: rene7705
317300 by: Curtis Maurand

Uploading and creating an email attachment, WITHOUT a DB on server
317301 by: Christopher Svanefalk
317302 by: Christopher Svanefalk
317304 by: Bastien Koert
317305 by: Maciek Sokolewicz

Re: Thinking out loud - a continuation...
317303 by: Jay Blanchard
317306 by: Jay Blanchard

List working?
317307 by: Jay Blanchard
317308 by: Shawn McKenzie
317309 by: Matijn Woudt
317310 by: Shawn McKenzie

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---
On Tue, Mar 27, 2012 at 12:08 PM, rene7705 rene7...@gmail.com wrote:

 On Mon, Mar 26, 2012 at 9:16 PM, Stuart Dallas stu...@3ft9.com wrote:

 Rene: please read a book / website / something on PHP security. Some
 things are important whether you believe they are or not.

 Yea, I will do that within a week or so..

 I can also confirm that I'm not using any source of source control at the
 moment.
 I have used visual source control of Microsoft in the past, but that was
 on a windows-only environment.

 I now have several domains on a shared unix hoster that I have to update
 with files from a windows 7 system.
 Basically, I have on the windows dev server X:\data1\www\htdocs\code (the
 copy I work on), which have to be updated to
 X:\data1\www\htdocs\sites\[domainname]\code, preferably as quickly as
 possible, and then, once release worthy, to the accounts on the shared unix
 hoster.
 On the shared unix hoster (godaddy.com 4G hosting), I have 1 FTP account
 which points to a primary domain (abc.com), which has a filesystem
 underneath it also with the /sites/[domainname], and the non-primary
 domains there point to these /sites/[domainname]/ for their
 $_SERVER['DOCUMENT_ROOT']. I do not have seperate FTP accounts for each
 domain on the unix hoster.

 If someone could explain to me which (free) source control system to use
 and perhaps how, or even point me in the direction of a good tutorial on
 that subject, you'd make me very happy. I also think it's time I got at
 least a bit more professional.
 Yet, I'm looking for the simplest and most efficient solution.

 I've done a search for rsync windows, and I get some rsync apps
 allright, but it's not clear to me yet how I would use these windows rsync
 clones to get done what I want.


oh, one more thing; I just found that I won't always be working on the
windows dev server's ...\htdocs\code, sometimes i'll find myself working on
the /code copy in one of the /sites/[domainname]/code on the windows 7 dev
system. how would I use a modern source control system to distribute the
code from one of the subdomains to all other locations?
---End Message---
---BeginMessage---


rene7705 rene7...@gmail.com hat am 27. März 2012 um 12:16 geschrieben:

 On Tue, Mar 27, 2012 at 12:08 PM, rene7705 rene7...@gmail.com wrote:
  I've done a search for rsync windows, and I get some rsync apps
  allright, but it's not clear to me yet how I would use these windows
rsync
  clones to get done what I want.
 

 oh, one more thing; I just found that I won't always be working on the
 windows dev server's ...\htdocs\code, sometimes i'll find myself working
on
 the /code copy in one of the /sites/[domainname]/code on the windows 7
dev
 system. how would I use a modern source control system to distribute the
 code from one of the subdomains to all other locations?

Well, I guess google on rsync man page or read the documentation of these
tools OR write to a mailing list that focusses on the use of linux tools.
Then go and read about cron jobs or git/svn/putyoutoolhere
post-receive/post-commit hooks or anything like that.


Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz
---End Message---
---BeginMessage---
On Tue, Mar 27, 2012 at 12:22 PM, ma...@behnke.biz ma...@behnke.biz wrote:



 rene7705 rene7...@gmail.com hat am 27. März 2012 um 12:16 geschrieben:

  On Tue, Mar 27, 2012 at 12:08 PM, rene7705 rene7...@gmail.com wrote:
   I've done a search

php-general Digest 26 Mar 2012 06:39:23 -0000 Issue 7745

2012-03-26 Thread php-general-digest-help

php-general Digest 26 Mar 2012 06:39:23 - Issue 7745

Topics (messages 317260 through 317262):

Re: foreach weirdness
317260 by: Matijn Woudt
317261 by: Simon Schick
317262 by: Arno Kuhl

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---
On Sun, Mar 25, 2012 at 4:11 PM, Arno Kuhl a...@dotcontent.net wrote:
 From: Simon Schick [mailto:simonsimc...@googlemail.com]
 Sent: 24 March 2012 12:30 AM
 To: Robert Cummings
 Cc: a...@dotcontent.net; php-gene...@lists.php.net
 Subject: Re: [PHP] foreach weirdness

 2012/3/23 Robert Cummings rob...@interjinn.com

 On 12-03-23 11:16 AM, Arno Kuhl wrote:


 it still does not produce the correct result:
 0 1 3 6 10 15 21
 0 1 3 6 10 15 15


 This looks like a bug... the last row should be the same. What version
 of PHP are you using? Have you checked the online bug reports?



 Hi, Robert

 Does not seem like a bug to me ...
 http://schlueters.de/blog/archives/141-References-and-foreach.html

 What you should do to get the expected result:
 Unset the variable after you don't need this reference any longer.

 Bye
 Simon

 --

 Hi Simon, unsetting the $value does fix the problem, but I found that any 
 time you assign $value by reference in a foreach loop you have to do an unset 
 to avoid corrupting the array unless you continue to assign $value by 
 reference (as illustrated in the article you linked).

 So doing something as simple as:
 $array = array(0, 1, 2, 3, 4, 5, 6);
 foreach ($array as $key=$value) {
        echo Key: $key; Value: $valuebr /\n;
 }

 and then follow with (from the php manual):
 foreach ($array as $key=$value) {
        echo Key: $key; Value: $valuebr /\n;
 }

 will not only give the wrong result, it will corrupt the array for *any* 
 further use of that array. I still think it’s a bug according to the 
 definition of foreach in the php manual. Maybe php needs to do an implicit 
 unset at the closing brace of the foreach where was an assign $value by 
 reference, to remove the reference to the last element (or whatever element 
 it was pointing to if there was a break) so that it doesn't corrupt the 
 array, because any assign to $value after the foreach loop is completed will 
 corrupt the array (confirmed by testing). The average user (like me) wouldn't 
 think twice about reusing $value after ending the foreach loop, not realising 
 that without an unset the array will be corrupted.

 BTW thanks for that reference, it was quite an eye-opener on the pitfalls of 
 using assign by reference, not only in the foreach loop.

 Cheers
 Arno

Note that somewhat similar error was discussed on this list a few
months ago[1]. You could probably have solved it yourself if you
searched the mailing list archives.

- Matijn

[1] http://www.mail-archive.com/php-general@lists.php.net/msg269552.html
---End Message---
---BeginMessage---
2012/3/25 Arno Kuhl a...@dotcontent.net:

 will not only give the wrong result, it will corrupt the array for *any* 
 further use of that array. I still think it’s a bug according to the 
 definition of foreach in the php manual. Maybe php needs to do an implicit 
 unset at the closing brace of the foreach where was an assign $value by 
 reference, to remove the reference to the last element (or whatever element 
 it was pointing to if there was a break) so that it doesn't corrupt the 
 array, because any assign to $value after the foreach loop is completed will 
 corrupt the array (confirmed by testing). The average user (like me) wouldn't 
 think twice about reusing $value after ending the foreach loop, not realising 
 that without an unset the array will be corrupted.


Hi, Arno

Requesting that will at least require a major-release (f.e. PHP 6.0)
... but I would rather request to add a notice or warning to the
documentation of references to remind stuff like that.
http://www.php.net/manual/en/language.references.php
I think this is stuff more people will stumble over ...

Bye
Simon
---End Message---
---BeginMessage---
Requesting that will at least require a major-release (f.e. PHP 6.0) ... but I 
would rather request to add a notice or warning to the documentation of 
references to remind stuff like that.
http://www.php.net/manual/en/language.references.php
I think this is stuff more people will stumble over ...

Bye
Simon
--

I agree it would be wrong to change php's handling of call by reference in 
foreach loops because there may be a need to access that reference after 
completing the loop. I was going to suggest there should be a warning in the 
manual to unset the reference after the foreach loop is completed, but I see 
the current online manual has that warning prominently displayed on the foreach

php-general Digest 26 Mar 2012 19:16:14 -0000 Issue 7746

2012-03-26 Thread php-general-digest-help

php-general Digest 26 Mar 2012 19:16:14 - Issue 7746

Topics (messages 317263 through 317277):

Re: foreach weirdness
317263 by: Arno Kuhl

including PHP code from another server..
317264 by: rene7705
317265 by: Stuart Dallas
317266 by: Simon Schick
317267 by: Stuart Dallas
317268 by: Stuart Dallas
317269 by: Curtis Maurand
317270 by: rene7705
317272 by: Lester Caine
317273 by: Alex Pojarsky
317277 by: Stuart Dallas

CURL -d
317271 by: QI.VOLMAR QI

Re: Thinking out loud - a continuation...
317274 by: Jay Blanchard
317275 by: Stuart Dallas
317276 by: Jay Blanchard

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---
Note that somewhat similar error was discussed on this list a few months 
ago[1]. You could probably have solved it yourself if you searched the mailing 
list archives.

- Matijn

[1] http://www.mail-archive.com/php-general@lists.php.net/msg269552.html
---

Thanks Matijn, I missed that discussion, not following the list that actively. 
I'll try search next time before raising an issue.

Cheers
Arno

---End Message---
---BeginMessage---
Hi.

My last thread got derailed into a javascript and even photoshop
discussion, and while I can't blame myself for that really, this time I
would like to bring a pure PHP issue to your scrutiny.

I run several sites now, on the same shared hoster, but with such a setup
that I cannot let PHP require() or include() code from a central place
located on another domain name on the same shared hosting account, not the
normal way at least.
$_SERVER['DOCUMENT_ROOT'] is a completely different path for each of the
domains on the same hosting account, and obviously you can't access one
domain's directory from another domain.

Hoster support's reply is A) I dont know code, B) You can't include code
from one domain on another and C) use multiple copies, 1 for each domain

But that directory (my opensourced /code in the zip on
http://mediabeez.wsbtw), takes a while to update to my hoster, many
files.
Plus, as I add more domains that use the same code base, my overhead and
waiting time increases lineary at a steep incline.

So.. Since all of this code is my own, and tested and trusted, I can just
eval(file_get_contents('
http://sitewithwantedcode.com/code/get_php.php?file=/code/sitewide_rv/autorun.php'))
hehe
And get_php.php takes care of the nested includes by massaging what it
retrieves. Or so is my thinking.

The problem I'm facing, and for which I'm asking your most scrutinous
feedback, is:
How would you transform _nested_ require(_once) and include(_once)? I
haven't figured out yet how to transform a relative path include/require.
What about for instance a require_once($fileIwantNow)?
I do both in my /code tree atm.

For my own purposes, I could massage my own PHP in /code/libraries_rv and
/code/sitewide_rv manually, but I'd also like to be able to include a
single copy of the 3rd party free libs that I use in
/code/libraries(/adodb-5.10 for instance). And god knows how they might
include and require.

Plus, I'd like to turn this into another free how-to blog entry on
http://mediabeez.ws, plus accompanying code, so I think I might find some
free tips here again.

Greetings,
 from spring sun soaked amsterdam.nl,
 Rene
---End Message---
---BeginMessage---
REMOVE THAT SCRIPT FROM YOUR SERVER RIGHT NOW!

See follow-up email direct to you for the reason!

On 26 Mar 2012, at 14:53, rene7705 wrote:

 Hi.
 
 My last thread got derailed into a javascript and even photoshop
 discussion, and while I can't blame myself for that really, this time I
 would like to bring a pure PHP issue to your scrutiny.
 
 I run several sites now, on the same shared hoster, but with such a setup
 that I cannot let PHP require() or include() code from a central place
 located on another domain name on the same shared hosting account, not the
 normal way at least.
 $_SERVER['DOCUMENT_ROOT'] is a completely different path for each of the
 domains on the same hosting account, and obviously you can't access one
 domain's directory from another domain.
 
 Hoster support's reply is A) I dont know code, B) You can't include code
 from one domain on another and C) use multiple copies, 1 for each domain
 
 But that directory (my opensourced /code in the zip on
 http://mediabeez.wsbtw), takes a while to update to my hoster, many
 files.
 Plus, as I add more domains that use the same code base, my overhead and
 waiting time increases lineary at a steep incline.
 
 So.. Since all of this code is my own, and tested and trusted, I can just
 eval(file_get_contents('
 http

php-general Digest 25 Mar 2012 16:02:19 -0000 Issue 7744

2012-03-25 Thread php-general-digest-help

php-general Digest 25 Mar 2012 16:02:19 - Issue 7744

Topics (messages 317257 through 317259):

Re: foreach weirdness
317257 by: Arno Kuhl
317258 by: Arno Kuhl

Re: Thinking out loud - a continuation...
317259 by: Jay Blanchard

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---
 See this following example that illustrates the problem:
 $array = array(0, 1, 2, 3, 4, 5, 6);
 foreach ($array as $index=$value) { 
   if ( ($index+1)  count($array) ) { 
   $array[$index+1] += $value; 
   } 
   echo $value. ;
 }
 echo br /;
 foreach ($array as $index=$value) { 
   echo $value. ;
 }
 
 You'd expect the output to be: 
 0 1 3 6 10 15 21
 0 1 3 6 10 15 21
 
 But it's actually: 
 0 1 2 3 4 5 6
 0 1 3 5 7 9 11

Hey,

the ouput you get is right. If you want your ouput you have to rewrite your 
code.
Currently you are adding the value of the current index to the next indexes 
value (e.g. $array[0] + $array[1]; $array[1] + $array[2]; etc.).
As I understand it you want to add the current value with the next index (e.g. 
$array[0] + 1; $array[1] + 2; $array[2] + 3).
--

Hi Stephan, the first foreach loop adds the next value to the current value, 
not the next index. The reason you don't get the expected result in the first 
foreach loop is because you need to assign the $value by reference, as per the 
php manual
foreach ($array as $index=$value) 

But then to get the correct output from the second simple foreach loop, you 
also have to assign the $value by reference, contrary to the php manual. If you 
don't you get the wrong result and the array becomes corrupted. That could be 
classified as a bug, or at least the manual needs to elaborate on using a 
foreach when you assign the $value by reference.

Cheers
Arno

---End Message---
---BeginMessage---
From: Simon Schick [mailto:simonsimc...@googlemail.com] 
Sent: 24 March 2012 12:30 AM
To: Robert Cummings
Cc: a...@dotcontent.net; php-gene...@lists.php.net
Subject: Re: [PHP] foreach weirdness

2012/3/23 Robert Cummings rob...@interjinn.com

 On 12-03-23 11:16 AM, Arno Kuhl wrote:


 it still does not produce the correct result:
 0 1 3 6 10 15 21
 0 1 3 6 10 15 15


 This looks like a bug... the last row should be the same. What version 
 of PHP are you using? Have you checked the online bug reports?



Hi, Robert

Does not seem like a bug to me ...
http://schlueters.de/blog/archives/141-References-and-foreach.html

What you should do to get the expected result:
Unset the variable after you don't need this reference any longer.

Bye
Simon

--

Hi Simon, unsetting the $value does fix the problem, but I found that any time 
you assign $value by reference in a foreach loop you have to do an unset to 
avoid corrupting the array unless you continue to assign $value by reference 
(as illustrated in the article you linked).
 
So doing something as simple as:
$array = array(0, 1, 2, 3, 4, 5, 6);
foreach ($array as $key=$value) {
echo Key: $key; Value: $valuebr /\n;
}

and then follow with (from the php manual):
foreach ($array as $key=$value) {
echo Key: $key; Value: $valuebr /\n;
}

will not only give the wrong result, it will corrupt the array for *any* 
further use of that array. I still think it’s a bug according to the definition 
of foreach in the php manual. Maybe php needs to do an implicit unset at the 
closing brace of the foreach where was an assign $value by reference, to remove 
the reference to the last element (or whatever element it was pointing to if 
there was a break) so that it doesn't corrupt the array, because any assign to 
$value after the foreach loop is completed will corrupt the array (confirmed by 
testing). The average user (like me) wouldn't think twice about reusing $value 
after ending the foreach loop, not realising that without an unset the array 
will be corrupted.

BTW thanks for that reference, it was quite an eye-opener on the pitfalls of 
using assign by reference, not only in the foreach loop.

Cheers
Arno

---End Message---
---BeginMessage---
[snip]
a necessary part of building the structure. It can be removed but only as a 
post process. Why does it have to be removed? You can loop through the 
structure in JavaScript without paying heed to the key's value.
 
 If it absolutely must go... you need to recurse through the final structure 
 replacing each children entry with the results of passing it through 
 array_values().
[/snip]

Unfortunately the user of the JSON will not make a change to their app. I have 
looked through the JSON to confirm that this has a particular pattern so I 
think I can just do a little regex and get it squared away. This is one of 
those

php-general Digest 24 Mar 2012 12:39:43 -0000 Issue 7742

2012-03-24 Thread php-general-digest-help

php-general Digest 24 Mar 2012 12:39:43 - Issue 7742

Topics (messages 317240 through 317245):

Re: Thinking out loud - a continuation...
317240 by: Jay Blanchard
317243 by: Robert Cummings
317244 by: Robert Cummings
317245 by: Jay Blanchard

Re: foreach weirdness
317241 by: Simon Schick
317242 by: Robert Cummings

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---
[snip]
…stuff….
[/snip]

For those interested here is where the problem seems to occur - 

$child = array
   (
   'id'   = $id,
   'parentId' = $pid,
   'children' = array()
   );
   
   $children[$id][] = $child;
   
   foreach( $parents[$pid] as $items ){
   foreach( $items as $item ){   
 $item['children'][$id] = $child; // error: Cannot use 
string offset as an array
   }
   }

Maybe someone will see this and know what's going on. Before the foreach 
$children is an array. 

---End Message---
---BeginMessage---

On 12-03-23 05:26 PM, Jay Blanchard wrote:

[snip]

$item['children'] should be an array, somehow a string has been assigned :/

[/snip]

Yep. I am trying to figure that out now. I'm sure it is something really small.

[/snip]

I have been hammering away at it for a while now and still cannot find the 
issue. I'll push away for a while and come back to it. Robert I owe you so many 
thinks for getting me this far and opening me up to making this more efficient. 
I just have to push on through and get to the point where  the JSON can be 
created and consumed. If any light bulb goes on over your head would you let me 
know. I have tried everything that I know works to keep this from being a 
string - I am just missing something.


Hi Jay,

Did you send me a sample dump for your table :)

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.
---End Message---
---BeginMessage---

On 12-03-23 05:41 PM, Jay Blanchard wrote:

[-- DELETED GARBAGE --]  :)


I just realized... I've been stuck in a thinking rut. I latched onto one 
solution that works well in some case but didn't fully examine the 
nuances of your own scenario. Given the way you are creating your 
hierarchy you will ultimately retrieve all rows. As such the following 
simple solution will do what you need:


?php

$company = 1;

$query =
SELECT DISTINCT 
   .   * 
   .FROM 
   .   tiers 
   .WHERE 
   .   company = {$company} ;

$root = array();
if( $db-query( $query ) )
{
while( ($row = $db-fetchRow()) )
{
$focus = $root;
for( $i = 1; $i = 14; $i++ )
{
$name = $row['tier'.$i];

if( !isset( $focus[$name] ) )
{
$focus[$name] = array();
}

$focus = $focus[$name];
}
}
}

$json = JSON_encode( $root );

?

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.
---End Message---
---BeginMessage---
[snip]
 Did you send me a sample dump for your table :)
[/snip]

I'll do that today. I got side-tracked last night.

---End Message---
---BeginMessage---
2012/3/23 Robert Cummings rob...@interjinn.com

 On 12-03-23 11:16 AM, Arno Kuhl wrote:


 it still does not produce the correct result:
 0 1 3 6 10 15 21
 0 1 3 6 10 15 15


 This looks like a bug... the last row should be the same. What version of
 PHP are you using? Have you checked the online bug reports?



Hi, Robert

Does not seem like a bug to me ...
http://schlueters.de/blog/archives/141-References-and-foreach.html

What you should do to get the expected result:
Unset the variable after you don't need this reference any longer.

Bye
Simon
---End Message---
---BeginMessage---

On 12-03-23 06:30 PM, Simon Schick wrote:

2012/3/23 Robert Cummingsrob...@interjinn.com


On 12-03-23 11:16 AM, Arno Kuhl wrote:



it still does not produce the correct result:
0 1 3 6 10 15 21
0 1 3 6 10 15 15



This looks like a bug... the last row should be the same. What version of
PHP are you using? Have you checked the online bug reports?




Hi, Robert

php-general Digest 23 Mar 2012 09:03:22 -0000 Issue 7740

2012-03-23 Thread php-general-digest-help

php-general Digest 23 Mar 2012 09:03:22 - Issue 7740

Topics (messages 317190 through 317200):

Re: Thinking out loud - a continuation...
317190 by: Jay Blanchard
317198 by: Robert Cummings

set_error_handler() only triggering every Nth time
317191 by: Daevid Vincent
317199 by: Robert Cummings

MySQL table design
317192 by: Chris Stinemetz
317193 by: Stuart Dallas
317194 by: Bastien
317195 by: Chris Stinemetz
317196 by: Jim Giner

make error
317197 by: »ÆÕÑÔ´

Re: Got HTML5 History API + caching LICKED, I think, grin
317200 by: rene7705

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---
[snip]
 At one point you indicated all the data was coming from one table. Can you 
 send me the table fields and indicate which fields are used to determine 
 parent child relationship? Also 2 sample rows of data which have a 
 relationship would be helpful.
[/snip]

Columns - tier1, tier2, tier3, tier4 etc. (ends with tier14)

Children of tier1 are tier2 -

select distinct tier2 from table where tier1 = foo and company = 1
select distinct tier2 from table where tier1 = bar and company = 1
etc.

Children of tier2 are tier3, etc.

tier1   tier2   tier3
1,  executive,  ceo,ceo
1,  executive,  vp-ops, vp-ops
1,  executive,  vp-admin,   vp-admin mgr
1,  executive,  vp-admin,   vp-admin ops mgr
1,  executive,  vp-admin,   vp-admin mgr
1,  executive,  vp-admin,   vp-admin clerk
1,  professionalpro-mgr pro-admin
1,  professionalpro-IT  pro-dev
1,  professionalpro-IT  pro-infra
1,  professionalpro-IT  pro-dev
1,  technician  tech-admin  tech-admin mgr
1,  technician  tech-opstech-ops mgr

Thanks for all of your help. I know I am being a PITA.---End Message---
---BeginMessage---

On 12-03-22 03:54 PM, Jay Blanchard wrote:

[snip]

At one point you indicated all the data was coming from one table. Can you send 
me the table fields and indicate which fields are used to determine parent 
child relationship? Also 2 sample rows of data which have a relationship would 
be helpful.

[/snip]

Columns - tier1, tier2, tier3, tier4 etc. (ends with tier14)

Children of tier1 are tier2 -

select distinct tier2 from table where tier1 = foo and company = 1
select distinct tier2 from table where tier1 = bar and company = 1
etc.

Children of tier2 are tier3, etc.

tier1   tier2   tier3
1,  executive,  ceo,ceo
1,  executive,  vp-ops, vp-ops
1,  executive,  vp-admin,   vp-admin mgr
1,  executive,  vp-admin,   vp-admin ops mgr
1,  executive,  vp-admin,   vp-admin mgr
1,  executive,  vp-admin,   vp-admin clerk
1,  professionalpro-mgr pro-admin
1,  professionalpro-IT  pro-dev
1,  professionalpro-IT  pro-infra
1,  professionalpro-IT  pro-dev
1,  technician  tech-admin  tech-admin mgr
1,  technician  tech-opstech-ops mgr

Thanks for all of your help. I know I am being a PITA.


Your data structure doesn't appear to be very ummm normalized... 
Nonetheless, the following should do it:


?php

//
// Establish the root.
//

$company = 1;

$query =
SELECT DISTINCT 
   .   tier1 AS id 
   .FROM 
   .   tiers 
   .WHERE 
   .   company = {$company} ;

$root = array();
$children = array();
if( $db-query( $query ) )
{
while( ($row = $db-fetchRow()) )
{
$id = $row['id'];

unset( $child );

$child = array
(
'id'   = $id,
'parentId' = false,
'children' = array();
);

$root[$id] = $child;
$children[$id][] = $child;
}
}

//
// Establish the nested levels.
//

for( $tier = 2; $tier = 14; $tier++ )
{
if( !($parents = $children) )
{
break;
}

$parentTier = $tier - 1;

$parentIds = array();
foreach( array_keys( $parents ) as $parentId )
{
$parentIds[$parentId] = $db-quote( $parentId );
}

$query =
SELECT DISTINCT 
   .   tier{$tier} AS id, 
   .   tier{$parentTier} AS parentId 
   .FROM 
   .   tiers 
   .WHERE 
   .   company = {$company

php-general Digest 22 Mar 2012 19:08:44 -0000 Issue 7739

2012-03-22 Thread php-general-digest-help

php-general Digest 22 Mar 2012 19:08:44 - Issue 7739

Topics (messages 317172 through 317189):

Re: hello everybody
317172 by: Midhun Girish
317173 by: Michael Save

Re: Node.PHP
317174 by: Michael Save

Re: Thinking out loud - a continuation...
317175 by: Bastien
317178 by: Jay Blanchard
317179 by: Tedd Sperling
317180 by: Jay Blanchard
317181 by: Robert Cummings
317182 by: Jay Blanchard
317183 by: Robert Cummings
317184 by: Robert Cummings
317185 by: Jay Blanchard
317186 by: Jay Blanchard
317187 by: Robert Cummings
317188 by: Jay Blanchard
317189 by: Robert Cummings

Re: Got HTML5 History API + caching LICKED, I think, grin
317176 by: rene7705
317177 by: rene7705

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---
I think this would be an ideal resource for beginners
http://www.w3schools.com/php/php_forms.asp. I used it when i began php. I
would suggest doing the entire course in there. Really helpful.

Regards
Midhun Girish



On Sun, Mar 18, 2012 at 10:05 PM, Jeremy Wei shuimuqing...@gmail.comwrote:

 you can read the content about form dealing in php manual:
 http://us.php.net/manual/en/tutorial.forms.php

 On Sun, Mar 18, 2012 at 7:34 PM, saeed ahmed mycomputerbo...@gmail.com
 wrote:
  i am a full time warehouse worker and do not have time.i hardly can spend
  2/3 hours a week on internet(at work we do not use internet but only
  computer)i am learning php and have xampp installed on my computer and i
  think i am learning slowly slowly.i want ot ask one favor to someone,who
 is
  capable of doing this small work.i have learned that when visitor fill a
  form after visitor get message with his name.how this function is added
 and
  where?
 
  can anyon give me a example like giving a example to a child of 10
 years.i
  would like if someone explain me.



 --
 JeremyWei(魏志锋,字静之)
 Mob: 18914495716
 新浪微博:@JeremyWei
 QQ: 327493482
 Home: www.weizhifeng.net
 Less is more

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


---End Message---
---BeginMessage---
w3schools is not a good source.

http://w3fools.com/

On Thu, Mar 22, 2012 at 5:33 PM, Midhun Girish midhungir...@gmail.com wrote:
 I think this would be an ideal resource for beginners
 http://www.w3schools.com/php/php_forms.asp. I used it when i began php. I
 would suggest doing the entire course in there. Really helpful.

 Regards
 Midhun Girish



 On Sun, Mar 18, 2012 at 10:05 PM, Jeremy Wei shuimuqing...@gmail.comwrote:

 you can read the content about form dealing in php manual:
 http://us.php.net/manual/en/tutorial.forms.php

 On Sun, Mar 18, 2012 at 7:34 PM, saeed ahmed mycomputerbo...@gmail.com
 wrote:
  i am a full time warehouse worker and do not have time.i hardly can spend
  2/3 hours a week on internet(at work we do not use internet but only
  computer)i am learning php and have xampp installed on my computer and i
  think i am learning slowly slowly.i want ot ask one favor to someone,who
 is
  capable of doing this small work.i have learned that when visitor fill a
  form after visitor get message with his name.how this function is added
 and
  where?
 
  can anyon give me a example like giving a example to a child of 10
 years.i
  would like if someone explain me.



 --
 JeremyWei(魏志锋,字静之)
 Mob: 18914495716
 新浪微博:@JeremyWei
 QQ: 327493482
 Home: www.weizhifeng.net
 Less is more

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


---End Message---
---BeginMessage---
Very nice!

I'll have a proper look at this in the morning, and I'll try it out
for myself. Looking forward to seeing more development on this.

Michael

On Thu, Mar 22, 2012 at 11:40 AM, Joseph Moniz joseph.mo...@gmail.com wrote:
 Hey,

 So i had my first Hackathon at work last week and my project was to
 prototype making a node.js clone using PHP instead of V8. So i
 snatched up libuv and joyent's HTTP parser and set off on a 24 hour
 coding spree to get something workable. By the time the sun was coming
 out the next morning the following code was working.

    ?php

    $http = new node_http();

    $http-listen(8080, function($request, $response) {
        $response-end(yay, super awesome response);
    });

    nodephp_run();

    ?

 The C code that powers it was whipped together really fast and is kind
 of hackish as a result. The code has some memory leaks that i haven't
 had time to fully track down yet. Some small portions of the code were
 borrowed from the phode project.

 In a naive benchmark

php-general Digest 21 Mar 2012 14:27:13 -0000 Issue 7737

2012-03-21 Thread php-general-digest-help

php-general Digest 21 Mar 2012 14:27:13 - Issue 7737

Topics (messages 317152 through 317159):

Re: Bug zlib.output_compression not normal work in IIS7.5
317152 by: Simon Schick

Pear Auth problem
317153 by: Karl-Arne Gjersøyen
317159 by: Govinda

How can I convert these to hex or strings?
317154 by: David OBrien
317155 by: Jim Giner
317156 by: David OBrien
317157 by: Jim Giner

Re: php upload does not work proper, [tmp_name] and other are missing in 
$_FILES
317158 by: Meike Stone

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---
2012/3/19 小鱼虾 i...@xiaoyu.org

 How I do fix it ?


 https://bugs.php.net/bug.php?id=61434


Hi,

I got a rough overview of the conversation in the bug-tracker ...

You were always talking about a tool you used to test the
gzip-compression ... but why not test it natively?
Using Firefox (with the extension Firebug) or Safari / Chrome for
example you can easily view the respond-header from the server and get
more info out of that.
Just press F12, click on the network-tab, select your request and
search in the response-header for Content-Encoding: ...

I would write my own small php-test-script where you just output some
text. Then you're sure that not other code is doing something strange.

Another possible problem: Is the extension zlib enabled at all? The
documentation says that it's disabled by default ...
http://www.php.net/manual/en/zlib.installation.php

Bye
Simon
---End Message---
---BeginMessage---
Hello.
I am trying to use pear Auth packet but am doing something wrong.
I am currently looking at the simple example in the documentation, but
something is wrong in my source code, because if I write a username
and a password in the fields and hit the submit button, I receive a
blank pages without any informatio at all..

Here is my source code:
---

?php

require_once('Auth.php');
if(!isset($_POST['submit'])){
function loginFunction($username = null, $status = null, $auth = null){
?

form action=index.php method=post
fieldset  
legendLogin:/legend
p
label for=usernameUsername:/labelbr
input id=username name=username type=text
/p
p
label for=passwordPassword:/labelbr
input id=password name=password type=password
/p
p
input id=submit name=submit type=submit value=Login
/p
/fieldset
/form

?php   
}

$options = array(
'dsn' = mysql://username:password@localhost/database,
);
$a = new Auth(DB, $options, loginFunction);
$a-start();

if($a-checkAuth()){
header(Location: http://www.karl-arne.name/;);
}
}   
?

The example is located at:
http://pear.php.net/manual/en/package.authentication.auth.intro.php

Thanks for your time.
Karl
---End Message---
---BeginMessage---
 Hello.
 I am trying to use pear Auth packet but am doing something wrong.
 I am currently looking at the simple example in the documentation, but
 something is wrong in my source code, because if I write a username
 and a password in the fields and hit the submit button, I receive a
 blank pages without any informatio at all..
 
 Here is my source code:
 ---
 
 ?php
 
 require_once('Auth.php');
 if(!isset($_POST['submit'])){
 function loginFunction($username = null, $status = null, $auth = null){
 ?
 
 form action=index.php method=post
   fieldset  
legendLogin:/legend
   p
label for=usernameUsername:/labelbr
   input id=username name=username type=text
/p
p
label for=passwordPassword:/labelbr
   input id=password name=password type=password
/p
p
input id=submit name=submit type=submit value=Login
/p
/fieldset
 /form
 
 ?php 
   }
 
   $options = array(
   'dsn' = mysql://username:password@localhost/database,
   );
   $a = new Auth(DB, $options, loginFunction);
   $a-start();
   
   if($a-checkAuth()){
   header(Location: http://www.karl-arne.name/;);
   }
 } 
 ?
 
 The example is located at:
 http://pear.php.net/manual/en/package.authentication.auth.intro.php

Karl,

You'll want to turn on error reporting so you can start to get a peak into what 
is happening..  Do you know how to do that?  (... so that you get more info. 
than just a blank page).

-Govinda

---End Message---
---BeginMessage---
I'm running snmp against a huge list of printers and certain HP models
return

Model:
stdClass Object
(
[type] = 4
[value] = ☺§HP LaserJet P3010 Series
)

Serial:
stdClass Object
(
[type] = 4

php-general Digest 22 Mar 2012 05:56:41 -0000 Issue 7738

2012-03-21 Thread php-general-digest-help

php-general Digest 22 Mar 2012 05:56:41 - Issue 7738

Topics (messages 317160 through 317171):

Re: php upload does not work proper, [tmp_name] and other are missing in 
$_FILES
317160 by: Meike Stone
317162 by: Matijn Woudt

PEAR_Error reporting
317161 by: Karl-Arne Gjersøyen

Thinking out loud - a continuation...
317163 by: Jay Blanchard
317164 by: Adam Richardson
317165 by: Daniel Brown
317166 by: Jay Blanchard
317167 by: Robert Cummings
317168 by: Jay Blanchard
317169 by: Jim Lucas
317171 by: Robert Cummings

Node.PHP
317170 by: Joseph Moniz

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---

 But what is the reason, that the module not work properly?
 Which next step can I do?

I figured out, that the new mod_php5.so is not linked against
libmm.so.14. Can this be the problem?

Thanks Meike

# ldd mod_php5.so.5.3.8
linux-vdso.so.1 =  (0x7fffe051c000)
libcrypt.so.1 = /lib64/libcrypt.so.1 (0x7f3d30f82000)
libresolv.so.2 = /lib64/libresolv.so.2 (0x7f3d30d6b000)
libpcre.so.0 = /usr/lib64/libpcre.so.0 (0x7f3d30b3a000)
librt.so.1 = /lib64/librt.so.1 (0x7f3d30931000)
libm.so.6 = /lib64/libm.so.6 (0x7f3d306b8000)
libdl.so.2 = /lib64/libdl.so.2 (0x7f3d304b3000)
libnsl.so.1 = /lib64/libnsl.so.1 (0x7f3d3029b000)
libz.so.1 = /lib64/libz.so.1 (0x7f3d30085000)
libxml2.so.2 = /usr/lib64/libxml2.so.2 (0x7f3d2fd28000)
libc.so.6 = /lib64/libc.so.6 (0x7f3d2f9b4000)
libpthread.so.0 = /lib64/libpthread.so.0 (0x7f3d2f797000)
/lib64/ld-linux-x86-64.so.2 (0x7f3d31c0f000)

# ldd mod_php5.so.5.2.14
linux-vdso.so.1 =  (0x7fffcdfff000)
libmm.so.14 = /usr/lib64/libmm.so.14 (0x7f0307223000)
libcrypt.so.1 = /lib64/libcrypt.so.1 (0x7f0307428000)  
libresolv.so.2 = /lib64/libresolv.so.2 (0x7f0306bd2000)
libpcre.so.0 = /usr/lib64/libpcre.so.0 (0x7f0306ff2000)
librt.so.1 = /lib64/librt.so.1 (0x7f0306de9000)
libm.so.6 = /lib64/libm.so.6 (0x7f0306958000)
libdl.so.2 = /lib64/libdl.so.2 (0x7f0306754000)
libnsl.so.1 = /lib64/libnsl.so.1 (0x7f030653c000)
libz.so.1 = /lib64/libz.so.1 (0x7f0306325000)
libxml2.so.2 = /usr/lib64/libxml2.so.2 (0x7f0305fc9000)
libc.so.6 = /lib64/libc.so.6 (0x7f0305c55000)
libpthread.so.0 = /lib64/libpthread.so.0 (0x7f0305a37000)
/lib64/ld-linux-x86-64.so.2 (0x7f0307b51000)
---End Message---
---BeginMessage---
On Wed, Mar 21, 2012 at 3:32 PM, Meike Stone meike.st...@googlemail.com wrote:

 But what is the reason, that the module not work properly?
 Which next step can I do?

 I figured out, that the new mod_php5.so is not linked against
 libmm.so.14. Can this be the problem?

 Thanks Meike

 # ldd mod_php5.so.5.3.8
        linux-vdso.so.1 =  (0x7fffe051c000)
        libcrypt.so.1 = /lib64/libcrypt.so.1 (0x7f3d30f82000)
        libresolv.so.2 = /lib64/libresolv.so.2 (0x7f3d30d6b000)
        libpcre.so.0 = /usr/lib64/libpcre.so.0 (0x7f3d30b3a000)
        librt.so.1 = /lib64/librt.so.1 (0x7f3d30931000)
        libm.so.6 = /lib64/libm.so.6 (0x7f3d306b8000)
        libdl.so.2 = /lib64/libdl.so.2 (0x7f3d304b3000)
        libnsl.so.1 = /lib64/libnsl.so.1 (0x7f3d3029b000)
        libz.so.1 = /lib64/libz.so.1 (0x7f3d30085000)
        libxml2.so.2 = /usr/lib64/libxml2.so.2 (0x7f3d2fd28000)
        libc.so.6 = /lib64/libc.so.6 (0x7f3d2f9b4000)
        libpthread.so.0 = /lib64/libpthread.so.0 (0x7f3d2f797000)
        /lib64/ld-linux-x86-64.so.2 (0x7f3d31c0f000)

 # ldd mod_php5.so.5.2.14
        linux-vdso.so.1 =  (0x7fffcdfff000)
        libmm.so.14 = /usr/lib64/libmm.so.14 (0x7f0307223000)
        libcrypt.so.1 = /lib64/libcrypt.so.1 (0x7f0307428000)
        libresolv.so.2 = /lib64/libresolv.so.2 (0x7f0306bd2000)
        libpcre.so.0 = /usr/lib64/libpcre.so.0 (0x7f0306ff2000)
        librt.so.1 = /lib64/librt.so.1 (0x7f0306de9000)
        libm.so.6 = /lib64/libm.so.6 (0x7f0306958000)
        libdl.so.2 = /lib64/libdl.so.2 (0x7f0306754000)
        libnsl.so.1 = /lib64/libnsl.so.1 (0x7f030653c000)
        libz.so.1 = /lib64/libz.so.1 (0x7f0306325000)
        libxml2.so.2 = /usr/lib64/libxml2.so.2 (0x7f0305fc9000)
        libc.so.6 = /lib64/libc.so.6 (0x7f0305c55000)
        libpthread.so.0 = /lib64/libpthread.so.0 (0x7f0305a37000)
        /lib64/ld-linux-x86-64.so.2 (0x7f0307b51000)

I believe using

php-general Digest 20 Mar 2012 13:23:42 -0000 Issue 7735

2012-03-20 Thread php-general-digest-help

php-general Digest 20 Mar 2012 13:23:42 - Issue 7735

Topics (messages 317131 through 317140):

Re: Getting knotted with quotes encoding - (one possible solution)
317131 by: Arno Kuhl

mysql list to two-column list
317132 by: Tom Sparks
317133 by: Ashley Sheridan
317134 by: Tom Sparks
317135 by: Ashley Sheridan
317136 by: Govinda
317137 by: Tom Sparks
317138 by: Tom Sparks
317139 by: Stuart Dallas

Sunset/Sunrise
317140 by: Tedd Sperling

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---
-Original Message-
From: tamouse mailing lists [mailto:tamouse.li...@gmail.com] 
Sent: 19 March 2012 10:28 AM
To: php-gene...@lists.php.net
Subject: Re: [PHP] Getting knotted with quotes encoding - (one possible 
solution)

On Sun, Mar 18, 2012 at 10:19 PM, Tamara Temple 
tamouse.li...@tamaratemple.com wrote:
 On Tue, 13 Mar 2012 16:35:44 +0200, Arno Kuhl a...@dotcontent.net sent:

 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
 Sent: 13 March 2012 03:25 PM
 To: a...@dotcontent.net; php-gene...@lists.php.net
 Subject: Re: [PHP] Getting knotted with quotes encoding


 Arno Kuhl a...@dotcontent.net wrote:

 I've been battling with quotes encoding when outputting javascript 
 with php.
 It can't be unique, so I'm hoping someone has a working solution 
 they're willing to share.

 The following works perfectly as long as there aren't any single 
 quotes in the link text:
echo span onclick=\insertLink('$sUrl','$sTitle')\
 class='linkSel'$sTitle/span;

 if $sTitle has the valueWhat's newit outputs:
span 
 onclick=insertLink('article/whats-new.html','What#039;s
 new') class='linkSel'What#039;s new/span

 It displays fine, but javascript complains with:
Expected ')'  linkmanager.php Line:525 Char:63


 So I fix this by swapping the double and single quotes around:
echo span onclick='insertLink(\$sUrl\,\$sTitle\)'
 class='linkSel'$sTitle/span;

 Now for that specific link it outputs:
span 
 onclick='insertLink(article/whats-new.html,What#039;s
 new)' class='linkSel'What#039;s new/span And javascript is happy.

 But elsewhere there's a link Fred Buster Cox and it outputs:
span 
 onclick='insertLink(article/fred-buster-cox.html,Fred
 quot;Busterquot; Cox)' class='linkSel'Fred quot;Busterquot; 
 Cox/span

 Again it displays fine, but javascript complains with:
Expected ')'  linkmanager.php Line:743 Char:77


 So it looks like I can't have links that include single quotes and 
 double quotes, only one or the other.

 One work-around I thought of was to convert any link texts that 
 included double quotes into single quotes when the content is 
 posted, and it would then be displayed with single quotes even 
 though the user entered double quotes. It's far from ideal but it 
 would work, though I can think of a few situations where it would be 
 quite confusing to the reader. Are there any other solutions that 
 would allow both types of quotes without any conversions?

 Cheers
 Arno


 --


 You aren't escaping the quotes correctly when they go into your  output.
 You're escaping them for html not javascript. Javascript  (like php) 
 escapes single quotes inside a single quote string with a  back slash.


  Thanks,
 Ash
 http://ashleysheridan.co.uk
 -

 Thanks for that Ashley.
 You're right about the encoding.
 I had a line prior to that:
$sTitle = htmlentities($title, ENT_QUOTES, 'ISO-8859-1', 
 FALSE); Which encoded the quotes.


 I couldn't find anything so made a function, which might be useful  
 for others.
 It’s a first shot, I'm sure there are ways to improve performance.
 I also changed the encoding to exclude single quotes.
 (I'm sure the indenting will get screwed up in the mail)


 $sTitle = fixSingleQuotes(htmlentities($title, ENT_COMPAT,  
 'ISO-8859-1', FALSE));

 .


 /
 /// // convert single quotes to curly quotes, xml compliant 
 // assumes apostrophes must be between 2 alpha chars // and any other 
 ' is a single quote // #8216; = left single quote // #8217; = right 
 single quote and apostrophe function fixSingleQuotes($sText) {
if (strpos($sText, ') !== FALSE) {
// there are quotes to convert
$bOpenQuote = FALSE;
$arrAlpha = explode(' ', a b c d e f g h i j k l m n 
 o p q r s t  u v w x y z A B C D E F G H I J K L M N O P Q R S T U V 
 W X Y Z);
$arrText = str_split($sText);
while (($pos = strpos($sText, ')) !== FALSE) {
if ($pos == 0

php-general Digest 19 Mar 2012 12:23:10 -0000 Issue 7734

2012-03-19 Thread php-general-digest-help

php-general Digest 19 Mar 2012 12:23:10 - Issue 7734

Topics (messages 317121 through 317130):

Re: CMS identification
317121 by: Daniel Fenn
317122 by: Robert Cummings
317127 by: Stuart Dallas

Re: Getting knotted with quotes encoding - (one possible solution)
317123 by: Tamara Temple
317124 by: tamouse mailing lists

Re: Parse errors
317125 by: tamouse mailing lists

Re: questions about $_SERVER
317126 by: tamouse mailing lists

Re: Got HTML5 History API + caching LICKED, I think, grin
317128 by: rene7705
317129 by: rene7705

Using a stream filter to do a search and replace on an XML file.
317130 by: Richard Quadling

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---
Well if the OP has the link to it in the first place then yes that would work.





On Mon, Mar 19, 2012 at 11:21 AM, Ross McKay ro...@zeta.org.au wrote:
 On Sun, 18 Mar 2012 23:20:21 +0100, Alain Roger wrote:

i have a customer who need to update his website but he was not able to
tell me more about it.
he just told me it's a CMS and sent me a screenshot.
[...]

 Instead of hoping for a USENET reader to recognise that screenshot, open
 the login page in a web browser and view source. It's likely that there
 will be a meta tag in the head that tells you what the CMS is.
 --
 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

---End Message---
---BeginMessage---

On 12-03-18 06:42 PM, Stuart Dallas wrote:

On 18 Mar 2012, at 22:32, Alain Roger wrote:


ok so here it is: 
http://i220.photobucket.com/albums/dd277/alainroger/cms-login.png


Pass, not one I'm familiar with and a Google Image search for cms login doesn't 
show anything similar. If I were you I'd tell him to give me access to it so I 
can have a look for myself.


On google image search click on the camera icon... then paste in the URL 
with the screen shot.


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.
---End Message---
---BeginMessage---
On 19 Mar 2012, at 02:20, Robert Cummings wrote:

 On 12-03-18 06:42 PM, Stuart Dallas wrote:
 On 18 Mar 2012, at 22:32, Alain Roger wrote:
 
 ok so here it is: 
 http://i220.photobucket.com/albums/dd277/alainroger/cms-login.png
 
 Pass, not one I'm familiar with and a Google Image search for cms login 
 doesn't show anything similar. If I were you I'd tell him to give me access 
 to it so I can have a look for myself.
 
 On google image search click on the camera icon... then paste in the URL with 
 the screen shot.

How freakin' awesome is that?!?!?

http://www.idep-support.com/page.php?srid=33

Thanks Rob!

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
---End Message---
---BeginMessage---

On Tue, 13 Mar 2012 16:35:44 +0200, Arno Kuhl a...@dotcontent.net sent:

From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
Sent: 13 March 2012 03:25 PM
To: a...@dotcontent.net; php-gene...@lists.php.net
Subject: Re: [PHP] Getting knotted with quotes encoding


Arno Kuhl a...@dotcontent.net wrote:


I've been battling with quotes encoding when outputting javascript with
php.
It can't be unique, so I'm hoping someone has a working solution
they're willing to share.

The following works perfectly as long as there aren't any single quotes
in the link text:
echo span onclick=\insertLink('$sUrl','$sTitle')\
class='linkSel'$sTitle/span;

if $sTitle has the valueWhat's newit outputs:
span onclick=insertLink('article/whats-new.html','What#039;s
new') class='linkSel'What#039;s new/span

It displays fine, but javascript complains with:
Expected ')'  linkmanager.php Line:525 Char:63


So I fix this by swapping the double and single quotes around:
echo span onclick='insertLink(\$sUrl\,\$sTitle\)'
class='linkSel'$sTitle/span;

Now for that specific link it outputs:
span onclick='insertLink(article/whats-new.html,What#039;s
new)' class='linkSel'What#039;s new/span And javascript is happy.

But elsewhere there's a link Fred Buster Cox and it outputs:
span onclick='insertLink(article/fred-buster-cox.html,Fred
quot;Busterquot; Cox)' class='linkSel'Fred quot;Busterquot;
Cox/span

Again it displays fine, but javascript complains with:
Expected ')'  linkmanager.php Line:743 Char:77


So it looks like I can't have links

php-general Digest 19 Mar 2012 00:21:48 -0000 Issue 7733

2012-03-18 Thread php-general-digest-help

php-general Digest 19 Mar 2012 00:21:48 - Issue 7733

Topics (messages 317089 through 317120):

Re: Got HTML5 History API + caching LICKED, I think, grin
317089 by: Jason Pruim
317090 by: rene7705
317091 by: rene7705
317092 by: rene7705
317093 by: Jason Pruim
317094 by: rene7705
317095 by: Jason Pruim
317096 by: rene7705
317101 by: Per Jessen
317105 by: Tamara Temple
317107 by: Tim Streater
317109 by: Tim Streater
317118 by: Ashley Sheridan

Graphing
317097 by: Ross Hansen
317098 by: David OBrien
317099 by: Ashley Sheridan
317100 by: Mike Mackintosh
317102 by: Bastien

Re: hello everybody
317103 by: Jim Giner
317104 by: Jeremy Wei

Re: fgetcsv doesn't return an array?
317106 by: Tamara Temple
317108 by: Lester Caine

Parse errors
317110 by: Tim Streater
317111 by: Simon J Welsh
317113 by: Tim Streater

Re: Variables are empty only in fwrite
317112 by: Tamara Temple

CMS identification
317114 by: Alain Roger
317115 by: Stuart Dallas
317116 by: Alain Roger
317117 by: Stuart Dallas
317119 by: Bastien
317120 by: Ross McKay

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---
Just tried to load it up on my iPad and the load time was okay... Little slow. 

But your navigation is completely non functional on my iPad... Might want to 
look into that since mobile devices are becoming more and more common. 

Jason Pruim

---End Message---
---BeginMessage---
On Sun, Mar 18, 2012 at 1:24 PM, Jason Pruim li...@pruimphotography.comwrote:

 Just tried to load it up on my iPad and the load time was okay... Little
 slow.

 But your navigation is completely non functional on my iPad... Might want
 to look into that since mobile devices are becoming more and more common.

 Jason Pruim


 I wish I had the money for an real iPad, so I could test it properly.
What part of the navigation doesn't work? Do the links in the content work?
---End Message---
---BeginMessage---
On Sun, Mar 18, 2012 at 10:58 AM, Per Jessen p...@computer.org wrote:

 rene7705 wrote:

  In response to critiques about my download size, I've removed scenejs
  and the artwork for my own site-logos from the zip. The size is now
  38mb, down from 54mb.

 I think it took about a minute at about 470kb/sec.


I get much better datarates, around 1.5 to 2mb/s... But then again, the
server is in europe, and so am I.
But I guess a minute is OK...



  I'm also using 7-zip now, I hope it opens better on non-windows OSes.

 It worked fine with unzip on linux.

 Cool :) I hope it works on macOS too! :)
---End Message---
---BeginMessage---
On Sun, Mar 18, 2012 at 1:34 PM, rene7705 rene7...@gmail.com wrote:



 On Sun, Mar 18, 2012 at 1:24 PM, Jason Pruim 
 li...@pruimphotography.comwrote:

 Just tried to load it up on my iPad and the load time was okay... Little
 slow.

 But your navigation is completely non functional on my iPad... Might want
 to look into that since mobile devices are becoming more and more common.

 Jason Pruim


 I wish I had the money for an real iPad, so I could test it properly.
 What part of the navigation doesn't work? Do the links in the content
 work?

 BTW folks, I also tested it on my samsung smartphone, and my site doesn't
work on it yet.
Compatibility (also with non-desktop devices) will remain high on my
priority list.
---End Message---
---BeginMessage---


On Mar 18, 2012, at 8:34 AM, rene7705 rene7...@gmail.com wrote:

 On Sun, Mar 18, 2012 at 1:24 PM, Jason Pruim 
 li...@pruimphotography.comwrote:
 
 Just tried to load it up on my iPad and the load time was okay... Little
 slow.
 
 But your navigation is completely non functional on my iPad... Might want
 to look into that since mobile devices are becoming more and more common.
 
 Jason Pruim
 
 
 I wish I had the money for an real iPad, so I could test it properly.
 What part of the navigation doesn't work? Do the links in the content work?

From what I can tell its the links on the top... The ones in the Content seem 
to work but I didn't check all of them. ---End Message---
---BeginMessage---
On Sun, Mar 18, 2012 at 1:41 PM, Jason Pruim li...@pruimphotography.comwrote:



 On Mar 18, 2012, at 8:34 AM, rene7705 rene7...@gmail.com wrote:

  On Sun, Mar 18, 2012 at 1:24 PM, Jason Pruim li...@pruimphotography.com
 wrote:
 
  Just tried to load it up on my iPad and the load time was okay... Little
  slow.
 
  But your navigation is completely non functional on my iPad... Might
 want
  to look into that since mobile devices are becoming

php-general Digest 17 Mar 2012 09:54:08 -0000 Issue 7730

2012-03-17 Thread php-general-digest-help

php-general Digest 17 Mar 2012 09:54:08 - Issue 7730

Topics (messages 317053 through 317074):

Got HTML5 History API + caching LICKED, I think, grin
317053 by: rene7705
317054 by: Jim Giner
317055 by: rene7705
317056 by: rene7705
317057 by: Floyd Resler
317058 by: rene7705
317059 by: Jim Giner
317060 by: rene7705
317061 by: rene7705
317062 by: Stuart Dallas
317063 by: rene7705
317064 by: Jim Giner
317065 by: rene7705
317066 by: Stuart Dallas
317067 by: Jim Giner
317068 by: rene7705
317069 by: Marc Guay
317070 by: Tommy Pham
317071 by: rene7705
317072 by: Govinda
317073 by: Stuart Dallas
317074 by: Ashley Sheridan

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---
Hi Folks..

I could waste a lot of text on what I've accomplished during the last
months, but the easiest thing is if you have a (another) look at (the
source of) http://mediabeez.ws

I think you'll like my opensourced work :)

Feedback is appreciated.
---End Message---
---BeginMessage---

rene7705 rene7...@gmail.com wrote in message 
news:cadegsebtv7ffuvcbxkothqzah3ethegdedyuarxene2d1mw...@mail.gmail.com...
 Hi Folks..

 I could waste a lot of text on what I've accomplished during the last
 months, but the easiest thing is if you have a (another) look at (the
 source of) http://mediabeez.ws

 I think you'll like my opensourced work :)

 Feedback is appreciated.


Whatever it is - it doesn't seem to be working.  JS errors, no output. 


---End Message---
---BeginMessage---
hey that's strange. I tested it in firefox, chrome, and internet explorer.
What browser are you using?

On Fri, Mar 16, 2012 at 8:15 PM, Jim Giner jim.gi...@albanyhandball.comwrote:


 rene7705 rene7...@gmail.com wrote in message
 news:cadegsebtv7ffuvcbxkothqzah3ethegdedyuarxene2d1mw...@mail.gmail.com...
  Hi Folks..
 
  I could waste a lot of text on what I've accomplished during the last
  months, but the easiest thing is if you have a (another) look at (the
  source of) http://mediabeez.ws
 
  I think you'll like my opensourced work :)
 
  Feedback is appreciated.
 

 Whatever it is - it doesn't seem to be working.  JS errors, no output.



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


---End Message---
---BeginMessage---
And could you paste me the JS errors, please?...

On Fri, Mar 16, 2012 at 8:17 PM, rene7705 rene7...@gmail.com wrote:

 hey that's strange. I tested it in firefox, chrome, and internet explorer.
 What browser are you using?

 On Fri, Mar 16, 2012 at 8:15 PM, Jim Giner 
 jim.gi...@albanyhandball.comwrote:


 rene7705 rene7...@gmail.com wrote in message
 news:cadegsebtv7ffuvcbxkothqzah3ethegdedyuarxene2d1mw...@mail.gmail.com.
 ..
  Hi Folks..
 
  I could waste a lot of text on what I've accomplished during the last
  months, but the easiest thing is if you have a (another) look at (the
  source of) http://mediabeez.ws
 
  I think you'll like my opensourced work :)
 
  Feedback is appreciated.
 

 Whatever it is - it doesn't seem to be working.  JS errors, no output.



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



---End Message---
---BeginMessage---

On Mar 16, 2012, at 3:15 PM, Jim Giner wrote:

 
 rene7705 rene7...@gmail.com wrote in message 
 news:cadegsebtv7ffuvcbxkothqzah3ethegdedyuarxene2d1mw...@mail.gmail.com...
 Hi Folks..
 
 I could waste a lot of text on what I've accomplished during the last
 months, but the easiest thing is if you have a (another) look at (the
 source of) http://mediabeez.ws
 
 I think you'll like my opensourced work :)
 
 Feedback is appreciated.
 
 
 Whatever it is - it doesn't seem to be working.  JS errors, no output. 
 

I'm having a problem downloading the ZIP file.  It decompresses into a cpgz 
file which then decompresses into a zip file.---End Message---
---BeginMessage---
On Fri, Mar 16, 2012 at 8:30 PM, Floyd Resler fres...@adex-intl.com wrote:

 I'm having a problem downloading the ZIP file.  It decompresses into a
 cpgz file which then decompresses into a zip file.


I've never heard of a cpgz file... And with winrar I can open the
downloaded zip file just fine, as any other zip.
What browser and decompression apps are you using?
---End Message---
---BeginMessage---

Floyd Resler fres...@adex-intl.com wrote in message 
news:f69820c8-5c91-4010-a69f-11729fe04...@adex-intl.com...

On Mar 16, 2012, at 3:15 PM, Jim Giner wrote:


 rene7705 rene7...@gmail.com wrote in message

php-general Digest 17 Mar 2012 22:57:20 -0000 Issue 7731

2012-03-17 Thread php-general-digest-help

php-general Digest 17 Mar 2012 22:57:20 - Issue 7731

Topics (messages 317075 through 317086):

Re: Got HTML5 History API + caching LICKED, I think, grin
317075 by: rene7705
317076 by: rene7705
317077 by: rene7705
317078 by: rene7705
317079 by: Stuart Dallas
317080 by: rene7705
317081 by: Jay Blanchard
317082 by: Stuart Dallas

Re: $POST and $_SESSION
317083 by: Al
317084 by: Ashley Sheridan
317085 by: Al
317086 by: sono-io.fannullone.us

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---
On Fri, Mar 16, 2012 at 10:17 PM, Govinda govinda.webdnat...@gmail.comwrote:

 Everyone makes valid points.. and depending on ones perspective, certain
 of those points are more important than others... but, because of my nature
 anyway, I want to just say thanks to rene7705 for bothering.   He is not
 trying to take anything.. but just share his creative process, in case it
 is fun for anyone, or useful for anyone.  He undoubtedly wants to improve
 too.. but there is the middle step where positive reinforcement is the most
 pertinent thing.   Rene, don't mind the tones here.. we all get paid to
 scrutinize, so it can be hard to snap out of that critical mindset
 sometimes.

 -Govinda


Thanks..
---End Message---
---BeginMessage---
On Fri, Mar 16, 2012 at 11:13 PM, Stuart Dallas stu...@3ft9.com wrote:

 On 16 Mar 2012, at 20:53, rene7705 wrote:
  On Fri, Mar 16, 2012 at 9:45 PM, Stuart Dallas stu...@3ft9.com wrote:
  On 16 Mar 2012, at 20:36, rene7705 wrote:
 
   On Fri, Mar 16, 2012 at 9:29 PM, Stuart Dallas stu...@3ft9.com
 wrote:
   On 16 Mar 2012, at 18:57, rene7705 wrote:
  
Hi Folks..
   
I could waste a lot of text on what I've accomplished during the
 last
months, but the easiest thing is if you have a (another) look at
 (the
source of) http://mediabeez.ws
   
I think you'll like my opensourced work :)
   
Feedback is appreciated.
  
   I'm also having trouble downloading the ZIP file (Chrome 17.0.963.79
 on OSX - not that the browser will have anything to do with this problem at
 all). The download starts, gets to a few MB and doesn't get any further.
  
   And 52MB? Since I can't actually see what it contains it's hard to
 judge, but right off the bat... is your artwork necessary for the thing to
 work? What external libraries are you using?
  
   Just from looking around the site there are a few things that jump
 out...
  
   * The dropdown menus are incredible jittery, certainly nowhere near
 production-ready.
  
   * The background image gets squished according to the dimensions of
 the browser window.
  
   * Your homepage weighs in at massive 2.6MB. Nuff sed!
  
   I suggest you take the focus off the way it looks and concentrate on
 what it does. Tabs with animated backgrounds remind me of websites from the
 late 90s. You may have developed an incredible framework here, but I don't
 know because it's buried under 50MB of other stuff that I almost certainly
 don't care about, and that's before I've even been able to download it.
  
   ok..
  
   That being unable to download the zip file correctly is something
 I'll take up with my hosting provider tomorrow.
   I've downloaded it in full and opened it OK in winrar just now, btw.
  
   The zip-file is created with winrar on windows 7, and according to
 Floyd Resler has to get it's extension changed to .rar, then decompressed
 with Stuffit Expander. Also something to look into soon, btw.
 
  That would explain why every zip decompression utility I've tried
 thinks it's corrupt.
 
   As for my menu being jittery, it's not jittery on any of the windows
 browsers I tested.
   And I have no mac-book available to me, not even from friends and
 family who are all on windows (on my recommendation btw ;)
 
  Are you ready for the shocking truth... not every computer in the world
 runs Windows, so unless you've developed this purely for the friends and
 family you've convinced to do so you may want to rethink your approach to
 testing.
 
   As for my files and homepage being Huge, yep, it's made for the
 future or current fast internet connections.
   Frankly, size reduction is not on my agenda. I'll wait for the nets
 to become faster still.
   And the server should spit it out at 2MB/s at least..
 
  That may be so, but when my 100Mbit/s connection finally managed to
 download the file it took about 4 minutes, which is nowhere near 2MB/s.
 Your homepage takes 7 seconds to load - that's unacceptable in the real
 world, especially when you're talking about a server that's (and I'm only
 guessing here) not under heavy load.
 
  Anyway, your comment

php-general Digest 13 Mar 2012 14:35:55 -0000 Issue 7726

2012-03-13 Thread php-general-digest-help

php-general Digest 13 Mar 2012 14:35:55 - Issue 7726

Topics (messages 317001 through 317003):

Getting knotted with quotes encoding
317001 by: Arno Kuhl
317002 by: Ashley Sheridan

Re: Getting knotted with quotes encoding - (one possible solution)
317003 by: Arno Kuhl

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---
I've been battling with quotes encoding when outputting javascript with php.
It can't be unique, so I'm hoping someone has a working solution they're
willing to share.

The following works perfectly as long as there aren't any single quotes in
the link text:
echo span onclick=\insertLink('$sUrl','$sTitle')\
class='linkSel'$sTitle/span;

if $sTitle has the valueWhat's newit outputs:
span onclick=insertLink('article/whats-new.html','What#039;s
new') class='linkSel'What#039;s new/span

It displays fine, but javascript complains with:
Expected ')'  linkmanager.php Line:525 Char:63


So I fix this by swapping the double and single quotes around:
echo span onclick='insertLink(\$sUrl\,\$sTitle\)'
class='linkSel'$sTitle/span;

Now for that specific link it outputs: 
span onclick='insertLink(article/whats-new.html,What#039;s
new)' class='linkSel'What#039;s new/span
And javascript is happy.

But elsewhere there's a link Fred Buster Cox and it outputs:
span onclick='insertLink(article/fred-buster-cox.html,Fred
quot;Busterquot; Cox)' class='linkSel'Fred quot;Busterquot; Cox/span

Again it displays fine, but javascript complains with:
Expected ')'  linkmanager.php Line:743 Char:77


So it looks like I can't have links that include single quotes and double
quotes, only one or the other.

One work-around I thought of was to convert any link texts that included
double quotes into single quotes when the content is posted, and it would
then be displayed with single quotes even though the user entered double
quotes. It's far from ideal but it would work, though I can think of a few
situations where it would be quite confusing to the reader. Are there any
other solutions that would allow both types of quotes without any
conversions?

Cheers
Arno

---End Message---
---BeginMessage---


Arno Kuhl a...@dotcontent.net wrote:

I've been battling with quotes encoding when outputting javascript with
php.
It can't be unique, so I'm hoping someone has a working solution
they're
willing to share.

The following works perfectly as long as there aren't any single quotes
in
the link text:
   echo span onclick=\insertLink('$sUrl','$sTitle')\
class='linkSel'$sTitle/span;

if $sTitle has the valueWhat's newit outputs:
   span onclick=insertLink('article/whats-new.html','What#039;s
new') class='linkSel'What#039;s new/span

It displays fine, but javascript complains with:
   Expected ')'  linkmanager.php Line:525 Char:63


So I fix this by swapping the double and single quotes around:
   echo span onclick='insertLink(\$sUrl\,\$sTitle\)'
class='linkSel'$sTitle/span;

Now for that specific link it outputs:
   span onclick='insertLink(article/whats-new.html,What#039;s
new)' class='linkSel'What#039;s new/span
And javascript is happy.

But elsewhere there's a link Fred Buster Cox and it outputs:
   span onclick='insertLink(article/fred-buster-cox.html,Fred
quot;Busterquot; Cox)' class='linkSel'Fred quot;Busterquot;
Cox/span

Again it displays fine, but javascript complains with:
   Expected ')'  linkmanager.php Line:743 Char:77


So it looks like I can't have links that include single quotes and
double
quotes, only one or the other.

One work-around I thought of was to convert any link texts that
included
double quotes into single quotes when the content is posted, and it
would
then be displayed with single quotes even though the user entered
double
quotes. It's far from ideal but it would work, though I can think of a
few
situations where it would be quite confusing to the reader. Are there
any
other solutions that would allow both types of quotes without any
conversions?

Cheers
Arno


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

You aren't escaping the quotes correctly when they go into your output. You're 
escaping them for html not javascript. Javascript (like php) escapes single 
quotes inside a single quote string with a back slash.


 Thanks,
Ash
http://ashleysheridan.co.uk
---End Message---
---BeginMessage---
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: 13 March 2012 03:25 PM
To: a...@dotcontent.net; php-gene...@lists.php.net
Subject: Re: [PHP] Getting knotted with quotes encoding


Arno Kuhl

php-general Digest 14 Mar 2012 03:01:54 -0000 Issue 7727

2012-03-13 Thread php-general-digest-help

php-general Digest 14 Mar 2012 03:01:54 - Issue 7727

Topics (messages 317004 through 317013):

Re: questions about $_SERVER
317004 by: Tedd Sperling
317006 by: Tedd Sperling
317007 by: Matijn Woudt
317008 by: Stuart Dallas
317009 by: Tedd Sperling
317010 by: Tim Streater
317013 by: Donovan Brooke

Randomly unable to read set variable from class
317005 by: Adrian Basalic
317011 by: Camilo Sperberg

set_error_handler() only triggering every Nth time
317012 by: Daevid Vincent

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---
On Mar 12, 2012, at 7:12 PM, Tim Streater wrote:
 ?php
 
 function yes ($a)
 {
 global $x;
 if  ($a)  $x = yes\n;
 }
 
 first (true);
 
 echo $x;
 
 ?
 
 
 but I haven't looked into $GLOBALS enough to know whether using them instead 
 would have saved my bacon.

I'm not sure what would have saved bacon in the above case. I don't see how 
your example would work. I think it contained a typo.

In what I think you were trying to demonstrate, I would just pass $x by 
reference ($x) -- or -- return $x by value. I would not have used a global,

In any event, I seldom use globals anyway. This was more an academic discussion.

Cheers,

tedd

_
tedd.sperl...@gmail.com
http://sperling.com---End Message---
---BeginMessage---
On Mar 12, 2012, at 12:04 PM, Daniel Brown wrote:
 On Sun, Mar 11, 2012 at 14:16, Tedd Sperling tedd.sperl...@gmail.com wrote:
 This document clearly states that $GLOBALS is a SuperGlobal -- what am I not 
 understanding here?
 
You are understanding it correctly, the only thing that's missing
 is the population.  The variables are defined (set), but not all are
 populated.  $GLOBALS is a superglobal, you're right; globals set from
 userland scripts are not superglobals, but do wind up in the $GLOBALS
 array.  Thus, all superglobals are globals, but not all globals are
 superglobals.

So, it's a question of population timing -- I see.

Additionally, I like the term userland -- I will use it in class. :-)

What would be the opposite term, serverland?

Thanks,

tedd

_
tedd.sperl...@gmail.com
http://sperling.com
---End Message---
---BeginMessage---
On Tue, Mar 13, 2012 at 4:59 PM, Tedd Sperling tedd.sperl...@gmail.com wrote:
 On Mar 12, 2012, at 7:12 PM, Tim Streater wrote:
 ?php

 function yes ($a)
     {
     global $x;
     if  ($a)  $x = yes\n;
     }

 first (true);

 echo $x;

 ?


 but I haven't looked into $GLOBALS enough to know whether using them instead 
 would have saved my bacon.

 I'm not sure what would have saved bacon in the above case. I don't see how 
 your example would work. I think it contained a typo.

 In what I think you were trying to demonstrate, I would just pass $x by 
 reference ($x) -- or -- return $x by value. I would not have used a global,

 In any event, I seldom use globals anyway. This was more an academic 
 discussion.

 Cheers,

 tedd


I would indeed mark it as bad practice using them. I only use them for
debugging purposes. When developing something, you might end up
needing some global variable temporary, and you don't want to pass it
through a few dozen functions before reaching the one where you need
it.

- Matijn
---End Message---
---BeginMessage---
On 13 Mar 2012, at 15:59, Tedd Sperling wrote:

 In any event, I seldom use globals anyway. This was more an academic 
 discussion.

If you're being academic about it please remember that the way PHP defines 
globals is different to most other languages.

PHP: A variable defined at the top-level scope.

World: A variable that is visible at every scope.

This is an important difference if you ever move from PHP to another language. 
It ultimately also means that only the superglobals are true globals.

The $GLOBALS superglobal contains all variables defined at the top-level scope, 
including $GLOBALS, so $GLOBALS['GLOBALS']['GLOBALS']['GLOBALS']['_SERVER'] is 
a perfectly valid, if daft, way of accessing $_SERVER.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
---End Message---
---BeginMessage---
On Mar 13, 2012, at 12:20 PM, Stuart Dallas wrote:
 On 13 Mar 2012, at 15:59, Tedd Sperling wrote:
 
 In any event, I seldom use globals anyway. This was more an academic 
 discussion.
 -snip-
 It ultimately also means that only the superglobals are true globals.

That was my initial statement in this thread.

After 47 years of programming, I think I'm beginning to get the idea. :-)

As I've said for many years I've learned something new every day of my life -- 
and I'm getting damned tried of it.

Cheers,

tedd

_
tedd.sperl

php-general Digest 12 Mar 2012 13:38:09 -0000 Issue 7724

2012-03-12 Thread php-general-digest-help

php-general Digest 12 Mar 2012 13:38:09 - Issue 7724

Topics (messages 316989 through 316992):

Re: Have little enough hair as it is ...
316989 by: Matijn Woudt
316990 by: Lester Caine
316991 by: Simon Schick
316992 by: Lester Caine

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---
On Mon, Mar 12, 2012 at 12:11 AM, Simon Schick
simonsimc...@googlemail.com wrote:
 2012/3/11 Lester Caine les...@lsces.co.uk:
 ( Been down London over night ;) ) ... and was not awake enough to change
 email address ...


 http://piwik.medw.org.uk/phpinfo.php has http://piwik.medw.org.uk/ working
 fine...

 http://piwik.rainbowdigitalmedia.org.uk/phpinfo.php is just giving seg
 faults on http://piwik.rainbowdigitalmedia.org.uk/ but
 http://rainbowdigitalmedia.org.uk/ is working perfectly.

 The piwik analytics is based on Zend, and I've not been able to get it
 working on either of the two new machines, while all of my other stuff is
 working fine. I started with Apache2.4.1 and PHP5.4.0 and moved back to
 what
 should be the same versions as the working machines but without success.


 Simon Schick wrote:

 Can you give us some more information?

 I've been working on this for some days and tried various combinations of
 Apache and PHP, but my starting point was Ap2.4.1 with PHP5.4.0 and I've now
 worked my way back through versions to what should be the same as setup as
 is working on piwik.medw.org.uk but I have yet to get piwik to run on either
 new machine!

 How is php called in your apache-configuration? (f)cgi, module or somehow
 else?
 You said that the configuration should be the same ... can you
 double-check that? Reload the services etc ...

 Always used module and I see no reason to change
 I've enabled and disable just about everything, and the installer tells me
 the set-up is fine.

 What about the logs? There must be more info in there ...

 THAT is what is pissing me off. ZEND does not seem to log anything usable
 and I have yet to establish the best way of debugging it. The rest of my
 stuff simply worked, gave the expected new nagging and allowed me to track
 and tidy them. EVERY configuration of ZEND based piwik just gives ...
 [notice] child pid 10345 exit signal Segmentation fault (11)
 With eaccelerator switched on and tracking, I can see files being cached,
 but have yet to work out what the next file would be, and to be honest, I'm
 not convinced it runs the same way every time, but that is probably just the
 order of parallel paths being run?

 --
 Lester Caine - G8HFL
 -
 Contact - http://lsces.co.uk/wiki/?page=contact
 L.S.Caine Electronic Services - http://lsces.co.uk
 EnquirySolve - http://enquirysolve.com/
 Model Engineers Digital Workshop - http://medw.co.uk//
 Firebird - http://www.firebirdsql.org/index.php

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 Hi, Lester

 You're talking about some kind of installer ... What exactly is it?
 And what exactly do you mean with ZEND does not seem to log ...?
 Apache, PHP or something that's controlling both?
 And the more interesting question as you're only talking about ZEND
 ... in which log-file have you found the notice? I guess it's the
 log-file of Apache ...
 I guess you have already tried to set Apache and PHP to the lowest
 possible error-level ...

 I searched up the inet and came across totally different solutions ...

 Things that I found you can try:
 * Replace the index.php ... Some people reported that this error was
 caused by an endless-loop in their php-script

I have experienced a segfault once with mod_rewrite and some endless
loop in a .htaccess file. So you might want to check that too.

- Matijn
---End Message---
---BeginMessage---

Matijn Woudt wrote:

  Things that I found you can try:
  * Replace the index.php ... Some people reported that this error was
  caused by an endless-loop in their php-script

I have experienced a segfault once with mod_rewrite and some endless
loop in a .htaccess file. So you might want to check that too.


Thanks for the hints guys, but it was the wrong direction ...
piwik is an analytics package ... google analytics with steroids ;)
But the code base is a bit difficult to work with when one does not use 
frameworks like Zend.


The starting point was a segfault in PHP which needs to be fixed, but we 
normally manage to avoid hitting it by managing things better. The updates I'd 
added to the Firebird driver in Zend were missing some checks which kicked it 
out at which point ... NOTHING gets logged.


In 12 years I've managed to avoid having to install xdebug as we have all

php-general Digest 11 Mar 2012 23:11:18 -0000 Issue 7723

2012-03-11 Thread php-general-digest-help

php-general Digest 11 Mar 2012 23:11:18 - Issue 7723

Topics (messages 316981 through 316988):

Re: questions about $_SERVER
316981 by: Stuart Dallas
316982 by: Daniel Brown
316984 by: Tedd Sperling
316986 by: Tim Streater

Re: Have little enough hair as it is ...
316983 by: Lester Caine
316988 by: Simon Schick

Re: Function mktime() documentation question
316985 by: Tedd Sperling
316987 by: Matijn Woudt

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---
On 11 Mar 2012, at 01:43, Tedd Sperling wrote:

 On Mar 10, 2012, at 3:53 PM, tamouse mailing lists wrote:
 On Sat, Mar 10, 2012 at 9:37 AM, Tedd Sperling tedd.sperl...@gmail.com 
 wrote:
 That's correct, but to access those variables outside of their scope (such 
 as a function) you do via a SuperGlobal, namely $GLOBAL['whatever'].
 
 As such, there are no globals in PHP other than SuperGlobals. As I said, 
 if I'm wrong, please show me otherwise.
 
 I guess I don't know what you mean by globals. I know what globals
 are, but not globals.
 
 I don't understand your question. I know what questions are, but not your 
 question. :-)

I think the confusion is arising because the word superglobal is used in PHP 
when referring to globals, because the word global has been incorrectly applied 
for quite some time.

A global variable is a variable that is accessible in every scope, so Tedd is 
right… the only true globals in PHP are the superglobals. Here's an overview of 
the various scopes in PHP (I've probably missed some, but it's enough to make 
the point)…

?php
  // Only visible when not in a function or class. The PHP manual calls
  // this the global scope: http://php.net/variables.scope
  $var1 = 'a';

  function funcB()
  {
// Only visible inside this function.
$var2 = 'b';
  }

  function funcB()
  {
// This statement makes the variable from the top-level scope visible
// within this function. Essentially this is the same as passing the
// variable in to the function by reference.
global $var1;
  }

  class classC
  {
// Visible to methods in this class only.
private $var3 = 'c';

// Visible to methods in this class and methods in derived classes.
protected $var4 = 'd';

// Method visible in this class only.
private methodA()
{
  // Visible only inside this method.
  $var5 = 'e';
}

// Method visible in this class and methods in derived classes.
protected methodB()
{
  // See funcB()
  global $var1;
}

// Method visible on any instance of this class.
public methodC()
{
  // See funcB()
  global $var1;
}
  }
?

The global keyword allows you to expose a variable that has been defined at the 
top-level scope ($var1 in the above example) in the current scope. It does NOT 
create a global variable; the keyword is not an accurate reflection of what it 
does.

My guess is that calling the top-level scope global made sense when functions 
were the only other level of scope that existed. Now that we have yet more 
levels of scope it can be a bit confusing.

I hope this helps clear things up.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/---End Message---
---BeginMessage---
On Sat, Mar 10, 2012 at 10:37, Tedd Sperling tedd.sperl...@gmail.com wrote:
 As such, there are no globals in PHP other than SuperGlobals. As I said, if 
 I'm wrong, please show me otherwise.

A superglobal is predefined at run-time by the parser,
environment, SAPI, etc. (_SERVER, _POST, _GET, _REQUEST, _ENV,
_SESSION, _COOKIE), whereas a global can be defined at any time, and
is available to the current instance.  All superglobals are globals,
but not all globals are superglobals.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/
---End Message---
---BeginMessage---
On Mar 11, 2012, at 10:25 AM, Daniel Brown wrote:

 On Sat, Mar 10, 2012 at 10:37, Tedd Sperling tedd.sperl...@gmail.com wrote:
 As such, there are no globals in PHP other than SuperGlobals. As I said, 
 if I'm wrong, please show me otherwise.
 
A superglobal is predefined at run-time by the parser,
 environment, SAPI, etc. (_SERVER, _POST, _GET, _REQUEST, _ENV,
 _SESSION, _COOKIE), whereas a global can be defined at any time, and
 is available to the current instance.  All superglobals are globals,
 but not all globals are superglobals.
 
 -- 
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/


Now I'm confused.

My understanding is that all variables defined within the main script are 
accessible within the main script because they are all within scope by 
definition.

Additionally, main

php-general Digest 10 Mar 2012 15:38:02 -0000 Issue 7721

2012-03-10 Thread php-general-digest-help

php-general Digest 10 Mar 2012 15:38:02 - Issue 7721

Topics (messages 316962 through 316962):

Re: questions about $_SERVER
316962 by: Tedd Sperling

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---
On Mar 9, 2012, at 10:20 PM, Jim Giner wrote:
 tamouse mailing lists tamouse.li...@gmail.com wrote in message 
 news:CAHUC_t8g43GE3xqvSU5SwFePGS1XG=tk1mhrbem9gjaarve...@mail.gmail.com...
 On Mon, Feb 13, 2012 at 2:39 PM, Tedd Sperling tedd.sperl...@gmail.com 
 wrote:
 On Feb 13, 2012, at 4:10 AM, Stuart Dallas wrote:
 On 13 Feb 2012, at 06:28, Rui Hu wrote:
 How PHP sets variables in $_SERVER, say, $DOCUMENT_ROOT? What should I 
 know
 if I want to modify $_SERVER myself?
 
 Once your script starts the superglobals are no different to any other 
 variables, except that they're in scope at all times.
 
 That's probably the reason why they are named SuperGlobals. :-)
 
 But to be more descriptive, these are simply globals that are predefined 
 by php -- see:
 
 http://php.net/manual/en/language.variables.superglobals.php
 
 I believe, (please show me otherwise) there are no globals in PHP other 
 than SuperGlobals.
 
 Assuming you mean pre-defined ones, there shouldn't be, since no other
 ones are documented. If there are, then either they should be
 documented, or they should be ignored as it can be dangerous to use
 undocumented features. :)
 
 Just to be clear - you asked if it were true that there are no globals in 
 PHP other than SuperGlobals:  Don't forget that anything that you declare as 
 global in a script is a global for that instance of that script (and 
 whatever includes, etc. that it calls during its run) 

That's correct, but to access those variables outside of their scope (such as a 
function) you do via a SuperGlobal, namely $GLOBAL['whatever'].

As such, there are no globals in PHP other than SuperGlobals. As I said, if 
I'm wrong, please show me otherwise.

Cheers,

tedd

_
tedd.sperl...@gmail.com
http://sperling.com
---End Message---


php-general Digest 9 Mar 2012 11:25:57 -0000 Issue 7719

2012-03-09 Thread php-general-digest-help

php-general Digest 9 Mar 2012 11:25:57 - Issue 7719

Topics (messages 316940 through 316949):

Re: Function mktime() documentation question
316940 by: Tedd Sperling
316941 by: Daniel Brown
316942 by: Jim Lucas
316943 by: Jim Lucas
316944 by: Jim Lucas
316945 by: Jim Lucas
316946 by: Tedd Sperling
316947 by: Charles
316948 by: Ford, Mike
316949 by: Lester Caine

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---
On Mar 8, 2012, at 11:20 AM, Ford, Mike wrote:
 -Original Message-
 From: Tedd Sperling [mailto:tedd.sperl...@gmail.com]
 From my code, the number of days in a month can be found by using 0
 as the first index of the next month -- not the last day of the
 previous month.
 
 Huh? The 0th day of next month *is* the last day of the current month,
 which gives you the number of days in the current month. QED.
 I think it's possible you may be being confuzled by the number of
 nexts and previouses floating around. Your mktime call is asking for
 the 0th day of next month, i.e. the last day of the previous month of
 next month, i.e. the last day of the current month. Which is exactly
 what you say works. I think. :)
 
 However, I agree that the description is not very well worded - saying
 that days in the requested month are relative to the previous month is
 very odd indeed if you ask me -- if they must be relative to anything,
 why not the beginning of the relevant month? Actually, with a bit more
 thought, I think I'd rewrite it something like this:
 
 The day number relative to the given month. Day numbers 1 to 28, 29,
 30 or 31 (depending on the month) refer to the normal days in the
 month. Numbers less than 1 refer to days in the previous month, so 0
 is the last day of the preceding month, -1 the day before that, etc.
 Numbers greater than the actual number of days in the month refer to
 days in the following month(s).
 

Mike:

Very well put. 

You say:

 Huh? The 0th day of next month *is* the last day of the current month,
 which gives you the number of days in the current month.

That IS exactly what I am saying.

But why does anyone have to use the next month to figure out how many days 
there are are in this month? Do you see my point?

It would have been better if one could use:

$what_date = getdate(mktime(0, 0, 0, $this_month, 0, $year)); 
$days_in_this_month = $what_date['nday']; // note an additional key for 
getdate()

But instead, we have to use:

$next_month = $this_month +1;
$what_date = getdate(mktime(0, 0, 0, $next_month, 0, $year)); 
$days_in_this_month = $what_date['mday'];

Additionally, there's a perception problem. You say that 0 of the next month 
*is* the last day of the current month -- as such, apparently months overlap in 
your (and Dan's) explanation. Well... I agree with both of you, but my 
objection is having to increase the month value by one to get the number of 
days in the current month.

That's all I was saying.

Side-point: I find it interesting that getdate() has all sorts of neat 
descriptions for the current month (such as, what weekday a numbered day is), 
but lacks how many days are in the month. Doesn't that seem odd?

Cheers,

tedd

_
tedd.sperl...@gmail.com
http://sperling.com










---End Message---
---BeginMessage---
On Mar 8, 2012 6:14 PM, Tedd Sperling tedd.sperl...@gmail.com wrote:

 On Mar 8, 2012, at 11:20 AM, Ford, Mike wrote:
  -Original Message-
  From: Tedd Sperling [mailto:tedd.sperl...@gmail.com]
  From my code, the number of days in a month can be found by using 0
  as the first index of the next month -- not the last day of the
  previous month.
 
  Huh? The 0th day of next month *is* the last day of the current month,
  which gives you the number of days in the current month. QED.
  I think it's possible you may be being confuzled by the number of
  nexts and previouses floating around. Your mktime call is asking for
  the 0th day of next month, i.e. the last day of the previous month of
  next month, i.e. the last day of the current month. Which is exactly
  what you say works. I think. :)
 
  However, I agree that the description is not very well worded - saying
  that days in the requested month are relative to the previous month is
  very odd indeed if you ask me -- if they must be relative to anything,
  why not the beginning of the relevant month? Actually, with a bit more
  thought, I think I'd rewrite it something like this:
 
  The day number relative to the given month. Day numbers 1 to 28, 29,
  30 or 31 (depending on the month) refer to the normal days in the
  month. Numbers less than 1 refer to days

php-general Digest 10 Mar 2012 03:20:00 -0000 Issue 7720

2012-03-09 Thread php-general-digest-help

php-general Digest 10 Mar 2012 03:20:00 - Issue 7720

Topics (messages 316950 through 316961):

Re: Function mktime() documentation question
316950 by: Daniel Brown
316951 by: Tedd Sperling
316952 by: Charles
316953 by: Tedd Sperling
316954 by: Charles
316955 by: Andrew Ballard
316956 by: Charles
316957 by: Ashley Sheridan
316958 by: Charles
316959 by: Tedd Sperling

Re: questions about $_SERVER
316960 by: tamouse mailing lists
316961 by: Jim Giner

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---
(To the list, as well.  First day with my new fingers, apparently)

On Fri, Mar 9, 2012 at 08:09, Daniel Brown danbr...@php.net wrote:
 On Thu, Mar 8, 2012 at 21:23, Tedd Sperling tedd.sperl...@gmail.com wrote:

    This starts getting a bit off-topic from your original email, but
 knowing that you're trying to use it for teaching your classes at the
 college, it may be of some value to you.

 All of this aside, though, you may instead want to use something along the 
 lines of date('d',strtotime('last day of this month')); in tandem with your 
 date formatting.

 That's a good idea, but

 date('d',strtotime('last day of this month'));

 gives me the number of days in *this* month, but not the next, or previous, 
 month.

 I need the result to be whatever date was selected -- something like:

 $number_days = date('d',strtotime('last day of April, 2014'));

 But that doesn't work.

    Sure it does, though you may have some issues when using
 punctuation, unnecessary words, or using capital letters for anything
 other than proper names.  What version of PHP are you using?  I get
 the correct answers for all of the following phrases:

        last day of April 2014
        last day of this month
        last day of next month
        last day of last month
        third Saturday March 2012

    Or you can even be excruciatingly redundant:

        echo date('d',strtotime('last day of this
 month',strtotime('next month')));
        echo date('d',strtotime('last day of this
 month',strtotime('February 2018')));
        echo date('d',strtotime('second Monday',strtotime('September 2012')));

 --
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/



-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/
---End Message---
---BeginMessage---
On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote:
 From: Tedd Sperling [mailto:tedd.sperl...@gmail.com]
 But why does anyone have to use the next month to figure out how
 many days there are are in this month? Do you see my point?
 
 Actually, no. To figure this out, somewhere along the line you've
 got to know where the last day of this month / first day of next
 month boundary lies, so I don't see how you can ever find the number
 of days in a month without bringing the start of next month into it
 somehow. (Even if it's implicitly be getting someone else's clever
 code to figure out 'last day of this month'!)

Well no, I don't need to know the first day of next month to know the last day 
of this month. That's like saying I need to know who is going to stand at the 
'end of the line' NEXT before I can tell who is standing at the 'end of the' 
line NOW.

I like things to be self-contained. For the exception of multiverse arguments, 
everything should be self evident.

 But instead, we have to use:
 
 $next_month = $this_month +1;
 $what_date = getdate(mktime(0, 0, 0, $next_month, 0, $year));
 $days_in_this_month = $what_date['mday'];
 
 To me, that's a clever and elegant solution. It's clear that our
 brains just work differently on this one.

We all have differences in perception, how we analyze problems, and how we 
create solutions -- and that's a good thing.

 Side-point: I find it interesting that getdate() has all sorts of
 neat descriptions for the current month (such as, what weekday a
 numbered day is), but lacks how many days are in the month. Doesn't
 that seem odd?
 
 Now that's a decent point: I can see where you're coming from with that
 one. I don't know what performance penalty there might be (if any) to
 calculate that for every call to getdate(), but it certainly seems like
 a reasonable feature request.

I'm glad I have a decent point somewhere in this exchange and that we agree on 
something.  :-)

Cheers,

tedd


_
tedd.sperl...@gmail.com
http://sperling.com






---End Message---
---BeginMessage---
On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling tedd.sperl...@gmail.com wrote:
 On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote:
 From: Tedd Sperling [mailto:tedd.sperl...@gmail.com]
 But why does anyone have

php-general Digest 8 Mar 2012 10:19:15 -0000 Issue 7717

2012-03-08 Thread php-general-digest-help

php-general Digest 8 Mar 2012 10:19:15 - Issue 7717

Topics (messages 316935 through 316938):

Re: Function mktime() documentation question
316935 by: shiplu
316936 by: Simon Schick
316937 by: Charles

eaccelerator and/or magickwand
316938 by: Lester Caine

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---
 To get the number of days for a specific month, I use:

 // $current_month is the month under question

 $next_month = $current_month + 1;

I use this

$next_month = $current_month + 1;
$next_month_1= mktime(0, 0, 0, $next_month, 1, date(Y) );
$current_month_1= mktime(0, 0, 0, $current_month, 1, date(Y) );
$mdays = ($current_month_1 - $next_month_1)/(3600*24);

It's much more easier if you use DateTime and DateInterval class



-- 
Shiplu.Mokadd.im
ImgSign.com | A dynamic signature machine
Innovation distinguishes between follower and leader
---End Message---
---BeginMessage---
Hi, All

To bring a work-around into this discussion I myself would not see it
as a good way to do it like that - even if the documentation provides
some information around that.
Here's what I have done in all new projects I worked with time-calculation:

@Tedd: Lets pick up your first example and work with the
DateTime-Object instead:

$date = new DateTime($year . '-' . $current_month . '-1');
$date-add( new DateInterval( 'P1M' ) ); // Add a period of 1 month to
the date-instance (haven't tried that with the 30th of Jan ... would
be kind-of interesting)

$days_in_current_month = $date-format('j'); // Get the date of the month

As this does not solve the problem (as we still should update the
documentation or the code if it does not match) it's not a solution,
but a suggestion to coding-style at all.
It seems a bit cleaner to me as you don't have to worry about the 13th
month, time-zones or other things that can be difficult to calculate
yourself.

Bye
Simon

2012/3/8 shiplu shiplu@gmail.com:
 To get the number of days for a specific month, I use:

 // $current_month is the month under question

 $next_month = $current_month + 1;

 I use this

 $next_month = $current_month + 1;
 $next_month_1    = mktime(0, 0, 0,     $next_month, 1, date(Y) );
 $current_month_1= mktime(0, 0, 0, $current_month, 1, date(Y) );
 $mdays = ($current_month_1 - $next_month_1)/(3600*24);

 It's much more easier if you use DateTime and DateInterval class



 --
 Shiplu.Mokadd.im
 ImgSign.com | A dynamic signature machine
 Innovation distinguishes between follower and leader
---End Message---
---BeginMessage---
On Thu, Mar 8, 2012 at 7:01 AM, Simon Schick
simonsimc...@googlemail.com wrote:
 $date = new DateTime($year . '-' . $current_month . '-1');
 $date-add( new DateInterval( 'P1M' ) ); // Add a period of 1 month to
 the date-instance (haven't tried that with the 30th of Jan ... would
 be kind-of interesting)

 $days_in_current_month = $date-format('j'); // Get the date of the month

I think you'd need to subtract it with 1 day

date_create(date('Y-m'))-add(new DateInterval('P1M'))-sub(new
DateInterval('P1D'))-format('d');
---End Message---
---BeginMessage---

Anybody got eaccelerator and/or magickwand compiling for PHP5.4?
I've got a nice new machine all set up, and would like to take it straight to 
Apache 2.4.1 and PHP5.4, but I'd also like to keep the same library setup as the 
5.3 setup.


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
---End Message---


php-general Digest 8 Mar 2012 23:12:45 -0000 Issue 7718

2012-03-08 Thread php-general-digest-help

php-general Digest 8 Mar 2012 23:12:45 - Issue 7718

Topics (messages 316939 through 316939):

Re: Function mktime() documentation question
316939 by: Tedd Sperling

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---
On Mar 7, 2012, at 4:28 PM, Daniel Brown wrote:

 On Wed, Mar 7, 2012 at 15:03, Tedd Sperling tedd.sperl...@gmail.com wrote:
 Hi gang:
 
 I am using the getdate(mktime()) functions to get month data (i.e., name of 
 month, first weekday, last day, number of days).
 
 To get the number of days for a specific month, I use:
 
 // $current_month is the month under question
 
 $next_month = $current_month + 1;
 $what_date = getdate(mktime(0, 0, 0, $next_month, 0, $year));
 $days_in_current_month = $what_date['mday'];
 
 That works for me!
 
 However, if you read the documentation, namely:
 
 http://php.net/manual/en/function.mktime.php
 
 It states:
 
 --- quote
 
 day
 
 The number of the day relative to the end of the previous month. Values 1 to 
 28, 29, 30 or 31 (depending upon the month) reference the normal days in the 
 relevant month. Values less than 1 (including negative values) reference the 
 days in the previous month, so 0 is the last day of the previous month, -1 
 is the day before that, etc. Values greater than the number of days in the 
 relevant month reference the appropriate day in the following month(s).
 --- un-quote
 
 From my code, the number of days in a month can be found by using 0 as the 
 first index of the next month -- not the last day of the previous month.
 
I fail to follow.  Your code is looking ahead to next month
 (April), then using the 0 day, which means it's getting the last day
 (31) of the current month (March).  There's no such thing as a 0
 April, hence anything less than one should count backward.
 
 -- 
 /Daniel P. Brown

Daniel:

Yes, it uses next month to figure out this month -- that's my point.

See my reply to Mike Ford.

Cheers,

tedd

_
tedd.sperl...@gmail.com
http://sperling.com



















---End Message---


php-general Digest 7 Mar 2012 21:29:07 -0000 Issue 7716

2012-03-07 Thread php-general-digest-help

php-general Digest 7 Mar 2012 21:29:07 - Issue 7716

Topics (messages 316932 through 316934):

Function mktime() documentation question
316932 by: Tedd Sperling
316933 by: admin
316934 by: Daniel Brown

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---
Hi gang:

I am using the getdate(mktime()) functions to get month data (i.e., name of 
month, first weekday, last day, number of days).

To get the number of days for a specific month, I use:

// $current_month is the month under question

$next_month = $current_month + 1;   
$what_date = getdate(mktime(0, 0, 0, $next_month, 0, $year)); 
$days_in_current_month = $what_date['mday'];

That works for me!

However, if you read the documentation, namely:

http://php.net/manual/en/function.mktime.php

It states:

--- quote

day

The number of the day relative to the end of the previous month. Values 1 to 
28, 29, 30 or 31 (depending upon the month) reference the normal days in the 
relevant month. Values less than 1 (including negative values) reference the 
days in the previous month, so 0 is the last day of the previous month, -1 is 
the day before that, etc. Values greater than the number of days in the 
relevant month reference the appropriate day in the following month(s).
--- un-quote

From my code, the number of days in a month can be found by using 0 as the 
first index of the next month -- not the last day of the previous month.

As such, I would re-write the relevant portion of the paragraph to be:

day

The number of the day relative to the end of the previous month. Values 1 to 
28, 29, 30 or 31 (depending upon the month) reference the normal days in the 
relevant month. Values less than 0 reference the days in the previous month. 
For example, -1 is the day before the first day of the relevant month. The 
value 0 is the zero index of the next month, which is also equal to the last 
day of the relevant month. Values greater than zero are the number of days in 
the relevant month reference the appropriate day in the following month(s).

What say you?

Cheers,

tedd

_
tedd.sperl...@gmail.com
http://sperling.com





---End Message---
---BeginMessage---
Tedd,
This area was always a little grey to me. 
I have used -1 to obtain the previous months for some time now.
0 always indicated the beginning index of the current month but the
explanation never seemed to fit the bill.


Having worked extensively in time manipulation in many of the development
projects I have come up with a rule of thumb.


$this_month = date('Y-m-d 00:00:00',mktime(0,0,0,date('m'),1,date('Y')));
$previous_month = date('Y-m-d
00:00:00',mktime(0,0,0,date('m')-1,1,date('Y')));
$next_month = date('Y-m-d 00:00:00',mktime(0,0,0,date('m')+1,1,date('Y')));

To get the days of any given month or just about anything you need to just
use the strtotime
$days_in_month = date('j',strtotime($this_month));






-Original Message-
From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] 
Sent: Wednesday, March 07, 2012 3:04 PM
To: PHP-General List
Subject: [PHP] Function mktime() documentation question

Hi gang:

I am using the getdate(mktime()) functions to get month data (i.e., name of
month, first weekday, last day, number of days).

To get the number of days for a specific month, I use:

// $current_month is the month under question

$next_month = $current_month + 1;   
$what_date = getdate(mktime(0, 0, 0, $next_month, 0, $year));
$days_in_current_month = $what_date['mday'];

That works for me!

However, if you read the documentation, namely:

http://php.net/manual/en/function.mktime.php

It states:

--- quote

day

The number of the day relative to the end of the previous month. Values 1 to
28, 29, 30 or 31 (depending upon the month) reference the normal days in the
relevant month. Values less than 1 (including negative values) reference the
days in the previous month, so 0 is the last day of the previous month, -1
is the day before that, etc. Values greater than the number of days in the
relevant month reference the appropriate day in the following month(s).
--- un-quote

From my code, the number of days in a month can be found by using 0 as the
first index of the next month -- not the last day of the previous month.

As such, I would re-write the relevant portion of the paragraph to be:

day

The number of the day relative to the end of the previous month. Values 1 to
28, 29, 30 or 31 (depending upon the month) reference the normal days in the
relevant month. Values less than 0 reference the days in the previous month.
For example, -1 is the day before the first day of the relevant month. The
value 0 is the zero index

php-general Digest 5 Mar 2012 19:11:46 -0000 Issue 7713

2012-03-05 Thread php-general-digest-help

php-general Digest 5 Mar 2012 19:11:46 - Issue 7713

Topics (messages 316877 through 316913):

'?=' with PHP5.3.10
316877 by: Lester Caine
316878 by: Ashley Sheridan
316879 by: Lester Caine
316880 by: Alejandro Michelin Salomon
316911 by: Marc ct
316913 by: Lester Caine

Нужны памперсы
316881 by: Deti

PHP passthru() blocks with bash process replacement?
316882 by: Sander Marechal

Re: MySQL over TCP results on CLOSE_WAIT state in PHP 5.3.8
316883 by: php-list.dubistmeinheld.de

Converting an unordered list into JSON
316884 by: Jay Blanchard
316885 by: Stuart Dallas
316886 by: Jay Blanchard
316887 by: Stuart Dallas
316888 by: Jay Blanchard
316889 by: Stuart Dallas
316890 by: Jim Giner
316891 by: Jay Blanchard
316892 by: Jay Blanchard
316893 by: Stuart Dallas
316894 by: Jay Blanchard

iphone  php
316895 by: Jim Giner
316896 by: Stuart Dallas
316897 by: Jim Giner
316898 by: Mike Mackintosh
316899 by: Jay Blanchard
316900 by: Jim Giner
316901 by: Mike Mackintosh
316902 by: Mari Masuda
316903 by: Jim Giner
316904 by: Jim Giner
316905 by: Ashley Sheridan
316906 by: Jim Giner
316907 by: Stuart Dallas
316908 by: Jim Giner
316909 by: Jim Giner
316910 by: Marc Guay
316912 by: Jim Giner

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---
I am presuming that one of my customers hosts has upgraded to PHP5.3.10 over the 
weekend, and now the site is broken! It is currently codeignighter based, 
something which I am in the process of replacing anyway, but I need to get 
http://eveshamselfdrive.co.uk/ working again as it was last week. At this stage 
I am only assuming that the '?=' is the problem, but it certainly looks like 
that and I'm not sure you can change short_open_tag with set_ini ? It certainly 
has not worked adding that ... Help


( I'm in the process of moving these sites to one of my own machines, but that 
is a few weeks away )


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
---End Message---
---BeginMessage---


Lester Caine les...@lsces.co.uk wrote:

I am presuming that one of my customers hosts has upgraded to PHP5.3.10
over the
weekend, and now the site is broken! It is currently codeignighter
based,
something which I am in the process of replacing anyway, but I need to
get
http://eveshamselfdrive.co.uk/ working again as it was last week. At
this stage
I am only assuming that the '?=' is the problem, but it certainly
looks like
that and I'm not sure you can change short_open_tag with set_ini ? It
certainly
has not worked adding that ... Help

( I'm in the process of moving these sites to one of my own machines,
but that
is a few weeks away )

--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

You can't set it from ini_set(), see http://nl3.php.net/manual/en/ini.list.php 
and the link in there to the mode values as to what you can/not change and why.

You can set it in php.ini itself, or possibly from .htaccess. failing that, 
find/replace on the old short echo tags would do it.

Thanks,
Ash
http://ashleysheridan.co.uk
---End Message---
---BeginMessage---

Ashley Sheridan wrote:

You can set it in php.ini itself, or possibly from .htaccess. failing that, 
find/replace on the old short echo tags would do it.


But I thought that '?=' was SUPPOSED to have been protected? When did that 
change ...


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
---End Message---
---BeginMessage---
Leste Wrote:

-Mensagem original-
De: Lester Caine [mailto:les...@lsces.co.uk] 
Enviada em: segunda-feira, 5 de março de 2012 08:18
Para: php-gene...@lists.php.net
Assunto: Re: [PHP

php-general Digest 5 Mar 2012 07:03:40 -0000 Issue 7712

2012-03-04 Thread php-general-digest-help

php-general Digest 5 Mar 2012 07:03:40 - Issue 7712

Topics (messages 316865 through 316876):

Re: Weird Behaviour of Array
316865 by: Ashley Sheridan
316866 by: Stuart Dallas

Script execution after window close
316867 by: Nibin V M
316868 by: Ashley Sheridan
316869 by: Nibin V M
316870 by: Govinda
316871 by: Stuart Dallas
316872 by: Nibin V M
316873 by: Govinda
316874 by: Ashley Sheridan
316875 by: Nibin V M

Questionnaire on motivation analysis of free open source software and open 
content (final version
316876 by: George Tsinarakis

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---
On Sun, 2012-03-04 at 20:01 +0530, Ruwan Pathmalal wrote:

 Hi People,
 I confused with weird behaviour of array. Following is my script.
 
 ?php
 $array = array(
 '12_1'=array(
 56=array(
 23='23',
 33='33')
 ),
 '12_5'=array(
 55='55'
 )
 );
 
 $array['12_5'][55][45] = '45';
 $array['12_5'][55][56] = '76';
 $array['12_5'][55][85] = '85';
 $array['12_5'][55][96] = '96';
 print_r($array);
 ?
 
 Output is -:
 Array ( [12_1] = Array ( [56] = Array ( [23] = 23 [33] = 33 ) ) [12_5]
 = Array ( [55] = 55 4 7 8 9 ) )
 
 Sometime this is because, first time $array['12_5'][55] not an array. I
 assigned value to it like array. (I suppose overwrite key and then assign
 given value as key value pair). See this part of output [12_5] = Array (
 [55] = 55 4 7 8 9 ). It compose 4 from 45, 7 from 76, 8 from 85 like that
 (first digit of assigned values).
 
 I manage to overcome this problem by unsettling  $array['12_5'][55] before
 assigning value to it.
 
 But I want to know why this happening or is this PHP bug ? (Clear
 explanation for situation :) )
 
 Thanks
 Ruwan


I think because $array['12_5'][55] is originally a string, and PHP
allows you to treat them as arrays of characters (like C++) what is
happening is some odd setting of values within the string. This is why
when you unset the value or define it as a blank array it is working as
expected.

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk


---End Message---
---BeginMessage---
On 4 Mar 2012, at 14:31, Ruwan Pathmalal wrote:

 I confused with weird behaviour of array. Following is my script.
 
 ?php
 $array = array(
'12_1'=array(
56=array(
23='23',
33='33')
),
'12_5'=array(
55='55'
)
);
 
 $array['12_5'][55][45] = '45';
 $array['12_5'][55][56] = '76';
 $array['12_5'][55][85] = '85';
 $array['12_5'][55][96] = '96';
 print_r($array);
 ?
 
 Output is -:
 Array ( [12_1] = Array ( [56] = Array ( [23] = 23 [33] = 33 ) ) [12_5]
 = Array ( [55] = 55 4 7 8 9 ) )
 
 Sometime this is because, first time $array['12_5'][55] not an array. I
 assigned value to it like array. (I suppose overwrite key and then assign
 given value as key value pair). See this part of output [12_5] = Array (
 [55] = 55 4 7 8 9 ). It compose 4 from 45, 7 from 76, 8 from 85 like that
 (first digit of assigned values).
 
 I manage to overcome this problem by unsettling  $array['12_5'][55] before
 assigning value to it.
 
 But I want to know why this happening or is this PHP bug ? (Clear
 explanation for situation :) )

Not a bug. You set $array['12_5'][55] to a string, then you try to use it as an 
array. Strings can be accessed as arrays.

 $array['12_5'][55][45] = '45';

This line sets the 45th character in the string to 4 (each element of a string 
accessed as an array can only contain a single character, so it throws the 5 
away).

 $array['12_5'][55][56] = '76';
 $array['12_5'][55][85] = '85';
 $array['12_5'][55][96] = '96';

Likewise with these. You're not seeing the additional spaces because you're 
viewing it as an HTML page. Run it on the command line or add pre before the 
?php to see the actual value, which is...

55   4  7  
  8  9

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/---End Message---
---BeginMessage---
Hello,

I need to run a few commands when a user close the browser tab. That is, I
have a php page ( index.php ) and it will create a temporary file to track
some stuffs. That temporary file should be removed, when the user close the
browser tab. Is there any way to achieve this?

Thank you,

-- 
Regards

Nibin.

http://TechsWare.in
---End Message---
---BeginMessage---
On Sun, 2012-03-04 at 20:49 +0530

php-general Digest 2 Mar 2012 19:03:00 -0000 Issue 7710

2012-03-02 Thread php-general-digest-help

php-general Digest 2 Mar 2012 19:03:00 - Issue 7710

Topics (messages 316834 through 316850):

Re: Nested database loops and completing an unordered list
316834 by: Jay Blanchard
316840 by: Jim Lucas
316842 by: Bastien Koert
316843 by: Jay Blanchard
316849 by: Jay Blanchard
316850 by: Jim Lucas

curl equivalent in PHP
316835 by: Nibin V M
316836 by: Marc Guay
316837 by: Nibin V M
316838 by: Nibin V M
316839 by: FeIn
316841 by: Jim Lucas
316844 by: Nibin V M
316845 by: Micky Hulse
316846 by: Daniel Brown
316848 by: Nibin V M

problem about PHP-FPM in TCP socket and Unix socket
316847 by: Yuchen Wang

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---
 My usual approach to a problem like this to to includes a parent column in 
 the table
 
 ID (int pk)
 Parent ( default null ) // no parent
 Item
 Itemtype
 [etc]
 
 Parent will then hold either a null if a top level item, or a structured path 
 ( 1/10/24 ) that notes the parents of the item all the way up to the parent. 
 That way, a single query will get you all items in that parent's lineage to 
 whatever depth is needed by using the child's value
 
 Select * from table where parent = '1/10' 
 
 Would retrieve all items that are children of a top level of 1 and a second 
 level of 10

I would do that under normal circumstance but I cannot modify the client's 
table in any way shape or form. I am considering the COMPANY_ID to be the 
parent at this point and I can get all who belong to a company. I just need to 
turn that lineage into a tree.---End Message---
---BeginMessage---

On 03/01/2012 06:20 PM, Jay Blanchard wrote:

[snip]
Can you show the output of the function above?
[/snip]




Doesn't this SQL query return everything that has company_id set to 3 
which would it not contain all the data from the other queries combined 
into one large data set?


At this point, I don't believe you have shown your output.  Please show 
the output of your function.



0
SELECT DISTINCT `TIER1DATA` FROM `POSITION_SETUP` WHERE `COMPANY_ID` = '3'
Executives and Management

Normally this query alone returns 9 rows of data. Each of these rows should be 
included in the next query where TIER1DATA = each of the nine in succession

1
SELECT DISTINCT `TIER2DATA` FROM `POSITION_SETUP` WHERE `COMPANY_ID` = '3' AND 
`TIER1DATA` = 'Executives and Management'
  Executives and ManagementLeadership
2
SELECT DISTINCT `TIER3DATA` FROM `POSITION_SETUP` WHERE `COMPANY_ID` = '3' AND 
`TIER2DATA` = 'Executives and ManagementLeadership'
   Executives and ManagementLeadershipManager
3
SELECT DISTINCT `BUSTIER1DATA` FROM `POSITION_SETUP` WHERE `COMPANY_ID` = '3' 
AND `TIER3DATA` = 'Executives and ManagementLeadershipManager'
Knee
4
SELECT DISTINCT `BUSTIER2DATA` FROM `POSITION_SETUP` WHERE `COMPANY_ID` = '3' 
AND `BUSTIER1DATA` = 'Knee'
 KneeDIV01
5
SELECT DISTINCT `BUSTIER3DATA` FROM `POSITION_SETUP` WHERE `COMPANY_ID` = '3' 
AND `BUSTIER2DATA` = 'KneeDIV01'
  KneeDIV01DEPT02
6
SELECT DISTINCT `BUSTIER4DATA` FROM `POSITION_SETUP` WHERE `COMPANY_ID` = '3' 
AND `BUSTIER3DATA` = 'KneeDIV01DEPT02'
   KneeDIV01DEPT02GRP04
7
SELECT DISTINCT `` FROM `POSITION_SETUP` WHERE `COMPANY_ID` = '3' AND 
`BUSTIER4DATA` = 'KneeDIV01DEPT02GRP04'
1054Unknown column '' in 'field list'



--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/
---End Message---
---BeginMessage---
On Fri, Mar 2, 2012 at 7:43 AM, Jay Blanchard
jay.blanch...@sigmaphinothing.org wrote:
 My usual approach to a problem like this to to includes a parent column in 
 the table

 ID (int pk)
 Parent ( default null ) // no parent
 Item
 Itemtype
 [etc]

 Parent will then hold either a null if a top level item, or a structured 
 path ( 1/10/24 ) that notes the parents of the item all the way up to the 
 parent. That way, a single query will get you all items in that parent's 
 lineage to whatever depth is needed by using the child's value

 Select * from table where parent = '1/10'

 Would retrieve all items that are children of a top level of 1 and a second 
 level of 10

 I would do that under normal circumstance but I cannot modify the client's 
 table in any way shape or form. I am considering the COMPANY_ID to be the 
 parent at this point and I can get all who belong to a company. I just need 
 to turn that lineage into a tree.


Would they let you make a copy or a join table where you could build
what you need? Then maybe add a stored proc to move data as needed
-- 

Bastien

Cat, the other other white meat
---End Message

php-general Digest 1 Mar 2012 15:09:02 -0000 Issue 7708

2012-03-01 Thread php-general-digest-help

php-general Digest 1 Mar 2012 15:09:02 - Issue 7708

Topics (messages 316816 through 316821):

time/task reporting
316816 by: Robert Nilsson
316817 by: Fatih P.
316818 by: Stuart Dallas

Re: Website preview script
316819 by: Stuart Dallas

Nested database loops and completing an unordered list
316820 by: Jay Blanchard
316821 by: FeIn

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---
Hi,
 Ok, I admit -I'm lazy!
 Been asked to make a reporting tool, what and how many hours spent on
 Possible with a save option, to enable continuously adding during the week, 
before sending off by mail to manager and one self.

 Surely I'm not the first person looking at a similar tool, been searching a 
bit but not found example code to use for adjustment to suite my group needs.

 Anyone care to share or point me to a site where I can find this?

 Thanks
---End Message---
---BeginMessage---
On Thu, Mar 1, 2012 at 10:43 AM, Robert Nilsson rob...@myself.com wrote:

 Hi,
  Ok, I admit -I'm lazy!
  Been asked to make a reporting tool, what and how many hours spent on
  Possible with a save option, to enable continuously adding during the
 week, before sending off by mail to manager and one self.

  Surely I'm not the first person looking at a similar tool, been searching
 a bit but not found example code to use for adjustment to suite my group
 needs.

  Anyone care to share or point me to a site where I can find this?

  Thanks


hey, there is something called project hamster for gnome. might give you an
idea:

http://live.gnome.org/ProjectHamster
http://projecthamster.wordpress.com/
https://launchpad.net/hamster-applet
---End Message---
---BeginMessage---
On 1 Mar 2012, at 08:43, Robert Nilsson wrote:

 Ok, I admit -I'm lazy!
 Been asked to make a reporting tool, what and how many hours spent on
 Possible with a save option, to enable continuously adding during the week, 
 before sending off by mail to manager and one self.
 
 Surely I'm not the first person looking at a similar tool, been searching a 
 bit but not found example code to use for adjustment to suite my group needs.
 
 Anyone care to share or point me to a site where I can find this?

This wheel has been invented many times already. Save yourself some time and 
money and use an existing service: 
http://www.google.com/search?q=online+time+tracking

Add up what your time will cost to develop a solution, double it because your 
estimate will almost certainly be too low, then double it again to cover 
maintenance for the first year, and compare that figure to what a SaaS solution 
will cost for one year. Unless your requirements are sufficiently different to 
that which already exists, or you want to develop this as a learning 
experience, grab a wheel off the shelf.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/---End Message---
---BeginMessage---
On 1 Mar 2012, at 03:06, Nibin V M wrote:

 But what my requirement here is, I need to display the website configured
 on our server. No matter where the domain actually points to :)
 
 Perhaps it can call a proxyhere is the actual intention of creating
 this script.
 
 Suppose X created a new website on serverA, but the domain actually
 pointing to ServerB. So to test his new website on ServerA, he either has
 to edit hosts file or use serverA/~user. I don't want him not to use
 either method. I would like to provide him a PHP feature on my control
 panel says site preview through which he can view his website on serverA.
 Its just like a website preview option in plesk control panel :)


I think you're looking at this problem from completely the wrong angle. Why 
does the preview need to sit under their domain name? If that's really what you 
want then you have no option but to do something very very clunky with their 
hosts file, or take over their DNS lookup which is just pure evil and will have 
huge side effects and security implications.

Why can't you simply set the virtual host for their site so it responds to two 
domain names. Firstly their actual domain name, and secondly something like 
theirdomain.com.preview.techsware.in (this would be *.preview.techsware.in in 
your zone file). That way they just need to visit 
http://theirdomain.com.preview.techsware.in/ and they'll see their website.

Simples.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
---End Message---
---BeginMessage---

Good morning PHP groupies!

I am working on this tool that will ultimately display a collapsible org 
chart. The org chart is based on a nested unordered list and that is the 
heart of my question.


The NUL(nested unordered list) is based on a set

php-general Digest 2 Mar 2012 05:24:20 -0000 Issue 7709

2012-03-01 Thread php-general-digest-help

php-general Digest 2 Mar 2012 05:24:20 - Issue 7709

Topics (messages 316822 through 316833):

Re: Nested database loops and completing an unordered list
316822 by: FeIn
316823 by: Tommy Pham
316824 by: Jay Blanchard
316825 by: Jay Blanchard
316827 by: Jay Blanchard
316828 by: Jay Blanchard
316829 by: Jim Lucas
316830 by: Tommy Pham
316831 by: Jay Blanchard
316832 by: Jay Blanchard
316833 by: Bastien

PHP 5.4.0 released!
316826 by: David Soria Parra

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---
And see also this, which focuses only on the database part of the problem:
http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/

On Thu, Mar 1, 2012 at 5:08 PM, FeIn aci...@gmail.com wrote:

 I don't how how you keep your data in your database but there is no need
 to issues that many queries to retrieve your data. From what I understand
 the data you want to display is hierarchical. Here's an article that will
 hopefully point you to a solution (there are more out there, some better
 than other, google mysql hierchical data or database hierarchical data).
 The article I was talking about is here:
 http://www.sitepoint.com/hierarchical-data-database/




 On Thu, Mar 1, 2012 at 4:29 PM, Jay Blanchard 
 jay.blanch...@sigmaphinothing.org wrote:

 Good morning PHP groupies!

 I am working on this tool that will ultimately display a collapsible org
 chart. The org chart is based on a nested unordered list and that is the
 heart of my question.

 The NUL(nested unordered list) is based on a set of database queries -
 sometimes as many as 14 queries. Each query relies on data returned by all
 of the the queries before it. So what I am doing right now is this -

 query generates a list item
while this list item get the next level dependent upon this item
query generates this list item
while this list item get the next level dependent on each
 list item above

 ...and so on. (I have written about this before and thought I had it
 solved, but alas, that is not the case.) The result needs to be something
 like this:

 ul
 lilevel a
 ul
 lilevel b/li // has no children
 lilevel b
 ul
 lilevel c/li
 /ul
 /li
 /ul
 /li
 /ul

 This is a semantically and syntacticallycorrect UL. Keep in mind that
 this can go many levels deeper. The hardest part, and the part that I am
 looking to accomplish, is closing the list items properly regardless of how
 deep the tree is. If properly handled this could even be made into JSON
 with the proper syntax, but I am not worried about that now. I was hoping
 that a fresh set of eyes would point me to a solution that I obviously
 cannot see at the moment.

 Thanks!

 Jay

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



---End Message---
---BeginMessage---
On Thu, Mar 1, 2012 at 6:29 AM, Jay Blanchard
jay.blanch...@sigmaphinothing.org wrote:
 Good morning PHP groupies!

 I am working on this tool that will ultimately display a collapsible org
 chart. The org chart is based on a nested unordered list and that is the
 heart of my question.

 The NUL(nested unordered list) is based on a set of database queries -
 sometimes as many as 14 queries. Each query relies on data returned by all
 of the the queries before it. So what I am doing right now is this -

 query generates a list item
    while this list item get the next level dependent upon this item
        query generates this list item
                while this list item get the next level dependent on each
 list item above

 ...and so on. (I have written about this before and thought I had it solved,
 but alas, that is not the case.) The result needs to be something like this:

 ul
 lilevel a
 ul
 lilevel b/li // has no children
 lilevel b
 ul
 lilevel c/li
 /ul
 /li
 /ul
 /li
 /ul

 This is a semantically and syntacticallycorrect UL. Keep in mind that this
 can go many levels deeper. The hardest part, and the part that I am looking
 to accomplish, is closing the list items properly regardless of how deep the
 tree is. If properly handled this could even be made into JSON with the
 proper syntax, but I am not worried about that now. I was hoping that a
 fresh set of eyes would point me to a solution that I obviously cannot see
 at the moment.

 Thanks!

 Jay


Your situation sounds like list of categories for a e-commerce site.
Each category (like a person) is unique and may have a parent category
(boss) like that of a CEO.

** table structure:

CREATE TABLE IF NOT EXIST employees (
employeeID INT NOT NULL PRIMARY KEY,
bossID INT NOT NULL

php-general Digest 29 Feb 2012 08:29:07 -0000 Issue 7706

2012-02-29 Thread php-general-digest-help

php-general Digest 29 Feb 2012 08:29:07 - Issue 7706

Topics (messages 316789 through 316797):

Re: Insert new array after specific key in multidimensional array
316789 by: Micky Hulse
316790 by: Adam Richardson
316791 by: Micky Hulse

How do I enable more useful PHP error logging?
316792 by: Daevid Vincent
316793 by: Adam Richardson
316794 by: Stuart Dallas
316795 by: Daevid Vincent
316796 by: Tommy Pham
316797 by: Simon Schick

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---
On Tue, Feb 28, 2012 at 8:36 AM, Shawn McKenzie nos...@mckenzies.net wrote:
 Might be an easier way but this should work.  You can sort the $before =
 true out for yourself :-)

Hi Shawn, I've updated your function to do the $before bit:

https://gist.github.com/1928452#file_array_insert.php

I also set it up to merge the new array to the end if the key does not exist.

Out of all the examples I have found, your approach looks the cleanest
and the most compact.

I'm open to feedback.

Many thanks

Cheers,
M
---End Message---
---BeginMessage---
On Mon, Feb 27, 2012 at 9:12 PM, Micky Hulse mickyhulse.li...@gmail.comwrote:

 Howdy!

 Example code:

 https://gist.github.com/1928452

 What would be the best way to insert $o_insert array into $o array
 after specified key?

 I hate to just ask for example code, but I can't seem to find the
 perfect solution. :(

 Many thanks in advance for the help!

 Cheers,
 Micky

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


Out of curiosity, why are you worried about the order of elements in an
associative array?

Thanks,

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com
---End Message---
---BeginMessage---
Hi Adam!

On Tue, Feb 28, 2012 at 2:05 PM, Adam Richardson simples...@gmail.com wrote:
 What would be the best way to insert $o_insert array into $o array
 after specified key?

Great question. :D

Quick answer: It's a Wordpress thang!

Long answer: I am working with WordPress and the theme that I am using
stores all of its settings in a multidimensional array... The WP admin
displays the contents of the array as a GUI and the order of the array
is what dictates the display order.
---End Message---
---BeginMessage---
My question is, is there a way to enable some PHP configuration that would
output more verbose information, such as a backtrace or the URL attempted?

In our PHP error log, we have the usual semi-useful information. However
this is only a partial story as it's hard to re-create the URL that caused
the error. In the first Actor example, yeah actor_id 2206 doesn't exist and
so now I have put a try/catch on all pages that have new Actor($actor_id)
but it doesn't tell me WHY this is happening. How did someone get to this
point? I doubt they just randomly picked '2206' which happens to be one of
only a handful of actually missing actors out of 100k. Sure I guess it could
be a bot that sequentially tried them all, but this is not likely since we
have SEO style URLs and so we re-map an actor name back to the ID. So the
bot would have to try NAMEs not IDs. This means we must have some link
somewhere that points to this. Same with the common foreach() warnings
below. Yeah, the array being passed is empty/null. Sure I can check the
array before doing the foreach() or even @foreach() but that doesn't tell me
the root cause. What video are they trying to access that has no scenes or
invalid actors?

We do NOT have apache logging turned on as we get 30,000 hits per second and
it would be too expensive. I only care about PHP errors like this. And the
apache error log (which we do have enabled) doesn't have useful info related
to these kinds of issues as they're really not apache's problem. That log
only deals with missing files/images/pages/etc.

[28-Feb-2012 13:43:19 UTC] PHP Fatal error:  Uncaught exception 
'ObjectNotFound' with message 'There is no such object Actor [2206].' in 
/home/SHARED/classes/base.class.php:103
Stack trace:
#0 /home/SHARED/classes/actor.class.php(61): Base-load_from_sql()
#1 /home/m.videosz.com/browse_scenes.php(89): Actor-__construct(2206)
#2 {main}
   thrown in /home/SHARED/classes/base.class.php on line 103

[28-Feb-2012 10:54:01 UTC] PHP Warning:  Invalid argument supplied for 
foreach() in /home/m.dev.com/scene.php on line 138

[28-Feb-2012 07:22:50 UTC] PHP Warning:  Invalid argument supplied for 
foreach() in /home/SHARED/classes/scene.class.php on line 423


---End Message---
---BeginMessage---
On Tue, Feb 28, 2012 at 6:14 PM, Daevid Vincent dae...@daevid.com wrote

php-general Digest 1 Mar 2012 03:06:24 -0000 Issue 7707

2012-02-29 Thread php-general-digest-help

php-general Digest 1 Mar 2012 03:06:24 - Issue 7707

Topics (messages 316798 through 316815):

Roller - A High Performance Router for PHP5.3 and PHP5.4
316798 by: Lin Yo-An

Custom PHP extension: Invalid library (maybe not a PHP library)
316799 by: S³awomir Zborowski
316802 by: Matijn Woudt
316803 by: S³awomir Zborowski

Custom PHP extension - Invalid library (maybe not a PHP library)
316800 by: S³awomir Zborowski

Re: How do I enable more useful PHP error logging?
316801 by: Stuart Dallas

Little Info...
316804 by: Don Wieland
316805 by: Daniel Brown
316807 by: Matijn Woudt
316809 by: Ashley Sheridan

Website preview script
316806 by: Nibin V M
316808 by: Matijn Woudt
316810 by: Ashley Sheridan
316811 by: Nibin V M
316812 by: Simon Schick
316813 by: Ashley Sheridan
316814 by: Simon Schick
316815 by: Nibin V M

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---
Hi folks,

we have working on a PHP router project for a while, now we have a final
stable release for this.

Roller - high performance router for PHP5.3+
https://github.com/c9s/Roller

And we wrote an extension for dispatching routes, by using this extension,
the dispatch performance is faster 1607% than original PHP version.
(extension is optional).

RESTful support, you can easily define RESTful paths for records.

Features:

   - Highly customizable
   - Flexible
   - APC cache support.
   - File cache support.
   - Built-in *RESTful* route generator, resource handler.
   - Customizable RESTful route generator, resource handler.
   - Simple, Useful route path syntax. (rails-style)
   - High performance (through PHP extension, can dispatch *1607%* faster
   than pure php version)
   - High unit test coverage, coverage  *88%*.




-- 
Best Regards,

c9s@github

- Onion project (PHP package builder): http://github.com/c9s/Onion
---End Message---
---BeginMessage---
Hi all!

I'm interested in creating a custom PHP extension. I have found
several so called tutorials,
but the code examples they contain do not work for me.

Let's stick to this site:
http://devzone.zend.com/303/extension-writing-part-i-introduction-to-php-and-zend/
Basing on it I have following sources:


# config.m4:
PHP_ARG_ENABLE(hello2,whether to enable hello2 support,
[  --enable-hello2Enable hello2 support])

if test $PHP_HELLO2 = yes; then
  AC_DEFINE(HAVE_HELLO2,1,[Whether you want hello2 support])
  PHP_NEW_EXTENSION(hello2, php_hello2.c, $ext_shared)
fi
#


# php_hello2.h:
#ifndef PHP_HELLO2_H
#define PHP_HELLO2_H 1
#define PHP_HELLO_WORLD_VERSION 1.0
#define PHP_HELLO_WORLD_EXTNAME hello2

PHP_FUNCTION(hello_world);

extern zend_module_entry hello2_module_entry;
#define phpext_hello2_ptr hello2_module_entry

#endif
#


# php_hello2.c:
#ifdef HAVE_CONFIG_H
#include config.h
#endif
#include php.h
#include php_hello2.h

static function_entry hello2_functions[] = {
PHP_FE(hello_world, NULL)
{NULL, NULL, NULL}
};

zend_module_entry hello2_module_entry = {
#if ZEND_MODULE_API_NO = 20010901
STANDARD_MODULE_HEADER,
#endif
PHP_HELLO_WORLD_EXTNAME,
hello2_functions,
NULL, NULL, NULL, NULL, NULL,
#if ZEND_MODULE_API_NO = 20010901
PHP_HELLO_WORLD_VERSION,
#endif
STANDARD_MODULE_PROPERTIES
};

#ifdef COMPILE_DL_HELLO2
ZEND_GET_MODULE(hello2)
#endif

PHP_FUNCTION(hello_world)
{
RETURN_STRING(Hello World, 1);
}
#

The code compiles well with these commands:
$ ./configure --enable-hello2
$ make -j5
# make install

But after I execute the command:
$ php5 -dextension=hello2.so -v
I get the following output.

PHP Warning:  PHP Startup: Invalid library (maybe not a PHP library)
'hello2.so' in Unknown on line 0

What I am missing here? Can someone help me?
Thanks in advance.

Kind Regards,
Sławomir
---End Message---
---BeginMessage---

 The code compiles well with these commands:
 $ ./configure --enable-hello2
 $ make -j5
 # make install


It's a long time since I built PHP extensions, but aren't you supposed
to run phpize before configure?

 But after I execute the command:
 $ php5 -dextension=hello2.so -v
 I get the following output.

 PHP Warning:  PHP Startup: Invalid library (maybe not a PHP library)
 'hello2.so' in Unknown on line 0

 What I am missing here? Can someone help me?
 Thanks in advance.

Have you tried google?
I found this comment on the PHP sites[1], and it says that the module
didn't work when copied into the apache directory, but make install

php-general Digest 28 Feb 2012 16:36:34 -0000 Issue 7705

2012-02-28 Thread php-general-digest-help

php-general Digest 28 Feb 2012 16:36:34 - Issue 7705

Topics (messages 316783 through 316788):

Re: Insert new array after specific key in multidimensional array
316783 by: Eray Alakese
316785 by: Micky Hulse
316786 by: xucheng
316787 by: Micky Hulse
316788 by: Shawn McKenzie

Re: MySQL over TCP results on CLOSE_WAIT state in PHP 5.3.8
316784 by: Tommy Pham

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---
$newarray = array() ;
foreach($o as $key = $val)
{
 if($prevkey != 'specifickey') {
 $prevkey = $key;
 $newarray[$key] = $val;
 }
 else
 $newarray[] = $o_insert;
}

i think this would help you.  i can't test it,  I'm sending this from
mobile phone :-)

Eray Alakese
28 Şub 2012 04:13 tarihinde Micky Hulse mickyhulse.li...@gmail.com
yazdı:

 Howdy!

 Example code:

 https://gist.github.com/1928452

 What would be the best way to insert $o_insert array into $o array
 after specified key?

 I hate to just ask for example code, but I can't seem to find the
 perfect solution. :(

 Many thanks in advance for the help!

 Cheers,
 Micky

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


---End Message---
---BeginMessage---
Thank you Eray! That's a cool approach. Testing code now. I will be
back with my results. :)

Thank you!!!

Cheers,
M
---End Message---
---BeginMessage---
Maybe you can trans the array into a xml tree , then modify its leaves .

RTFSC - Read The F**king Source Code :)!


2012/2/28 Micky Hulse mickyhulse.li...@gmail.com

 Thank you Eray! That's a cool approach. Testing code now. I will be
 back with my results. :)

 Thank you!!!

 Cheers,
 M

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


---End Message---
---BeginMessage---
Hi Xucheng,

On Mon, Feb 27, 2012 at 7:41 PM, xucheng helloworldje...@gmail.com wrote:
 Maybe you can trans the array into a xml tree , then modify its leaves .

Now that sounds like an interesting idea... I will have to research
that as an option. Thanks for tip! :)

@Eray,

I was not able to get your code to work on my array... After working
with it a little bit, I realized your idea was very similar to these
others that I have found (great minds think alike):

http://eosrei.net/articles/2011/11/php-arrayinsertafter-arrayinsertbefore
http://drupal.org/node/66183

Your suggestion, and the ones above, work great if I break out the
key, pass it directly, then add the key back to the original array.

I have updated my gist and also put the code here:

http://codepad.org/IY0y9Oy6

Could things be optimized, or is this an acceptable solution?

Thanks!

Cheers,
Micky
---End Message---
---BeginMessage---
On 02/27/2012 08:12 PM, Micky Hulse wrote:
 Howdy!
 
 Example code:
 
 https://gist.github.com/1928452
 
 What would be the best way to insert $o_insert array into $o array
 after specified key?
 
 I hate to just ask for example code, but I can't seem to find the
 perfect solution. :(
 
 Many thanks in advance for the help!
 
 Cheers,
 Micky


Might be an easier way but this should work.  You can sort the $before =
true out for yourself :-)

function array_insert($array, $key, $insert, $before = FALSE) {
$i = 0;
foreach($array as $k = $v) {
  if($k === $key) {
$p = $i + 1;
break;
  }
  $i++;
}
$array = array_merge(array_slice($array, 0, $p), $insert,
array_slice($array, $p, count($array) - $p));
}

-- 
Thanks!
-Shawn
http://www.spidean.com
---End Message---
---BeginMessage---
On Mon, Feb 27, 2012 at 4:06 AM,  php-l...@dubistmeinheld.de wrote:
 Hi,

 I have a MySQL server A, a server B with PHP 5.3.8 and a server C with PHP
 5.3.3. I'm connecting to the MySQL server on A via TCP from B and C using an
 internal network. Server B and C use the same PHP application. There are also
 same PHP scripts that get data from the database and then calculate up to 30
 minutes. I close all database connection before doing the calculation to save
 connections (and ports) using:
 $thread_id = mysqli_thread_id( $this-handle );
 mysqli_kill(  $this-handle, $thread_id );
 mysqli_close( $this-handle );

 During a review on our servers I discovered that server B has a lot of network
 connection in the state CLOSE_WAIT. Server C running the same PHP
 application has not. I see the difference that server B is using mysqlnd and
 server C not.

 serverB# netstat -an | grep 3306
 tcp        1      0 10.8.0.58:47455         10.8.0.1:3306           CLOSE_WAIT

 serverA# cat firewall
 Feb 17 16:21:49 www kernel: [6587053.325075] SFW2-OUT-ERROR IN= OUT=tun0
 SRC=10.8.0.1 DST

php-general Digest 25 Feb 2012 20:07:00 -0000 Issue 7702

2012-02-25 Thread php-general-digest-help

php-general Digest 25 Feb 2012 20:07:00 - Issue 7702

Topics (messages 316779 through 316780):

Windows Apache 2.4.1 handlers available for 5.2, 5.3 and 5.4
316779 by: Steffen

Great video by Bret Victor: Inventing on Principle
316780 by: Adam Richardson

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---
The Apache 2.4 modules php5apache2_4.dll for PHP 5.2, 5.3 and 5.4 are available 
at:

http://www.apachelounge.com/

Steffen

---End Message---
---BeginMessage---
Saw this on the Clojure list and thought it was worth sharing here, too:
http://vimeo.com/36579366

Worth the hour of time to watch it, as it has some great ideas for
improving the experience of developers.

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com
---End Message---


php-general Digest 23 Feb 2012 09:15:52 -0000 Issue 7699

2012-02-23 Thread php-general-digest-help

php-general Digest 23 Feb 2012 09:15:52 - Issue 7699

Topics (messages 316760 through 316763):

Re: SimpleXML and the Single String (SOLVED)
316760 by: Jay Blanchard
316761 by: Marco Behnke
316762 by: Jay Blanchard

PHP-FPM  security.limit_extensions
316763 by: Paspao

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---

On 2/22/2012 8:32 AM, ma...@behnke.biz wrote:

  There is another nice way.
You can pass a second value to the simple xml constructor which is a class
name to be used instead of SimpleXMLElement.
You can write your own class that extends SimpleXMLElement and override the
magic methods to skip the casting

I don't really see a need to add an extra layer or class extension when 
casting works fine. Am I wrong? Why add several lines of code in an 
extension class?
---End Message---
---BeginMessage---
Am 22.02.12 16:04, schrieb Jay Blanchard:
 On 2/22/2012 8:32 AM, ma...@behnke.biz wrote:
   There is another nice way.
 You can pass a second value to the simple xml constructor which is a
 class
 name to be used instead of SimpleXMLElement.
 You can write your own class that extends SimpleXMLElement and
 override the
 magic methods to skip the casting

 I don't really see a need to add an extra layer or class extension
 when casting works fine. Am I wrong? Why add several lines of code in
 an extension class?

To keep the code readable?

$value = $xml-node;

vs.

$value = (String)$xml-node;

I like the first one. Plus you handle it to dynamically to the right type

function __get($value)
{
if is float return float casted value
if is boolean ...
and so on
}

-- 
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz




signature.asc
Description: OpenPGP digital signature
---End Message---
---BeginMessage---
 I don't really see a need to add an extra layer or class extension
 when casting works fine. Am I wrong? Why add several lines of code in
 an extension class?
 
 To keep the code readable?
 
 $value = $xml-node;
 
 vs.
 
 $value = (String)$xml-node;
 
 I like the first one. Plus you handle it to dynamically to the right type
 
 function __get($value)
 {
if is float return float casted value
if is boolean ...
and so on
 }

The code is no less readable my way, YMMV
---End Message---
---BeginMessage---
Hello ,

I need to parse PHP files with no extension , I was getting access denied error 
than I discovered that it was cause by security.limit_extensions option in 
PHP-FPM config file.

I tried to add the script name (testscript) to the configuration file and now 
it works:

security.limit_extensions = .php .php3 .php4 .php5 testscript

I do not want to add all filenames and then restart php-fpm each time, is there 
a way to parse all file without extension or a wildcard to put in configuration?


Thank you
P.---End Message---


php-general Digest 24 Feb 2012 02:02:31 -0000 Issue 7700

2012-02-23 Thread php-general-digest-help

php-general Digest 24 Feb 2012 02:02:31 - Issue 7700

Topics (messages 316764 through 316774):

Re: PHP-FPM security.limit_extensions
316764 by: Nilesh Govindrajan

Selecting checkboxes based on SQL query
316765 by: Rick Dwyer
316766 by: Matijn Woudt
316767 by: Matijn Woudt
316768 by: Fatih P.
316769 by: Rick Dwyer
316770 by: Fatih P.
316771 by: Jim Lucas

Where did my comment go related to lower/upper bounds for any number and offset?
316772 by: Daevid Vincent
316773 by: Daniel Brown

Apache 2.4.1 and php?
316774 by: Daniel Fenn

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---
On Feb 23, 2012 2:46 PM, Paspao pas...@gmail.com wrote:

 Hello ,

 I need to parse PHP files with no extension , I was getting access denied
error than I discovered that it was cause by security.limit_extensions
option in PHP-FPM config file.

 I tried to add the script name (testscript) to the configuration file and
now it works:

 security.limit_extensions = .php .php3 .php4 .php5 testscript

 I do not want to add all filenames and then restart php-fpm each time, is
there a way to parse all file without extension or a wildcard to put in
configuration?


 Thank you
 P.
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


I'm not sure why would you want to do that. Why dont you use rewrite rules
instead?

--
Nilesh Govindrajan
http://nileshgr.com
---End Message---
---BeginMessage---

Hello all.

I perform a SQL query like the following:

$sql = 'select * from my_table where id=10

It returns the the following array for 3 records:


Array ( [0] = Array ( [cb] = 2 ) [1] = Array ( [cb] = 6 ) [2] =  
Array ( [cb] = 1 ) )


The values of CB in the above array are the values of html checkboxes  
on a page.


input type=checkbox name=cb[ ] value=1...
input type=checkbox name=cb[ ] value=2...
input type=checkbox name=cb[ ] value=3...
input type=checkbox name=cb[ ] value=4... etc

If the above array's cb value matches the value of a checkbox on the  
page, I need the default state of the checkbox to be checked so I  
know I'm going to have some ternary logic in each html checkbox.  But  
I don't know how to create a custom function from the above array to  
provide that logic.  I've tried some tutorials, but with no success as  
the array I am receiving is not like those in the tutorials.


Any help would be greatly appreciated.

Thank you.


 --Rick


---End Message---
---BeginMessage---
On Thu, Feb 23, 2012 at 7:49 PM, Rick Dwyer rpdw...@earthlink.net wrote:
 Hello all.

 I perform a SQL query like the following:

 $sql = 'select * from my_table where id=10

 It returns the the following array for 3 records:


 Array ( [0] = Array ( [cb] = 2 ) [1] = Array ( [cb] = 6 ) [2] = Array (
 [cb] = 1 ) )

 The values of CB in the above array are the values of html checkboxes on a
 page.

 input type=checkbox name=cb[ ] value=1...
 input type=checkbox name=cb[ ] value=2...
 input type=checkbox name=cb[ ] value=3...
 input type=checkbox name=cb[ ] value=4... etc

 If the above array's cb value matches the value of a checkbox on the page, I
 need the default state of the checkbox to be checked so I know I'm going
 to have some ternary logic in each html checkbox.  But I don't know how to
 create a custom function from the above array to provide that logic.  I've
 tried some tutorials, but with no success as the array I am receiving is not
 like those in the tutorials.

 Any help would be greatly appreciated.

 Thank you.


  --Rick


How about this:

input type=checkbox name=cb[ ] value=1 ?php
if(in_array(array('cb' = 1))) echo checked; ?...
input type=checkbox name=cb[ ] value=2 ?php
if(in_array(array('cb' = 2))) echo checked; ?...
input type=checkbox name=cb[ ] value=3 ?php
if(in_array(array('cb' = 3))) echo checked; ?...
input type=checkbox name=cb[ ] value=4 ?php
if(in_array(array('cb' = 4))) echo checked; ?... etc

- Matijn
---End Message---
---BeginMessage---
On Thu, Feb 23, 2012 at 8:07 PM, Matijn Woudt tijn...@gmail.com wrote:
 On Thu, Feb 23, 2012 at 7:49 PM, Rick Dwyer rpdw...@earthlink.net wrote:
 Hello all.

 I perform a SQL query like the following:

 $sql = 'select * from my_table where id=10

 It returns the the following array for 3 records:


 Array ( [0] = Array ( [cb] = 2 ) [1] = Array ( [cb] = 6 ) [2] = Array (
 [cb] = 1 ) )

 The values of CB in the above array are the values of html checkboxes on a
 page.

 input type=checkbox name=cb[ ] value=1...
 input type=checkbox name=cb[ ] value=2...
 input type=checkbox name=cb[ ] value=3...
 input type=checkbox name=cb[ ] value=4

php-general Digest 22 Feb 2012 14:32:20 -0000 Issue 7698

2012-02-22 Thread php-general-digest-help

php-general Digest 22 Feb 2012 14:32:20 - Issue 7698

Topics (messages 316754 through 316759):

Re: Test
316754 by: Tedd Sperling
316755 by: Jay Blanchard
316757 by: Tedd Sperling

Re: Do an LDAP Password Modify Extended Operation?
316756 by: Kirk.Johnson.zootweb.com

Re: SimpleXML and the Single String (SOLVED)
316758 by: Simon Schick
316759 by: marco.behnke.biz

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---
On Feb 20, 2012, at 2:49 PM, Daniel Brown wrote:

 On Mon, Feb 20, 2012 at 14:40, Bastien phps...@gmail.com wrote:
 Definitely doesn't work
 
The list works just fine, it's you goofs who need to work now!  ;-P

It still doesn't work and I didn't get this. :-)

Cheers,

tedd


_
tedd.sperl...@gmail.com
http://sperling.com
---End Message---
---BeginMessage---
It's like coming home, I knew I could count on certain of you to make 
light of this and that makes me strangely happy.


On 2/21/2012 7:55 AM, Tedd Sperling wrote:

On Feb 20, 2012, at 2:49 PM, Daniel Brown wrote:


On Mon, Feb 20, 2012 at 14:40, Bastienphps...@gmail.com  wrote:

Definitely doesn't work

The list works just fine, it's you goofs who need to work now!  ;-P

It still doesn't work and I didn't get this. :-)

Cheers,

tedd


_
tedd.sperl...@gmail.com
http://sperling.com



---End Message---
---BeginMessage---
On Feb 21, 2012, at 9:44 AM, Jay Blanchard wrote:

 It's like coming home, I knew I could count on certain of you to make light 
 of this and that makes me strangely happy.

Seek professional help now. :-)

Cheers,

tedd

_
tedd.sperl...@gmail.com
http://sperling.com
---End Message---
---BeginMessage---
Mike Mackintosh mike.mackint...@angrystatic.com wrote on 02/17/2012 
07:25:36 PM:

 [image removed] 
 
 Re: [PHP] Do an LDAP Password Modify Extended Operation?
 
 Mike Mackintosh 
 
 to:
 
 Kirk.Johnson, PHP General List
 
 02/17/2012 07:26 PM
 
 On Feb 17, 2012, at 3:34 PM, kirk.john...@zootweb.com wrote:
 
  Mike Mackintosh mike.mackint...@angrystatic.com wrote on 02/17/2012 
  12:36:06 PM:
  
  On Feb 17, 2012, at 10:57, kirk.john...@zootweb.com wrote:
  
  Is it possible to do an LDAP Password Modify Extended Operation, as 
  specified in RFC 3062? The password hashing scheme in the LDAP 
  directory I 
  am working with may change periodically, so it is my understanding 
  that I 
  can't hash a new password according to a specific scheme, e.g., 
{SHA}, 
  on 
  my side. Instead, I should use an Extended Operation and let the 
  directory 
  do the hashing. Is that correct? The help page for ldap_set_option 
  suggests that it might be possible, but I sure can't find any 
example 
  code 
  anywhere. 
  
  TIA
  
  Kirk
  
  I have an example of this on my lab box at home. I noticed issues 
  depending on if the requesting application was Linux or windows due 
  to the different Linux LDAP libraries. 
  
  When I get home I'll forward you the example of what I have so far
  
  Woohoo! Extended Operation doesn't seem to be a practice that is in 
  wide-spread use. Looking forward to what you've come up with. Thanks.
 
 
 Kirk,
 
 What i've been trying to do, is revive the patch i found here:
 
 http://www.mail-archive.com/internals@lists.php.net/msg19665.html
 
 It provides a lot of the functionality that you can only imagine and
 more, but it fails against versions 5.3.x.
 
 I sent an email to the original maintainer, Pierangelo, but have not
 received a response yet on that status of maintenance.
 
 Do you use OpenLDAP? I am not sure if it built, if it would support AD 
or not.
 
 Mike Mackintosh
 PHP, the drug of choice - www.highonphp.com

Had a nice 3-day weekend ;)

Yes, using OpenLDAP 2.x. I found the same Internals email thread from 
Pierangelo. 

Looking at Example #2 in the documentation for ldap_set_option, it appears 
that exop's might be supported, since the example uses an OID. Did you 
play around with the LDAP_OPT_SERVER_CONTROLS option at all, or am I 
completely off track there?

 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
---End Message---
---BeginMessage---
Hi, Jay

If you're not using the variable *$xmlCompany* somewhere else I'd try to
skip the array and just do it with this single line:
*$arrayLead[0]-Company = (string)
$xml-SignonRq-SignonTransport-CustId-SPName;*

The result should not differ from what you have now.

Bye
Simon

2012/2/21 Jay Blanchard jay.blanch...@sigmaphinothing.org

 Howdy,

 My PHP chops are a little rough around the edges so I know that I am
 missing something. I am working with SimpleXML

php-general Digest 19 Feb 2012 15:00:33 -0000 Issue 7695

2012-02-19 Thread php-general-digest-help

php-general Digest 19 Feb 2012 15:00:33 - Issue 7695

Topics (messages 316724 through 316727):

Re: Wrong POSTFIELDS Posted
316724 by: Matijn Woudt

New Health Insurance Information
316725 by: James Sullivan
316726 by: James Sullivan
316727 by: James Sullivan

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---
On Sat, Feb 18, 2012 at 1:54 AM, Brian Smither bhsmit...@gmail.com wrote:
 I have a script that accepts four POST variables. Three are used and five 
 more are added for a total of eight keys and their urlencode() values all 
 strung together in the proper format.

 Then cURL is initialized with the field string given to:
 curl_setopt($ch, CURLOPT_POST,8);
 curl_setopt($ch, CURLOPT_POSTFIELDS, $string);

 But that's not the string arriving at cURL's target URL! What's arriving at 
 the target is exactly the POST array that this script received in the first 
 place.

Isn't that just what urlencode is supposed to do?
If you want it to be urlencoded at the target, I think you need to
urlencode it twice.
There was something similiar a few months ago[1].

- Matijn

[1] http://lists-archives.com/php-general/372946-mcrypt_encrypt-help-needed.html
---End Message---
---BeginMessage---
pspan style=font-size: 12px;span style=font-size: 16px; Think you 
cant afford health insurance, or do your current premiums keep increasing and 
your coverage decreasing. /span/span/p
pspan style=font-size: 12px;span style=font-size: 16px;We offer 
health plans for every individual and every budget ! /span/span/p
pspan style=font-size: 12px;span style=font-size: 16px;Even if you 
have been turned down in the past, We can help./span/span/p
pspan style=font-size: 12px;span style=font-size: 16px;Plans from  
Blue Cross, United Health, Humana, Aetna, Cigna and many more. /span br / 
/span/p
pspan style=font-size: 12px;strongspan style=font-size: 16px; color: 
#3366ff;Available Plans Include:/span/strong/span/p
pbr /strongspan style=font-size: 14px; color: #800080; Major Medical 
Plans:/span/strongbr /span style=font-size: 12px; Doctors Office 
Copays/spanbr /span style=font-size: 12px; Diagnostic Lab and 
X-rays/spanbr /span style=font-size: 12px; RX Copays/spanbr /span 
style=font-size: 12px; Wellness Visit/spanbr /span style=font-size: 
12px; Hospital Confinement Including ICU/CCU/spanbr /span 
style=font-size: 12px; Surgical Benefits/spanbr /span style=font-size: 
12px; Accident Coverage/spanbr /span style=font-size: 12px;br 
/span style=color: #800080;strongspan style=font-size: 14px; 
Guarantee Issue Plans:/span/strong/span/spanbr /span 
style=font-size: 12px; Doctors Office Visits/spanbr /span 
style=font-size: 12px; Diagnostic Lab and X-rays/spanbr /span 
style=font-size: 12px; RX Benefits/spanbr /span style=font-size: 
12px; Wellness Visit/spanbr /span style=font-size: 12px; Hospital 
Confinement Including ICU/CCU/spanbr /span style=font-size: 12px; 
Surgical Benefits/spanbr /span style=font-size: 12px; Accident 
Coverage/spanbr /br /span style=color: #3366ff;strongspan 
style=font-size: 12px;Have you received a rate increase? ndash; Call me 
about lowering your/spanspan style=font-size: 12px; premiums./span 
/strong/spanbr /br /strongspan style=color: #ff6600;span 
style=font-size: 12px;Have you been declined? ndash; I have plans that will 
accept you regardless/spanspan style=font-size: 12px; of your health 
history./span/span/strongbr /br /span style=color: 
#800080;strongspan style=font-size: 12px;Do you not have coverage 
because you think it is too expensive? ndash; I/spanspan style=font-size: 
12px; have plans to fit any budget./span/strong/spanbr /br /span 
style=color: #ff;strongspan style=font-size: 12px;I also offer 
Medical Discount plans starting at 19.95 a month/spanspan style=font-size: 
12px;./span/strong/spanbr /br /strongspan style=font-size: 
12px;Contact me today to find out how you can start saving 
hundreds/spanspan style=font-size: 12px; or maybe even thousands of 
dollars a year in premium!/span/strongbr /span style=font-size: 
12px;br /span style=color: #339966;strongJim 
Sullivan/strong/span/span/p
pspan style=font-size: 12px;span style=color: 
#339966;strong239-682-8882/strong/span/span/p
pspan style=color: #339966;strongspan style=font-size: 12px;a 
href=mailto:hhealth...@aol.com;jsul...@yahoo.com/a/span/strong/span/pbr
 /br /centera 
href=https://www.businessetouch.net/optout.php?id=php-gene...@lists.php.net;click
 here to stop receiving emails/abr /or visit this address:br 
/https://www.businessetouch.net/optout.php?id=php-gene...@lists.php.net/centerbr
 /hr /centerbr /James Sullivanbr /11021 Corsia Trieste way  106br 
/Bonita Springs FL 34135/center

<    1   2   3   4   5   6   7   8   9   10   >