Re: [PHP] Zend memory manager

2011-01-23 Thread Adi Mutu
Of course I have tried, but nothing ...
The results or only aboyt  emalloc/pemalloc familly.
Nothing lower level about how these 2 functions are implemented or about the 
mm_heap struct of mm_block.


  

RE: [PHP] Different sessions, same client

2011-01-23 Thread Tommy Pham
> -Original Message-
> From: Tommy Pham [mailto:tommy...@gmail.com]
> Sent: Sunday, January 23, 2011 5:23 PM
> To: 'Paul M Foster'
> Cc: 'php-general@lists.php.net'; 'Thijs Lensselink'
> Subject: RE: [PHP] Different sessions, same client
> 
> > -Original Message-
> > From: Thijs Lensselink [mailto:d...@lenss.nl]
> > Sent: Sunday, January 23, 2011 12:21 AM
> > To: php-general@lists.php.net
> > Subject: Re: [PHP] Different sessions, same client
> >
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
> >
> > On 01/23/2011 07:33 AM, Paul M Foster wrote:
> > > Storing any sort of login/auth data in cookies has regularly been
> > > panned on this list. The preference seems to be to store whatever
> > > login/auth information *must* be stored in the $_SESSION variable.
> > >
> > > Well and good. My problem, however, is that I have multiple
> > > applications in different tabs running on the same server, which may
> > > all use the same sub-variables, like "username". As a result, they
> > > run into
> > each other.
> > > One application will think I'm logged in when I'm not logged in to
> > > that application, but to another in the same browser on the same box.
> > >
> > > So my question is how to prevent this using the standard PHP
> > > functions relating to sessions. I'd like different applications in
> > > different tabs on the same box/browser to have different sessions,
> > > so they don't share data.
> > >
> > > Thoughts?
> > >
> > > Paul
> > >
> >
> >
> > Using session_name will allow you to run two different sessions in the
> > same browser.
> >
> > session_name('app1');
> > session_start();
> 
> Paul,
> 
> I'd would go with session_name($_SERVER['SCRIPT_NAME']) or
> session_name(substr($_SERVER['SCRIPT_NAME'], 0,
> strripos($_SERVER['SCRIPT_NAME'], '/')).  My regex skills sucks so I can't 
> give
> you a sample using regex.  But you get the idea.
> 
> It's easier to get a particular app's relevant data to the URL while not hard
> coding the session name, eventually giving your app(s) more flexibility
> especially if you may have multiple URLs mapped to an app serving
> different purposes/clients.
> 
> Regards,
> Tommy

Forgot to mention that this assumes your app's design is MVC like with a single 
point entry only.


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



RE: [PHP] Different sessions, same client

2011-01-23 Thread Tommy Pham
> -Original Message-
> From: Thijs Lensselink [mailto:d...@lenss.nl]
> Sent: Sunday, January 23, 2011 12:21 AM
> To: php-general@lists.php.net
> Subject: Re: [PHP] Different sessions, same client
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> On 01/23/2011 07:33 AM, Paul M Foster wrote:
> > Storing any sort of login/auth data in cookies has regularly been
> > panned on this list. The preference seems to be to store whatever
> > login/auth information *must* be stored in the $_SESSION variable.
> >
> > Well and good. My problem, however, is that I have multiple
> > applications in different tabs running on the same server, which may
> > all use the same sub-variables, like "username". As a result, they run into
> each other.
> > One application will think I'm logged in when I'm not logged in to
> > that application, but to another in the same browser on the same box.
> >
> > So my question is how to prevent this using the standard PHP functions
> > relating to sessions. I'd like different applications in different
> > tabs on the same box/browser to have different sessions, so they don't
> > share data.
> >
> > Thoughts?
> >
> > Paul
> >
> 
> 
> Using session_name will allow you to run two different sessions in the same
> browser.
> 
> session_name('app1');
> session_start();

Paul,

I'd would go with session_name($_SERVER['SCRIPT_NAME']) or 
session_name(substr($_SERVER['SCRIPT_NAME'], 0, 
strripos($_SERVER['SCRIPT_NAME'], '/')).  My regex skills sucks so I can't give 
you a sample using regex.  But you get the idea.

It's easier to get a particular app's relevant data to the URL while not hard 
coding the session name, eventually giving your app(s) more flexibility 
especially if you may have multiple URLs mapped to an app serving different 
purposes/clients.

Regards,
Tommy


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



RE: [PHP] Zend memory manager

2011-01-23 Thread Tommy Pham
> -Original Message-
> From: Adi Mutu [mailto:adi_mut...@yahoo.com]
> Sent: Sunday, January 23, 2011 12:14 PM
> To: Daniel Brown
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Zend memory manager
> 
> 
> 
> I have looked at the sources, but it's still not very clear to me
> Where should I ask this question than.?
> 
> Sorry for the inconveniences!
> Thanks,
> 

Have you tried google'ing for: zend php memory manager ?  Seems to return
some interesting results.

Regards,
Tommy


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



Re: [PHP] email address syntax checker

2011-01-23 Thread Govinda
> Trying to finish a PHP book while watching the Packers is not working
> for me too well. ;-)


yeah.. me trying to keep up with the php list, follow streams of thought from 
the posts that lead to things I need to yet learn, make time off from my 
other-language/full-time work..  wishing I could actually play Civ-V which I 
just bought..   .. not to mention my business idea guaranteed to make a mint 
and be a ton of fun (if I had a year off to code it)... ;-)


