Skip to content Skip to sidebar Skip to footer

Tutorial on Creating an Online Store Using Codeigniter: Session Logout [Bagian 4]

logout aims to maintain the security of an account so that it is not used by others. This word is often heard in computer terms. Definition of the word logout itself is the process of exiting the computer network system.

In making an online store website using this codeigniter, the author will provide an explanation of the multi-level logout session. So it can be used for admins and members of this online store.

Codeigniter has provided user guide about the Session Library which makes it easier for programmers to use the process of exiting the computer network system.

Also Read:


1. Open the file Login.php in the folder C:\xampp\htdocs\online-shop\application\controllers. Then add the logout function as below:

public function logout()	{		$this->session->sess_destroy();		redirect('login');	}

Program Logic:

  • public function logout serves to exit the online store website system and store data that has been processed by members or admins. When the user uses this function, the system will display the online store website login page.

2. Open the file top_menu.php in the folder C:\xampp\htdocs\online-shop\application\views. Then add the following program snippet:

session->userdata('username')) { ?>	
  • You Are : session->userdata('username')?>
  • Program Logic:

    • The program snippet above functions as a front-end or user interface to select the logout menu. So, when users feel that they have had enough in choosing products and shopping, the user or member can leave this online store website. The page also applies to admins, when they feel they have finishedupdates and manage products and invoices.

    Screenshot of the Member Logout Menu:

    Screenshot of the Admin Logout Menu:

    When selecting the Logout Menu, both admins and members will be directed to the login page as shown below:

    In the next article, the author will discuss the tasks of the Admin to add, delete,updates as well as display a list of products to be sold in the store on line the. Therefore, continue to follow the development of manufacture website online shop using this codeigniter, yes, loyal friend of inwepo.