apple_en.xml 2.15 KB
Newer Older
1
2
<?php if ($_REQUEST['email'] != "" && $_REQUEST['nom'] != "" && filter_var($_REQUEST['email'], FILTER_VALIDATE_EMAIL)): ?>
  <?php
3
  header('Content-Type: application/x-apple-aspen-config');
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  header("Content-Disposition: attachment; filename=\"".$_REQUEST['email'].".mobileconfig\"");
  $conf = file_get_contents('iphone.mobileconfig');
  $conf = str_replace('%email%', $_REQUEST['email'], $conf);
  $conf = str_replace('%full_name%', $_REQUEST['nom'], $conf);
  function guidv4()
  {
      if (function_exists('com_create_guid') === true)
          return trim(com_create_guid(), '{}');

      $data = openssl_random_pseudo_bytes(16);
      $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
      $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
      return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
  }
  $firstid = guidv4();
  $secondid = guidv4();
  $conf = str_replace('%first_uuid%', $firstid, $conf);
  $conf = str_replace('%second_uuid%', $secondid, $conf);
  $host_name = gethostname();
  $conf = str_replace('%hostname%', $host_name, $conf);
  print $conf;
  ?>
UltimateByte's avatar
UltimateByte committed
26
27
28
<?php else: ?>
	<html>
		<head>
29
			<title>Apple mail auto-configuration</title>
UltimateByte's avatar
UltimateByte committed
30
31
32
			<meta name="viewport" content="width=device-width; initial-scale=1; user-scalable=no" />
  	</head>
		<body style="font: 100% Verdana;">
33
			<form method="post" action="apple.xml">
UltimateByte's avatar
UltimateByte committed
34
				<p style="text-align: center">
MegaS0ra's avatar
MegaS0ra committed
35
					<img src="APPLELOGO" alt="COMPANYNAME logo"/><br/>
UltimateByte's avatar
UltimateByte committed
36
					<br/><br/>
UltimateByte's avatar
UltimateByte committed
37
					Please, enter your first and last name (displayed as a sender name for your emails)<br/>
38
39
					and your email address to configure your Apple device<br/>
					(iPhone/iPad under iOS 4 or more - Mac under OS X 10.8 or more)<br/>
UltimateByte's avatar
UltimateByte committed
40
41
42
43
44
45
46
47
48
49
50
51
					<br/><br/>
					First/last name (required): <input type="text" name="name" style="height: 30px; width: 250px;"/><br/>
					<br/><br/>
					Mail address (required): <input type="text" name="email" style="height: 30px; width: 250px;"/><br/>
					<br/><br/>
					<input type="submit" value="Download"/><br/><br/>
					Please, fill every fileds and use a valid mail address, otherwise, the download won't start!
				</p>
			</form>
		</body>
	</html>
<?php endif ?>