Govinda


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



Re: [PHP] email address syntax checker

2011-01-23 Thread Donovan Brooke

Govinda wrote:
[snip]

Hi D   :-)

I was following along.. also felt pleased to be introduced to filter_var ... 
and then happened to see this:

http://us3.php.net/manual/en/function.filter-var.php

[snip]

"Note that FILTER_VALIDATE_EMAIL used in isolation is not enough for most (if 
not all) web based registration forms.




Good to know G... (and yea, I read something similar).. but only 
administrators can add registrants in the system I'm building.. and even 
then, email is not required, so I'm not worried about it on this job, 
but I'll keep all the posts for this thread in mind for down the road.


Trying to finish a PHP book while watching the Packers is not working
for me too well. ;-)

Thanks,
Donovan


--
D Brooke

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



Re: [PHP] Different sessions, same client

2011-01-23 Thread Paul M Foster
On Sun, Jan 23, 2011 at 11:45:30AM -0500, tedd wrote:

> At 11:02 AM + 1/23/11, Ashley Sheridan wrote:
> >On Sun, 2011-01-23 at 09:21 +0100, Thijs Lensselink wrote:
> >
> >> -BEGIN PGP SIGNED MESSAGE-
> >> Hash: SHA1
> >>
> >> On 01/23/2011 07:33 AM, Paul M Foster wrote:
> >> > Storing any sort of login/auth data in cookies has regularly been
> panned
> >> > on this list. The preference seems to be to store whatever login/auth
> >> > information *must* be stored in the $_SESSION variable.
> >> >
> >> > Well and good. My problem, however, is that I have multiple
> applications
> >> > in different tabs running on the same server, which may all use
> the same
> >> > sub-variables, like "username". As a result, they run into each other.
> >> > One application will think I'm logged in when I'm not logged in to that
> >> > application, but to another in the same browser on the same box.
> >> >
> >> > So my question is how to prevent this using the standard PHP functions
> >> > relating to sessions. I'd like different applications in different tabs
> >> > on the same box/browser to have different sessions, so they don't share
> >> > data.
> >> >
> >> > Thoughts?
> >> >
> > > > Paul
> >
> >
> >You can of course use arrays in your session as well:
> >
> >$_SESSION['app_name'] = Array(
> >'username' => 'John',
> >'user_id' => 1234,
> >'some other info' => 'another string',
> >);
> >
> >I use this on my localhost sometimes, as it can be easier running tests
> >and stuff than having to create a whole new host entry for it in my
> >config files!
> >
> >Thanks,
> >Ash
> 
> Paul:
> 
> Ash's method is a good one.
> 
> You might also consider using uniqid() to create a unique ID for your
> users and then use that ID for determining which user is which
> instead of using username.

Here's the problem: using Ash's method, it appears that all sessions
running on a given browser (different tabs) will be able to see all the
values from the other sessions. I may only *use* the values for my
payroll app, but I can also *see* the values for my customer app as
well.

The session_name() suggestion from the prior poster appears to force PHP
to issue a separate session ID for each application/tab. This way, the
each application/tab only sees the values applicable to it.

