hi,

This is because the life time of an object is only as long as the page. Two solutions: store the login attempt count in the cookies. If you want persistent objects serialize them and save them to disk or db. and deserialize them again on the next page. This will have to be coupled with a uinique identifier (usually associated with a session) so that you know which object belongs to which user.


jsWalter wrote:


I am trying to see how many times a person has tried to log in during a
session.

the login script...

$objAuth->start();

  if ($objAuth->getAuth())   // is user logged in already
     ...display hello page...
  else
     ...display login page

OK, so far so good.

If the user punches in anything wrong, the login gets displayed again.

Now I want to track this iteration of attempts.

In the START method, I did this...

$this->_loginAttempts = $this->_loginAttempts + 1;

then I added

echo $objAuth->getLoginAttempts();

before ...display login page... to see how it tracks.

It always displays '1'

To me, it looks like '$objAuth->start();' , which is called each time the
page runs, which is each time a login attempt is made, is re-initializing
all the class vars to their default state.

If I make _loginAttempts = 8, then it displays 9.

So, my question (this time) is how do I get the class to track this counter?

I hope I explained this well enough.

I really don't think this is a PEAR::Auth specific question. I think it's
just a "how do I keep this counter going in a class" question.

Thanks

Walter





--
http://www.raditha.com/php/progress.php
A progress bar for PHP file uploads.

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



Reply via email to