<?php session_start();
//Fetching Values from URL


require_once __DIR__."/allfunctions.php";
$con = mysqli_connect(get_dbserver(),get_dbuser(),get_dbpassword(),get_dbname());




	if(empty($_SESSION["id"]) && empty($_SESSION["access_type"]) && empty($_SESSION["firstname"]))
	{
	   $itemarray = array();
	   $memberid = "";
	  $type = "";
	  $fname = "";
	}
	else
	{
	  $memberid = $_SESSION['id'];
	  $type = $_SESSION['access_type'];
	  $fname = $_SESSION['firstname'];
	}


$username = $_POST['username'];
$password = $_POST['password'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$gender = $_POST['gender'];
$access_type = $_POST['access_type'];
$dateToday = date('Y-m-d');
$status="Active";





	$insert_sql = "INSERT INTO users(ID,username,password,firstname,lastname,gender,access_type,status	,datecreated)
	VALUES('','".$username."', '".$password."','".$fname."','".$lname."','".$gender."','".$access_type."', '".$status."', '".$dateToday."')";




		if(mysqli_query($con, $insert_sql) or die("database error: ". mysqli_error($con)))
		{
		//	$last_id = mysqli_insert_id($con);
			//$insert_sql1 = "INSERT INTO tbl_tasklist(id,type, action,user_type,user,datecreated,idassigned,status)
			//VALUES('','Sales Order', 'Added','".$type."','Unassigned','".$dateToday."','".$last_id."','Not yet started')";

		//	if(mysqli_query($con, $insert_sql1) or die("database error: ". mysqli_error($con)))
		//	{
				echo 1;
		//	}
		//	else
		//	{
		//		echo 0;
	//		}
		}
		else
		{
			echo 0;
		}

?>