This actually takes on greater importance, in that I tend to put error
messages in the SESSION variable for display at the next page load. When
all the applications share the same session cookie, the error messages
tend to show up in the wrong applications. So I need each application to
see a different session, if possible.

Paul

-- 
Paul M. Foster
http://noferblatz.com


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



Re: [PHP] email address syntax checker

2011-01-23 Thread Ashley Sheridan
On Sun, 2011-01-23 at 14:59 -0500, Govinda wrote:

> > Peter Lind wrote:
> > [snip]
> >> if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
> >> echo "Bad user! Bad user!";
> >> }
> >> 
> >> Regards
> >> Peter
> > 
> > 
> > thanks peter... wish I would have known about filter_var before
> > writing the other checkers. ;-)
> 
> 
> Hi D   :-)
> 
> I was following along.. also felt pleased to be introduced to filter_var ... 
> and then happened to see this:
> 
> http://us3.php.net/manual/en/function.filter-var.php
> the user-contributed note, headed with:
> php dot 5 dot leenoble at SPAMMENOTspamgourmet dot net 18-Dec-2009 10:01
> 
> "Note that FILTER_VALIDATE_EMAIL used in isolation is not enough for most (if 
> not all) web based registration forms.
> 
> It will happily pronounce "yourname" as valid because presumably the 
> "@localhost" is implied, so you still have to check that the domain portion 
> of the address exists.
> "
> 
> So I am surprised Peter recommended it.  (?)
> 
> AFAICT, I should stick with what I was using:
> 
> $emailPattern = '/^[\w\.\-_\+]+@[\w-]+(\.\w{2,4})+$/i'; //
> $emailReplacement = 'theEmailAppearsValid';
> $emailChecker = preg_replace($emailPattern, $emailReplacement, $emailToCheck);
> if($emailChecker == 'theEmailAppearsValid') {
>   //--theEmailLooksValid, so use it...
> } else {
>   //--theEmailLooksBad, so do not use it...
> }
> 
> 
> 
> Govinda
> 
> 


A few posts back I posted a solution to a question about validating
domain names. You could use that to validate the portion after the last
'@' symbol (as an @ could validly occur in the local part of the email
address) and then validate the front part another way (I can't write all
the code for you ;p )

The domain code I used before was:

http://www.ashleysheridan.co.uk




Re: [PHP] Zend memory manager

2011-01-23 Thread Adi Mutu


I have looked at the sources, but it's still not very clear to me
Where should I ask this question than.?

Sorry for the inconveniences!
Thanks,



  

Re: [PHP] email address syntax checker

2011-01-23 Thread Govinda
> Peter Lind wrote:
> [snip]
>> if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
>> echo "Bad user! Bad user!";
>> }
>> 
>> Regards
>> Peter
> 
> 
> thanks peter... wish I would have known about filter_var before
> writing the other checkers. ;-)


Hi D   :-)

I was following along.. also felt pleased to be introduced to filter_var ... 
and then happened to see this:

http://us3.php.net/manual/en/function.filter-var.php
the user-contributed note, headed with:
php dot 5 dot leenoble at SPAMMENOTspamgourmet dot net 18-Dec-2009 10:01

"Note that FILTER_VALIDATE_EMAIL used in isolation is not enough for most (if 
not all) web based registration forms.

It will happily pronounce "yourname" as valid because presumably the 
"@localhost" is implied, so you still have to check that the domain portion of 
the address exists.
"

So I am surprised Peter recommended it.  (?)

AFAICT, I should stick with what I was using:

$emailPattern = '/^[\w\.\-_\+]+@[\w-]+(\.\w{2,4})+$/i'; //
$emailReplacement = 'theEmailAppearsValid';
$emailChecker = preg_replace($emailPattern, $emailReplacement, $emailToCheck);
if($emailChecker == 'theEmailAppearsValid') {
//--theEmailLooksValid, so use it...
} else {
//--theEmailLooksBad, so do not use it...
}



Govinda


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



Re: [PHP] Zend memory manager

2011-01-23 Thread Daniel Brown
On Sun, Jan 23, 2011 at 09:10, Adi Mutu  wrote:
> Hello,
>
> This is my first mail here, i hope it's ok.
> Can somebody give me any hint to some docs about how the Zend mm works? I 
> can't
> find any references on the net.
> I'm not interested in only emalloc, efree etc. but at an even lower level  i
> mean about functions like _zend_mm_alloc_int, _zend_mm_alloc_int
> and structs like zend_mm_heap.

