-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathclients.php
35 lines (29 loc) · 1.19 KB
/
clients.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
<?php
$auth_required = true;
require_once("../config.php");
$htmlOutput = "";
$htmlOutput .= "<h1>Clients</h1>";
$htmlOutput .= "<form action='add_client.php' method='post' autocomplete='off'>";
$clients = get_clients();
if ( count($clients) != 0 ) {
$htmlOutput .= "<ul>";
foreach ( $clients as $id => $client ){
$name = $client["name"];
$ip = $client["ip"];
$htmlOutput .= "<li>".$name." (".$ip.") <button class='btn btn-remove' type='submit' name='client_ip' value='remove: ".$ip."'>Remove</button></li>";
}
$htmlOutput .= "</ul>";
}
else {
$htmlOutput .= "None<br>";
}
$htmlOutput .= "</form>";
$htmlOutput .= "<br><hr><br>";
$htmlOutput .= "<h3>Add a client</h3>";
$htmlOutput .= "<form action='add_client.php' method='post' autocomplete='off'>
Name <input type='text' name='client_name'><br>
IP <input type='text' name='client_ip' required><br>
<input class='btn' type='submit' value='Add Client'>";
$htmlOutput .= "<script>document.body.onload=function(){document.getElementsByName('client_name')[0].focus()}</script>";
$htmlOutput .= "<br><br><br><br><a class='btn btn-green' href='".$base_url."admin/'>Go to Allow Voting</a>";
include("../template.php");