Re: Need login suggestions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I see, well I have a login that has multiple levels and here is how I have it. Obvious pertinent info has been changed, but you can adopt and add your own.

a config file with userlevel values EG:

$parent = 2; //Parent Level
$student = 1; //Student Level
$guest = 0;//Guest level

A define.php file with things defined EG:
include or require the config.php in this file
define("PARENT", $parent);
define("STUDENT", $student);

Then work some functions to check the levels in your sessions php file.
That way every page thats pulled up, it checks the login status and the userlevel.
EG:
include or require the define.php in the session php

//Inside the session php
   function isParent(){
      return ($this->userlvl == PARENT);
   }
   function isStudent(){
      return ($this->userlvl == STUDENT);
   }

$this->userlvl will be the level recorded after registration was completed the first time. You should be checking this and retrieving this at login. Basically setting it as a session variable with it that gets carried through.

Eg usage:
if($this->isParent()) {
//do this
}

HTH,

On May 3, 2010, at 12:43 AM, Karl DeSaulniers wrote:

Hi Ashley,
I would have your database that is attached to this part of the website, verify with another database that stores all your student and parent info for your school and when they register, you can actually check against a database of students that actually attend the school and the parents of that student on your server not through a login form. I believe there is a way to set up a cron or something like that where the check is made at
the server level and no one else can check that way.

I am not a professional at php, but I believe I read about this capability somewhere.
If someone knows the actual term for this please, interject.

Also, I would probably ask how to do that on the PHP-Database list

Databases and PHP - choose this one
http://www.php.net/mailing-lists.php

HTH,

On May 2, 2010, at 9:09 PM, Ashley M. Kirchner wrote:

Slightly OT, but I can't think of a better forum to ask this in. I'm sure a lot of us here have at some point or another built a system that requires
registration to gain access.  What I'm trying to figure is how to set
different levels of access.



We're building a large site for a school district, to be used by both
students and parents. When a student logs in, they gain some access to the site, and when a parent logs in, they gain access to other sections on the site. That's all fine and dandy, it's the actual registration process that
I'm having a hard time with.



How to determine if a registration is a student or a parent. Do I simply give them a check box (or other method) to pick from (student or parent) and hope they're being honest? Has anyone here have to deal with that in the
past, and would you be willing to give me some ideas of what you did?
Thanks!


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux