<?php
include('../../config.php');
extract($_POST);

// Sanitize and validate inputs if needed here

// Insert into tbl_theatre
mysqli_query($con, "INSERT INTO tbl_theatre VALUES (NULL, '$name', '$address', '$place', '$state', '$pin')");
$theatre_id = mysqli_insert_id($con);

// Securely hash the password
$hashed_password = password_hash($password, PASSWORD_DEFAULT);

// Insert into tbl_login
mysqli_query($con, "INSERT INTO tbl_login VALUES (NULL, '$theatre_id', '$username', '$hashed_password', '1')");

header('Location: theatre_list.php?msg=added');
exit;
?>
