[PHP] Re: synchronizing php functions

2002-07-03 Thread Philip MacIver

Well I have a system that people can login to, and I want to produce an array (or 
something of the sort)
that holds who is logged in so that I can monitor it. The problem is that sessions are 
local to the clients machine
so if I tried to put this information in the session then the only information that I 
would get back is the people that
are 
logged in on my machine, not the server (Please tell me if I wrong in what I say 
here). Therefore I need to be able to
but this
information in the session and have it available to all sessions (sort of like the way 
static variables in Java belong
to the class and 
not the individual objects that are created from that class). So if you undersatnd 
what I'm trying to do here and know
of a way
to do it I would love to here it.


On Tue, 02 Jul 2002 18:45:40 -0500
[EMAIL PROTECTED] (Richard Lynch) wrote:

 Does anyone know anyway to synchronize calls to php functions.
 I was thinking of writting a hack that uses a lock file on the server put 
 if there is a proper way to do it then I would
 rather use that.
 Any suggestions would be good.
 
 Shared memory may be faster than lock files...
 
 *WHY* you think you need synched PHP functions might be an interesting
 discussion, though if it's just for fun, have at it.
 
 -- 
 Like Music?  http://l-i-e.com/artists.htm
 


|---|
   Philip MacIver
|---|  
|  
 

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




[PHP] synchronizing php functions

2002-07-02 Thread Philip MacIver

Does anyone know anyway to synchronize calls to php functions.
I was thinking of writting a hack that uses a lock file on the server put if there is 
a proper way to do it then I would
rather use that.
Any suggestions would be good.


|---|
   Philip MacIver
|---|  
|  
  

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




[PHP] Sessions

2001-12-24 Thread Philip MacIver

Since turning of register_globals in the php.ini file, sessions don't seem to be 
working any more, does anyone know why?

==
Philip MacIver   

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: Sessions

2001-12-24 Thread Philip MacIver

Thanks, that worked fined!

On Mon, 24 Dec 2001 09:31:31 -0600
Gaylen Fraley [EMAIL PROTECTED] wrote:

 By design.  Try accessing $HTTP_SESSION_VARS instead.  That should work.  In
 other words, if you were accessing a session variable by $session_var, now
 use $HTTP_SESSION_VARS['session_var'].
 
 --
 Gaylen
 [EMAIL PROTECTED]
 Home http://www.gaylenandmargie.com/
 PHP KISGB v2.6 Guest Book http://www.gaylenandmargie.com/phpwebsite/
 
 Philip Maciver [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Since turning of register_globals in the php.ini file, sessions don't seem
 to be working any more, does anyone know why?
 
  ==
  Philip MacIver
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


======
Philip MacIver   

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Just in case...

2001-12-24 Thread Philip MacIver

Just in case anyone happens to have this problem sometime in the future,

after a lot of testing it seems that it is not necessary to have the line 

global $GLOBALS

before you us the '$GLOBALS' array in a function, or a function in a class. You can 
just use it. 
In fact if you have the line
 
global $GLOBALS

it doesn't seem to reference the actual '$GLOBALS' array. 
This is what I have found to be the case anyway. 
If anyone knows why this is, or knows different to what I have just said, please do 
let me know, because I would love to
know how 
it all works.

Anyway, merry xmas, I'm not doing any of this tomorrow.

==
Philip MacIver   

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] $GLOBALS array

2001-12-23 Thread Philip MacIver

Does anyone know if it is possible to use the 

'global $varName'

function with the '$GLOBALS' array itself.

I have been having some trouble with this. I have decieded to switch of 
register_globals in the php.ini file (seeing as
it is now deprecated in version 4.1.0)
I know that register_globals is still supported, but I would like to get used to not 
using it.
But anyway, the problem I am having is that when I post data from a form to another 
page the data is not available
globally, so I wrote a method to register them globally, it looks like this

function globaliseVars($varArray) {
global $GLOBALS;

while (list($varName,$var) = each($varArray)) {
$GLOBALS[trim($varName)] = trim($var);
}
}

But doing 'global $GLOBALS' doesn't seem to make it refer to the actual '$GLOBALS' 
array, the only time it did work was
when I place something into the '$GLOBALS' array on the page that calls the function. 
So

/**
* This doesn't work
*/
globaliseVars($HTTP_POST_VARS);


/**
* But this does
*/
$GLOBALS[ANYTHING] = anything;
globaliseVars($HTTP_POST_VARS);

If anyone could help me with this problem please could they get in touch, because its 
driving me crazy.

Thanks!

==
Philip MacIver   

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: $GLOBALS array

2001-12-23 Thread Philip MacIver

Basically I use the MVC (Model View Controller) architecture  when building my php 
scripts. So all of my logic is
handled by a controller which calls methods on functions,
that way the php scritps that are used to display forms, tables etc. have little to no 
business logic to them at all.
Now in the controller I woul find it pretty annoying 
if I had to reference either the $HTTP_POST_VARS or $HTTP_GET_VARS aarry, so to add to 
the fact that it would make the
code look more messy than it needs to be. 
So all I wanted to know was is it possible to use 'global $GLOBAL' within a function?

On Sun, 23 Dec 2001 18:35:33 -0600


Gaylen Fraley [EMAIL PROTECTED] wrote:

 Why aren't you using the $_POST or $HTTP_POST_VARS array?
 
 --
 Gaylen
 [EMAIL PROTECTED]
 Home http://www.gaylenandmargie.com/
 PHP KISGB v2.6 Guest Book http://www.gaylenandmargie.com/phpwebsite/
 
 Philip Maciver [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Does anyone know if it is possible to use the
 
  'global $varName'
 
  function with the '$GLOBALS' array itself.
 
  I have been having some trouble with this. I have decieded to switch of
 register_globals in the php.ini file (seeing as
  it is now deprecated in version 4.1.0)
  I know that register_globals is still supported, but I would like to get
 used to not using it.
  But anyway, the problem I am having is that when I post data from a form
 to another page the data is not available
  globally, so I wrote a method to register them globally, it looks like
 this
 
  function globaliseVars($varArray) {
  global $GLOBALS;
 
  while (list($varName,$var) = each($varArray)) {
  $GLOBALS[trim($varName)] = trim($var);
  }
  }
 
  But doing 'global $GLOBALS' doesn't seem to make it refer to the actual
 '$GLOBALS' array, the only time it did work was
  when I place something into the '$GLOBALS' array on the page that calls
 the function. So
 
  /**
  * This doesn't work
  */
  globaliseVars($HTTP_POST_VARS);
 
 
  /**
  * But this does
  */
  $GLOBALS[ANYTHING] = anything;
  globaliseVars($HTTP_POST_VARS);
 
  If anyone could help me with this problem please could they get in touch,
 because its driving me crazy.
 
  Thanks!
 
  ==
  Philip MacIver
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


======
Philip MacIver   

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]