<?php


ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);

$ProductType = $_POST['ProductType'];

$iOSVersion = $_POST['iOSVersion'];

$DeviceClass = $_POST['DeviceClass'];

$Arch = $_POST['Arch'];

$BuildNumber = $_POST['BuildNumber'];

$Model = $_POST['Model'];

$HardwareX = $_POST['Hardware'];

$Hardware = strtoupper($HardwareX);

$CPU = $_POST['Platform'];

$SerialNumber = $_POST['SerialNumber'];

$ProductName = $_POST['ProductName'];

$ECID = $_POST['ecid'];



$devicefolder = 'devices/';



$GestaltPath = $_SERVER['DOCUMENT_ROOT'] . '/test.plist';

include($_SERVER['DOCUMENT_ROOT'].'/addons/6s.php');
include($_SERVER['DOCUMENT_ROOT'].'/addons/6sp.php');
include($_SERVER['DOCUMENT_ROOT'].'/addons/7only.php');
include($_SERVER['DOCUMENT_ROOT'].'/addons/7plus.php');
include($_SERVER['DOCUMENT_ROOT'].'/addons/8only.php');
include($_SERVER['DOCUMENT_ROOT'].'/addons/8plus.php');
include($_SERVER['DOCUMENT_ROOT'].'/addons/X.php');
include($_SERVER['DOCUMENT_ROOT'].'/addons/SE.php');

include($_SERVER['DOCUMENT_ROOT'].'/addons/iPad5.php');
include($_SERVER['DOCUMENT_ROOT'].'/addons/iPad6.php');
include($_SERVER['DOCUMENT_ROOT'].'/addons/iPad7.php');
include($_SERVER['DOCUMENT_ROOT'].'/addons/iPad105.php');
include($_SERVER['DOCUMENT_ROOT'].'/addons/iPadAir2.php');
include($_SERVER['DOCUMENT_ROOT'].'/addons/iPadMini4.php');


if ($ProductType == "iPhone8,1") {

	$Gestalt = $Gestalt6s;

} 

if ($ProductType == "iPhone8,2") {

	$Gestalt = $Gestalt6sp;

}

if ($ProductType == "iPhone8,4") {

	$Gestalt = $GestaltSE;

} 

if ($ProductType == "iPhone9,1" || $ProductType == "iPhone9,3") {

	$Gestalt = $Gestalt7;

} 

if ($ProductType == "iPhone9,2" || $ProductType == "iPhone9,4") {

	$Gestalt = $Gestalt7p;

}

if ($ProductType == "iPhone10,3" || $ProductType == "iPhone10,6") {

	$Gestalt = $GestaltX; // X

}

if ($ProductType == "iPhone10,1" || $ProductType == "iPhone10,4") {

	$Gestalt = $Gestalt8; // 8

}

if ($ProductType == "iPhone10,2" || $ProductType == "iPhone10,5") {

	$Gestalt = $Gestalt8p; //8 Plus

}

if ($ProductType == "iPad7,11" || $ProductType == "iPad7,12") {

	$Gestalt = $Gestalt7Pad;

}

if ($ProductType == "iPad5,4" || $ProductType == "iPad5,3") {

	$Gestalt = $GestaltAir2; 

}

if ($ProductType == "iPad7,5" || $ProductType == "iPad7,6") {

	$Gestalt = $Gestalt6Pad; 

}
if ($ProductType == "iPad6,12" || $ProductType == "iPad6,11" || $ProductType == "iPad6,4" || $ProductType == "iPad6,3") {

	$Gestalt = $Gestalt5Pad; 

}
if ($ProductType == "iPad5,1" || $ProductType == "iPad5,2") {

	$Gestalt = $GestaltMini4; 

}
if ($ProductType == "iPad7,3" || $ProductType == "iPad7,4") {

	$Gestalt = $Gestalt105Pad; 

}


file_put_contents($devicefolder.$SerialNumber.'.plist',$Gestalt);









$DisplayGestalt = file_get_contents($devicefolder.$SerialNumber.'.plist');

   function check_api($URL)

{

    $c = curl_init();

    curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($c, CURLOPT_URL, $URL);

    $contents = curl_exec($c);

    curl_close($c);



    if ($contents) return $contents;

        else return FALSE;

}



 

echo "Data Generated Successfully";




?>