<commit_before><?php

	require 'autoload.php';
	/* --------------------------------------
	/* File to handle all API requests
	/* Accepts GET and POST
	/* --------------------------------------
	/* Each request will be identified by TAG
	/* Response will be JSON data
	/* --------------------------------------
	/* check for POST request 
	/*/
	if ((isset($_POST['GID'])            && $_POST['GID']             != '') && 
	  	(isset($_POST['Username'])       && $_POST['Username']        != '') &&
	  	(isset($_POST['ApplicantName'])  && $_POST['ApplicantName']   != '') &&
	  	(isset($_POST['FatherName'])     && $_POST['FatherName']      != '') &&
	  	(isset($_POST['CNIC'])           && $_POST['CNIC']            != '') &&
	  	(isset($_POST['PhoneNumber'])    && $_POST['PhoneNumber']     != '') &&
	  	(isset($_POST['Address'])        && $_POST['Address']         != '') &&
	  	(isset($_POST['Damage'])         && $_POST['Damage']          != '') &&
	  	(isset($_POST['Date'])           && $_POST['Date']            != '') &&
	  	(isset($_POST['Detail'])         && $_POST['Detail']          != '') &&
	  	(isset($_POST['RawData'])        && $_POST['RawData']          != '')
		) {

			// get tag
  			$GID = $_POST['GID'];
			$Username = $_POST['Username'];
			$ApplicantName = $_POST['ApplicantName'];
			$FatherName = $_POST['FatherName'];
			$CNIC = $_POST['CNIC'];
			$PhoneNumber = $_POST['PhoneNumber'];
			$Address = $_POST['Address'];
			$Damage = $_POST['Damage'];
			$Date = $_POST['Date'];
			$Detail = $_POST['Detail'];
			$RawData = $_POST['RawData'];

			// include db handler
			$db = new \ClassLibrary\DBFunctions();

			// response Array
			$response = array("Status" => 0);

			// check for user
			$data = $db->insertDataInTable($GID, $Username, $ApplicantName, $FatherName, $CNIC, $PhoneNumber, $Address, $Damage, $Date, $Location, $Detail);
			if ($data != false) {
				// Data inserted found
				// Now Convert Rawdata to Images
  				$ImagesArray = explode("|", $RawData);
				$i = 1;
				foreach ($ImagesArray as $image) {
					$binary = base64_decode($image);
					$imgaeDirectory = "../img/pdma-survey-images/" . $GID;
					var_dump($imgaeDirectory);
					mkdir($imgaeDirectory);
					header('Content-Type: bitmap; charset=utf-8');
					$imagePath = "../img/pdma-survey-images/". $GID. "/" . $GID . "-" . $i . ".jpg";<commit_msg>Problem with DATA API solved<commit_after><?php

	require 'autoload.php';
	/* --------------------------------------
	/* File to handle all API requests
	/* Accepts GET and POST
	/* --------------------------------------
	/* Each request will be identified by TAG
	/* Response will be JSON data
	/* --------------------------------------
	/* check for POST request 
	/*/
	if ((isset($_POST['GID'])            && $_POST['GID']             != '') && 
	  	(isset($_POST['Username'])       && $_POST['Username']        != '') &&
	  	(isset($_POST['ApplicantName'])  && $_POST['ApplicantName']   != '') &&
	  	(isset($_POST['FatherName'])     && $_POST['FatherName']      != '') &&
	  	(isset($_POST['CNIC'])           && $_POST['CNIC']            != '') &&
	  	(isset($_POST['PhoneNumber'])    && $_POST['PhoneNumber']     != '') &&
	  	(isset($_POST['Address'])        && $_POST['Address']         != '') &&
	  	(isset($_POST['Damage'])         && $_POST['Damage']          != '') &&
	  	(isset($_POST['Date'])           && $_POST['Date']            != '') &&
	  	(isset($_POST['Detail'])         && $_POST['Detail']          != '') &&
	  	(isset($_POST['RawData'])        && $_POST['RawData']          != '')
		) {

			// get tag
  			$GID = $_POST['GID'];
			$Username = $_POST['Username'];
			$ApplicantName = $_POST['ApplicantName'];
			$FatherName = $_POST['FatherName'];
			$CNIC = $_POST['CNIC'];
			$PhoneNumber = $_POST['PhoneNumber'];
			$Address = $_POST['Address'];
			$Damage = $_POST['Damage'];
			$Date = $_POST['Date'];
			$Detail = $_POST['Detail'];
			$RawData = $_POST['RawData'];

			// include db handler
			$db = new \ClassLibrary\DBFunctions();

			// response Array
			$response = array("Status" => 0);

			// check for user
			$data = $db->insertDataInTable($GID, $Username, $ApplicantName, $FatherName, $CNIC, $PhoneNumber, $Address, $Damage, $Date, $Detail);
			if ($data != false) {
				// Data inserted found
				// Now Convert Rawdata to Images
  				$ImagesArray = explode("|", $RawData);
				$i = 1;
				foreach ($ImagesArray as $image) {
					$binary = base64_decode($image);
					$imgaeDirectory = "../img/pdma-survey-images/" . $GID;
					var_dump($imgaeDirectory);
					mkdir($imgaeDirectory);
					header('Content-Type: bitmap; charset=utf-8');
					$imagePath = "../img/pdma-survey-images/". $GID. "/" . $GID . "-" . $i . ".jpg";
{'fraction_non_alphanumeric': 0.2629127857747671, 'fraction_numerical': 0.0021168501270110076, 'mean_word_length': 2.23187414500684, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5777873', 'n_tokens_mistral': 1669, 'n_tokens_neox': 1451, 'n_words': 278}