Welcome Guest, Not a member yet? Register   Sign In
Application with different type of user
#1

[eluser]foysal[/eluser]
I am working on a project. Their are 2 types of user. 1. Admin, 2. User. http://localhost/my_app/index.php/welcome is URL for normal user login. After logged in a normal user will come in this URL. http://localhost/my_app/index.php/administrator is URL for admin login. After logged in an Admin will come in this URL. If I logged in as user, then try to browse using the URL of Admin then application showing Admin is also logged in.


How can I solve this problem ?? Have you any idea ??

Thanks

Foysal
#2

[eluser]NikosV[/eluser]
checking if user is logged is not enought. you should also check his user group on every cocntroller and display the appropriate views.
#3

[eluser]TheFuzzy0ne[/eluser]
You can do this by creating a single controller for each user group, and extending it.

http://philsturgeon.co.uk/blog/2010/02/C...ing-it-DRY
#4

[eluser]foysal[/eluser]
I am getting this error in this case.


A PHP Error was encountered

Severity: Notice

Message: Undefined property: Users::$session

Filename: controllers/users.php

Line Number: 17

Fatal error: Call to a member function userdata() on a non-object in E:\xampp\htdocs\my_app\application\controllers\users.php on line 17



I auto loaded the session library in this way

$autoload['libraries'] = array('session');

Thanks

#5

[eluser]NikosV[/eluser]
You should post what exactly is number 17 of the controllers/users.php
#6

[eluser]TheFuzzy0ne[/eluser]
You're most likely not extending the correct base controller, or you're not calling the parent constuctor.

Guessing can be fun, but if you post your code it might save us some time.




Theme © iAndrew 2016 - Forum software by © MyBB