No, this is your second email.

If you're interested in knowing how the lower-level stuff works,
why not just view the source itself?  This question is beyond the
scope of this list.

-- 

Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

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



Re: [PHP] Different sessions, same client

2011-01-23 Thread tedd

At 11:02 AM + 1/23/11, Ashley Sheridan wrote:

On Sun, 2011-01-23 at 09:21 +0100, Thijs Lensselink wrote:


 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On 01/23/2011 07:33 AM, Paul M Foster wrote:
 > Storing any sort of login/auth data in cookies has regularly been panned
 > on this list. The preference seems to be to store whatever login/auth
 > information *must* be stored in the $_SESSION variable.
 >
 > Well and good. My problem, however, is that I have multiple applications
 > in different tabs running on the same server, which may all use the same
 > sub-variables, like "username". As a result, they run into each other.
 > One application will think I'm logged in when I'm not logged in to that
 > application, but to another in the same browser on the same box.
 >
 > So my question is how to prevent this using the standard PHP functions
 > relating to sessions. I'd like different applications in different tabs
 > on the same box/browser to have different sessions, so they don't share
 > data.
 >
 > Thoughts?
 >

 > > Paul


You can of course use arrays in your session as well:

$_SESSION['app_name'] = Array(
'username' => 'John',
'user_id' => 1234,
'some other info' => 'another string',
);

I use this on my localhost sometimes, as it can be easier running tests
and stuff than having to create a whole new host entry for it in my
config files!

Thanks,
Ash


Paul:

Ash's method is a good one.

You might also consider using uniqid() to create a unique ID for your 
users and then use that ID for determining which user is which 
instead of using username.


Cheers,

tedd



--
---
http://sperling.com/

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



[PHP] Zend memory manager

2011-01-23 Thread Adi Mutu
Hello,

This is my first mail here, i hope it's ok.
Can somebody give me any hint to some docs about how the Zend mm works? I can't 
find any references on the net.
I'm not interested in only emalloc, efree etc. but at an even lower level  i 
mean about functions like _zend_mm_alloc_int, _zend_mm_alloc_int
and structs like zend_mm_heap.

Thanks,
A.


  

[PHP] Zend Memory Manager

2011-01-23 Thread Adi Mutu


Hello,

This is my first mail here, i hope it's ok.
Can somebody give me any hint to some docs about how the Zend mm works? I can't 
find any references on the net.
I'm not interested in only emalloc, efree etc. but at an even lower level  i 
mean about functions like _zend_mm_alloc_int, _zend_mm_alloc_int
and structs like zend_mm_heap.

Thanks,
A.


  

Re: [PHP] Different sessions, same client

2011-01-23 Thread Ashley Sheridan
On Sun, 2011-01-23 at 09:21 +0100, Thijs Lensselink wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> On 01/23/2011 07:33 AM, Paul M Foster wrote:
> > Storing any sort of login/auth data in cookies has regularly been panned
> > on this list. The preference seems to be to store whatever login/auth
> > information *must* be stored in the $_SESSION variable.
> > 
> > Well and good. My problem, however, is that I have multiple applications
> > in different tabs running on the same server, which may all use the same
> > sub-variables, like "username". As a result, they run into each other.
> > One application will think I'm logged in when I'm not logged in to that
> > application, but to another in the same browser on the same box.
> > 
> > So my question is how to prevent this using the standard PHP functions
> > relating to sessions. I'd like different applications in different tabs
> > on the same box/browser to have different sessions, so they don't share
> > data.
> > 
> > Thoughts?
> > 
> > Paul
> > 
> 
> 
> Using session_name will allow you to run two different sessions in the
> same browser.
> 
> session_name('app1');
> session_start();
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (GNU/Linux)
> 
> iQIcBAEBAgAGBQJNO+TpAAoJEMffsHAOnubXzHYQAI86mjCR49uWTPYweFim9e+K
> EtU4KnFfXkQj+Qp0YYjjuiAW0muRywbjKkwuAmw7fO/v9DrbGILAvnneNX7OR9cM
> TBh66J6anuLB3UmItrmFqP2VKgWaLG7KHf0wExfv3duzJkRqp5Y8NQG1Ep8aXA0U
> 8N2VHQ1ki9ukHeIWcPI4l5558j0NE/5BsiWgJIgTC/CovDjdNYln9vszkmFw0g2G
> vJore2V3OIBcmLhqpcITSNK4FcaNWIKnrRWnlCgoAzA1WUCQXnmv0nJMZ0P9xtzk
> iYt2lkBvlGEJ8lnZoAo83XRsQ1oI6vLFwf5xDkI4OGnAsOIzmX3RzStxXyz9o5th
> VyIHtj8R40Rk6eI6L5xE4w1l58JTFMPdgaFk5Ku/v8i8UGDWjWHC0Qhob14w+H32
> RQUtx9dBsYKYT9ZHIkxAQYDc9nTdgajRzo0ONqmzPTS9Qb7NTcjiC9pb1bHBjubA
> M4zJnyO5N7IUy0FmMyS7PG8saCgJDSYj+stvoCC9Kd0eDRBKs+M5cRLpnXem/Yf8
> KG+clIe5+7X9l1TC7uT84HxZYSZCcuwuvRyBUIZknagyREQvLhaFX1OPZ/vk3n6S
> j7k77oFpcCRjkPVKZeUqFAENEY1J7p6DBEkTz9gRkA+islnSIt8rjz+0wYYg0goy
> b3C3ThlftPWwcOBuRQOP
> =ZBm8
> -END PGP SIGNATURE-
> 


