-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddRecord.php
More file actions
70 lines (66 loc) · 2.62 KB
/
addRecord.php
File metadata and controls
70 lines (66 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
require "helpers.php";
if (
isset($_POST['data']) && isset($_POST['recordType']) && isset($_POST['subdomain']) && isset($_POST['ttl']) &&
isset($_POST['aux']) && intval($_POST['ttl'] >= 0) && intval($_POST['aux'] >= 0) && !str_contains($_POST['subdomain'], " ")
) {
$opts = array(
'http' => array(
'method' => "GET",
'header' => "x-api-key: $apikey\r\n"
)
);
$context = stream_context_create($opts);
$data = urlencode($_POST['data']);
$recordType = urlencode($_POST['recordType']);
$subdomain = urlencode($_POST['subdomain']);
$ttl = urlencode($_POST['ttl']);
$aux = urlencode($_POST['aux']);
$response = file_get_contents("$apiAddress/addRecord.php?data=$data&recordType=$recordType&" .
"subdomain=$subdomain&ttl=$ttl&aux=$aux", false, $context);
if ($response == "success") {
header("Location: ./index.php?success");
die();
} else {
header("Location: ./index.php?fail");
die();
}
}
HeaderMenu();
?>
<div class="tab-content">
<div class="header">
<h2>DNS yönetim sistemi - Kayıt ekle</h2>
</div>
<div class="content">
<form action="./addRecord.php" method="POST">
<div class="form-group">
<!-- <input type="hidden" id="tur" name="tur" value="kullanici" /> -->
</div>
<div class="form-group">
<label for="subdomain">Subdomain</label>
<input type="text" class="form-control" id="subdomain" name="subdomain" placeholder="subdomain" />
</div>
<div class="form-group">
<label for="recordType">Record Type</label>
<input type="text" class="form-control" id="recordType" name="recordType"
placeholder="A,AAAA,MX,TXT..." />
</div>
<div class="form-group">
<label for="data">Data</label>
<input type="text" class="form-control" id="data" name="data" placeholder="data" />
</div>
<div class="form-group">
<label for="ttl">TTL</label>
<input type="number" min="0" max="100000" class="form-control" value="3600" id="ttl" name="ttl"
placeholder="3600" />
</div>
<div class="form-group">
<label for="aux">aux</label>
<input type="number" min="0" max="100000" class="form-control" value="0" id="aux" name="aux"
placeholder="0" />
</div>
<button type="submit" class="btn btn-primary">Ekle</button>
</form>
</div>
</div>