<?php

session_start();
include_once 'functions/fungsi.php';
include_once 'connection/koneksi.php';

if (!isset($_SESSION["isLogin"]))
    redirect('index.php');
if (!($_SESSION["role"] == "inventory"))
    redirect('index.php');


$firstName = $_POST['first_name'];
$lastName = $_POST['last_name'];
$email = $_POST['email'];
$username = $_POST['username'];
$password = $_POST['password'];
$role = "member";

$query = 'INSERT INTO user( `first_name`, `last_name`, `email`,`username`,`password`,`role`) VALUES(?, ?, ?, ?, ?, ?)';

$statement = $database->prepare($query);
$statement->bind_param('ssssss', $firstName, $lastName, $email, $username, $password, $role);
$statement->execute();

redirect('index.php');
?>
    
