Ask a Question related to PHP Development, Design and Development.
-
Raditha Dissanayake #1
Re: [PHP] vars between instantiate class...
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
>
>
>
--
[url]http://www.raditha.com/php/progress.php[/url]
A progress bar for PHP file uploads.
Raditha Dissanayake Guest
-
Cannot instantiate .NET Class Library to expose webservice client library
Now that I have got the mickey mouse .NET interop problem sorted (exposing ..NET library to ASP/VB6), I want to demo the real problem I am having. ... -
#26364 [Opn->Bgs]: initializing class in other class vars value problem
ID: 26364 Updated by: sniper@php.net Reported By: brightone at o2 dot pl -Status: Open +Status: ... -
#26364 [Bgs->Opn]: initializing class in other class vars value problem
ID: 26364 User updated by: brightone at o2 dot pl Reported By: brightone at o2 dot pl -Status: Bogus +Status: ... -
#26364 [NEW]: initializing class in other class vars value problem
From: brightone at o2 dot pl Operating system: windows xp PHP version: 4.3.4 PHP Bug Type: Class/Object related Bug... -
[PHP] error cannot instantiate non-existent class
I am newbie with php and I am trying to instantiate a class. I am using the command line to test my stuff out before I try it with a browser. The... -
Jswalter #2
Re: [PHP] vars between instantiate class...
Thanks.
That is waht I needed to know!
It works!
Thanks
Walter
Jswalter Guest



Reply With Quote

