<?php

include "../classes/class.loader.php";

$db = new db();


// insert user:
$password = hash("sha256", $_POST['password']);
$record_id = $db->query("INSERT INTO `users`(`username`, `password`, `email`) VALUES ('{$_POST['username']}','$password','{$_POST['email']}')");
// insert user data:
$record_id = $db->query("INSERT INTO `user_data_1`(`first_name`, `last_name`, `cell_number`, `home_address`,`user_id`) VALUES ('{$_POST['first_name']}','{$_POST['last_name']}','{$_POST['cell_number']}','{$_POST['address']}',$record_id)");

if ($record_id > 0) {
    echo 1;
} else {
    echo 0;
}
