forked from zeus911/SSLChecker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.php
147 lines (120 loc) · 3.73 KB
/
settings.php
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
session_start();
include_once("config.php");
if (!isset($_SESSION['admin']) && $_SESSION['admin'] != 1) {
header('Location: index.php');
return;
}
if (isset($_SESSION['admin'])) {
$x_level = "2";
}
if(!isset($_SESSION['username'])) {
header("Location: login.php");
return;
}
if(isset($_POST['update'])) {
$name = $_POST["name"];
$token = $_POST["token"];
if ($name == "") {
$name = "Unknown";
}
$sql = "INSERT INTO pushbullet (id, name, token) VALUES ('','$name','$token')";
if($token == "") {
$error = "
<div class='alert alert-Danger alert-dismissible fade show' role='alert'>
<button type='button' class='close' data-dismiss='alert'><span>×</span></button>
<strong>Error!</strong><br> Please complete the fields.
</div>
";
} else {
mysqli_query($db, $sql);
$error = "
<div class='alert alert-success alert-dismissible fade show' role='alert'>
<button type='button' class='close' data-dismiss='alert'><span>×</span></button>
<strong>Congratulations!</strong><br> You successfully submitted your request. We'll process it soon.
</div>
";
}
}
?>
<!DOCTYPE html>
<html>
<?php
include("header.php");
?>
<main class="main-container">
<div class="main-content">
<div class="row">
<div class="col-lg-6">
<form class="card" action='settings.php' method='post' enctype='multipart/form-data'>
<div class="card">
<h4 class="card-title"><strong>Add Token</strong></h4>
<?php echo "$error"; ?>
<div class="card-body">
<div class="form-group">
<input class="form-control" type="text" name='name' placeholder="Comment">
</div>
<div class="form-group">
<input class="form-control" type="text" name='token' placeholder="Token">
</div>
<button name="update" type="submit" value="Update" class="btn btn-block btn-bold btn-primary">Submit</button>
</form>
</div>
</div>
</div>
<div class="col-lg-6">
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="card">
<h4 class="card-title"><strong>Pushbullet Tokens</strong></h4>
<div class="card-body">
<?php
include_once("config.php");
$countdown = "countdown";
$output = "";
$ip1 = $_SERVER['REMOTE_ADDR'];
$sql = "SELECT * FROM pushbullet ORDER BY id DESC";
$res = mysqli_query($db, $sql) or die(mysqli_error());
$posts1 = "
<table class='table table-striped'>
<thead>
<tr>
<th>ID</th>
<th>Comment</th>
<th>Token</th>
<tr>
</thead>
<tbody>
";
echo $posts1;
if(mysqli_num_rows($res) > 0) {
while($row = mysqli_fetch_assoc($res)) {
$id = $row["id"];
$name = $row["name"];
$token = $row["token"];
$posts = "
<tr>
<td>$id</td>
<td>$name</td>
<td>$token</td>
</tr>";
echo $posts;
}
}
$posts2 .= "
</tbody>
</table>
";
echo $posts2;
?>
</div>
</div>
</div>
</div>
</div>
<?php
include("footer.php");
?>
</html>