forked from theraw/FOS-Streaming-v69
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage_ipblock.php
45 lines (37 loc) · 1.04 KB
/
manage_ipblock.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
<?php
include('config.php');
logincheck();
$message = [];
$title = "Create ipblock";
$ipblock = new BlockedIp;
$edit = 0;
if (isset($_GET['id'])) {
$title = "Edit ipblock";
$ipblock = BlockedIp::find($_GET['id']);
}
if (isset($_POST['submit'])) {
$error = 0;
$exists = BlockedIp::where('ip', '=', $_POST['ip'])->get();
if (empty($_POST['ip'])) {
$message['type'] = "error";
$message['message'] = "ip field cannot be empty";
$error = 1;
}
if ($error == 0) {
$message['type'] = "success";
if (isset($_GET['id'])) {
$message['message'] = "ipblock edited";
} else {
$message['message'] = "ipblock Created";
}
$ipblock->ip = $_POST['ip'];
$ipblock->description = $_POST['description'];
$ipblock->save();
redirect("manage_ipblock.php?id=" . $ipblock->id, 2000);
}
}
echo $template->view()->make('manage_ipblock')
->with('ipblock', $ipblock)
->with('message', $message)
->with('title', $title)
->render();