Creating session after you login with Ionic 3 and Mysql

Hi, i need help on how to create a session after i login with my app.
Am using ionic 3 and Mysql.
Below is my login.php file:

<?php
if (isset($_SERVER['HTTP_ORIGIN'])) {
        header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
        header('Access-Control-Allow-Credentials: true');
        header('Access-Control-Max-Age: 86400');    // cache for 1 day
    }
 
    // Access-Control headers are received during OPTIONS requests
    if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
 
        if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
            header("Access-Control-Allow-Methods: GET, POST, OPTIONS");         
 
        if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
            header("Access-Control-Allow-Headers:        {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
 
        exit(0);
    }
 
  require "dbconnect.php";
  
    $data = file_get_contents("php://input");
    if (isset($data)) {
        $request = json_decode($data);
        $email = $request->email;
      $password =$request->password;

      $avatar_type =$request->avatar_type;
 
	}
      
      $sql = "SELECT id FROM users WHERE email = '$email' and password = '$password' ";
      $result = mysqli_query($con,$sql);
      $row = mysqli_fetch_array($result,MYSQLI_ASSOC);
      $active = $row['active'];
      
      $count = mysqli_num_rows($result);
      
		
      if($count >0) {
     $response= "Your Login success";
      }else {
    $response= "Your Login Email or Password is invalid";
		
      }
   
	 
	echo json_encode( $response);
?>

While you wait for somebody to answer your specific question, I’m going to try to convince you to use tokens instead. A key feature of REST designs in general is statelessness on the server side, which you break when adding sessions to it. Managing state on the client with tokens makes it much easier to scale up and down server resources.