You can of course use arrays in your session as well:

$_SESSION['app_name'] = Array(
'username' => 'John',
'user_id' => 1234,
'some other info' => 'another string',
);

I use this on my localhost sometimes, as it can be easier running tests
and stuff than having to create a whole new host entry for it in my
config files!

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




Re: [PHP] Different sessions, same client

2011-01-23 Thread Thijs Lensselink
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 01/23/2011 07:33 AM, Paul M Foster wrote:
> Storing any sort of login/auth data in cookies has regularly been panned
> on this list. The preference seems to be to store whatever login/auth
> information *must* be stored in the $_SESSION variable.
> 
> Well and good. My problem, however, is that I have multiple applications
> in different tabs running on the same server, which may all use the same
> sub-variables, like "username". As a result, they run into each other.
> One application will think I'm logged in when I'm not logged in to that
> application, but to another in the same browser on the same box.
> 
> So my question is how to prevent this using the standard PHP functions
> relating to sessions. I'd like different applications in different tabs
> on the same box/browser to have different sessions, so they don't share
> data.
> 
> Thoughts?
> 
> Paul
> 


Using session_name will allow you to run two different sessions in the
same browser.

session_name('app1');
session_start();
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)

iQIcBAEBAgAGBQJNO+TpAAoJEMffsHAOnubXzHYQAI86mjCR49uWTPYweFim9e+K
EtU4KnFfXkQj+Qp0YYjjuiAW0muRywbjKkwuAmw7fO/v9DrbGILAvnneNX7OR9cM
TBh66J6anuLB3UmItrmFqP2VKgWaLG7KHf0wExfv3duzJkRqp5Y8NQG1Ep8aXA0U
8N2VHQ1ki9ukHeIWcPI4l5558j0NE/5BsiWgJIgTC/CovDjdNYln9vszkmFw0g2G
vJore2V3OIBcmLhqpcITSNK4FcaNWIKnrRWnlCgoAzA1WUCQXnmv0nJMZ0P9xtzk
iYt2lkBvlGEJ8lnZoAo83XRsQ1oI6vLFwf5xDkI4OGnAsOIzmX3RzStxXyz9o5th
VyIHtj8R40Rk6eI6L5xE4w1l58JTFMPdgaFk5Ku/v8i8UGDWjWHC0Qhob14w+H32
RQUtx9dBsYKYT9ZHIkxAQYDc9nTdgajRzo0ONqmzPTS9Qb7NTcjiC9pb1bHBjubA
M4zJnyO5N7IUy0FmMyS7PG8saCgJDSYj+stvoCC9Kd0eDRBKs+M5cRLpnXem/Yf8
KG+clIe5+7X9l1TC7uT84HxZYSZCcuwuvRyBUIZknagyREQvLhaFX1OPZ/vk3n6S
j7k77oFpcCRjkPVKZeUqFAENEY1J7p6DBEkTz9gRkA+islnSIt8rjz+0wYYg0goy
b3C3ThlftPWwcOBuRQOP
=ZBm8
-END PGP SIGNATURE-

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