| « Process of Elimination | Could You Explain Programming Please » |
"Biltmore can't log in," David's boss said in a panic, "you need to fix this. Now!"
It was the perfect way to start a Monday morning. When Biltmore couldn't log in, that meant that Biltmore couldn't get Biltmore's executive reports. And that meant that the entire company would grind to a halt and focus entirely on getting Biltmore's reports.
Grudgingly, David called up Biltmore. And as expected, Biltmore wasn't happy. "It keeps asking for my bloody PIN number," Biltmore cursed, "Why do I have to keep typing in my bloody PIN number? I need my reports!"
For some reason - perhaps the original developer's insanity, or perhaps Biltmore's - the executive reporting system authenticated users with a four-digit PIN number. David selected his own name from the list and typed in his PIN number: 7734. And the system worked like a charm. Well, as charming as a rickety, old PHP-based reporting can be.
No one had touched the code in ages, so David assumed the problem was with Biltmore's browser. Perhaps it was overflowing temp files? Or security settings? Disabled cookies? Corrupt files? David tried it all to no avail. And each step of the way, Biltmore became more and more aggravated.
"Where are my reports!?" Biltmore insisted, "I need them now!"
On a whim, David asked Biltmore for his PIN number. "Hmphf," Biltmore scoffed, "I just changed it, and now I'll have to change it again! My bloody PIN number is 0010!"
And then it hit him. David made a new account, set the PIN number to be "0010," and logged in. He clicked through the site for exactly ten seconds. And then he was kicked off. It asked him for his PIN again.
Confirming his suspicion, he jumped into the logon code...
$_SESSION['TIMEOUT'] = $this->getTimeOut();
Digging a bit further, David looked for getTimeOut...
function getTimeOut()
{
return $_POST['pin_number'];
}
Fearing that he'd break the old PHP system, David reset Biltmore's PIN number to 1337 and cautioned Biltmore about changing it to anything "less than" 1000 again.
|
Fixed it:
function getTimeOut() { return 1000+(int)$_POST['pin_number']; } |
|
This is just a code reusing ;). Code reusing saves money as you know...
|
Kinda makes you wish you could reach through time and slap the developer as he wrote that function, doesn't it? |
Re: Biltmore Can't Log In
2008-01-04 06:00
•
by
Tom Melly
(unregistered)
|
It's a fairly common (and sensible) requirement. I help design and support clinical databases. Nurses will generally use shared terminals on, for example, a ward. You don't want nurse B using nurse A's session to enter data, so nurses will generally get a lower timeout than an office-based admin who has sole use of a terminal. We actually implement 3 timouts - in order of precedence, the user's timeout (if set), the group timeout (if set), the global timeout (fallback). Well, that's the theory, but it generally comes down to bitching to the admin to get your timeout increased. |
|
To login please enter your User Name:********
Please enter your Timeout:**** |
| « Process of Elimination | Could You Explain Programming Please » |