<?php

	include('includes/config.php');
	
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$middle_initial = $_POST['middle_initial'];
$username = $_POST['username'];
$password = md5($_POST['password']);
$user_type = $_POST['user_type'];
//for history log
session_start();
	$user =  $_SESSION['user_name'];
	$action = $_POST['action'];
	$pc_date = $_POST['pc_date'];
	$pc_time = $_POST['pc_time'];

	
mysql_query("INSERT INTO users (`first_name`, `last_name`, `middle_initial`, `username`, `password`, `user_type`) 
						VALUES('$first_name', '$last_name', '$middle_initial', '$username', '$password', '$user_type')
			")
			or die(mysql_error());
echo "success";

//for history log
mysql_query("INSERT INTO history (`data`,`actions`,`date`,`user`)
			VALUES('$username', 'added user', '$pc_date $pc_time', '$user')")or die(mysql_error());	


			?>
