Wrox Programmer Forums
|
BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9
This is the forum to discuss the Wrox book PHP and MySQL: Create-Modify-Reuse by Timothy Boronczyk, Martin E. Psinas; ISBN: 9780470192429
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 5th, 2009, 11:38 PM
Registered User
 
Join Date: Sep 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 1 - Login not checking for active status?

I've been trying to adapt the login script(s) in chapter 1 and just when I thought it was working, I realized that I could successfully log in regardless of whether or not I had verified the registration.

My understanding is that upon successful registration, the "isActive" field is set to "inactive" with a value of 0. Then, if verified, either by link or email link, the value of "isActive" is set to a value of 1.

The login.php script seems to allow a user to successfully login regardless of whether they have verified their registration or not. It doesn't appear to check that the user has verified their registration and thus, has an active status, in order to successfully log in. I don't think this is correct. Any thoughts?

Last edited by notnac; September 6th, 2009 at 11:50 PM..
 
Old September 24th, 2009, 03:30 PM
Authorized User
 
Join Date: Jul 2009
Posts: 77
Thanks: 4
Thanked 6 Times in 6 Posts
Default

This is a very interesting find notnac.

I also notice that I can login with an
inactive user.

Here's a change that I tried and it works.

In login.php, around line 21, add a check for $user->isActive

The original line
Code:
      if ($user->userId && $user->password == sha1($_POST['password']))
Change it to
Code:
  if ($user->userId && $user->password == sha1($_POST['password']) && $user->isActive)
Also change the comment on line 32
Code:
    // invalid user and/or password and/or user not active





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to show the Active Status Box? karwaabhi ASP.NET 2.0 Professional 0 February 7th, 2007 06:59 AM
Checking for active Internet connection jim b Classic ASP Basics 5 August 20th, 2006 01:55 PM
Chapter 12 - Multiple Active Result Sets mdrake BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 9 May 13th, 2006 06:33 AM
Monitoring users login/logout to my active directo Gu General .NET 0 June 10th, 2005 11:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.