Announcement

Collapse
No announcement yet.

How to restrict a user without login from accessing profile page?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to restrict a user without login from accessing profile page?

    Suppose in codeigniter framework we will create login.php file in order to give access to application to any user. But if you do not restrict him properly then he'll access others profile settings page also. For that what code we've to write?


    In order to overcome that we should check whether that session exist or not, with the following code

    if($this->session->userdata('username')).

    If exists, show that page, if not show any warning.
    web designing companies in hyderabad | web designers in hyderabad
    salesforce online training india | salesforce training india

  • #2
    We need to put a precaution to notify user that your session has ended, in order to access profile page you have to login again, then he will login again.

    Something like below code will help you to customize your own code:
    function log_out() { $this->session->sess_destroy(); // null the session (just in case): $this->session->set_userdata(array('user_name' => '', 'is_logged_in' => '')); redirect('/admin/admin'); }
    Salesforce Online Training India | Salesforce Training Bangalore | Auto Ads in Hyderabad

    Comment

    Working...
    X