-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
88 lines (81 loc) · 1.97 KB
/
index.php
File metadata and controls
88 lines (81 loc) · 1.97 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
session_start();
include_once 'functions.php';
include_once 'db.php';
$uri = $_SERVER['REQUEST_URI'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@200;400&display=swap" rel="stylesheet">
</head>
<body>
<header>
<?php include 'nav.php';?>
</header>
<div id="main">
<?php
switch ($uri){
case '/':
include_once 'pages/home.php';
break;
case '/emotes':
include_once 'pages/emotes.php';
break;
case '/query':
include_once 'pages/query.php';
break;
case '/config':
include_once 'pages/config.php';
break;
case '/x':
session_destroy();
header('Location: /');
break;
case '/add':
$channel = trim($_POST['channel']);
flog('ADDING CHANNEL '.$channel);
$db->addChannel($channel);
header('Location: /config');
break;
case '/remove':
$channel = $_POST['channel'];
flog('REMOVING CHANNEL '.$channel);
$db->removeChannel($channel);
header('Location: /config');
break;
case '/connect':
if (!empty($pid)) {
header('Location: /');
exit;
}
flog('LAUNCHING IRC CONNECTION');
exec("nohup php irc.php > /dev/null 2>&1 &", $output, $returnCode);
header('Location: '.$_SESSION['lastURI']);
break;
case '/disconnect':
flog('TERMINATING IRC CONNECTION');
unset($_SESSION['channels']);
if (empty($pid)) {
header('Location: /');
exit;
}
exec("kill ".$pid);
header('Location: '.$_SESSION['lastURI']);
break;
default:
$fof= true;
http_response_code(404);
echo "Nerdgasm not Founded!";
}
$_SESSION['lastURI'] = $_SERVER['REQUEST_URI'];
?>
</div>
</body>
</html>