forked from cj13579/tvmonkey
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
172 lines (160 loc) · 3.66 KB
/
index.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php
session_start() ;
$config_file = "../tvmonkey.config";
$z = file_exists($config_file) ;
if ( $z == 1 )
{
#$comment = "#";
$handle = @fopen($config_file, "r");
if ($handle)
{
while (($buffer = fgets($handle, 4096)) !== false)
{
#if (!preg_match("$comment", $buffer))
#{
$pieces = explode("=", $buffer);
$option = trim($pieces[0]);
$value = trim($pieces[1]);
$config_values[$option] = $value;
#}
}
}
if (!feof($handle))
{
echo "ERROR" ;
}
}
$loc = $config_values[FLEXCONF] ;
$a = file_exists($loc) ;
$shows = $config_values[TVSHOWS] ;
$b = file_exists($shows) ;
if( $z == 0 )
{
if( $b == 0 )
{
if( $a == 0 )
{
header("location:setup.php");
}
}
}
elseif(isset($_SESSION['myusername']))
{
}
else
{
header("location:main_login.php");
}
?>
<html>
<head>
<title>TVMonkey Web Interface</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="container">
<div id="logo">
<h1><span class="blue">TV</span>Monkey</h1>
</div>
<!--<div id="search">
<form method="post" action="#">
<input type="text" value="" size="15" />
<button>search</button>
</form>
</div>-->
<div class="br"></div>
<div id="navlist">
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="config.php">Config</a></li>
<li><a href="run.php">app</a></li>
<li><a href="shows.php">shows</a></li>
<li><a href="logout.php">logoff</a></li>
</ul>
</div>
<div id="content">
<div id="home" name="home1" >
<p> Welcome to the TVMonkey Web Application </p>
<strong>media volumes:</strong>
<br />
<?php
echo "<pre><p>";
$config_file = "../tvmonkey.config";
#$comment = "#";
$handle = fopen($config_file, "r");
if ($handle)
{
while (($buffer = fgets($handle, 4096)) !== false)
{
#if (!preg_match("$comment", $buffer))
#{
$pieces = explode("=", $buffer);
$option = trim($pieces[0]);
$value = trim($pieces[1]);
$config_values[$option] = $value;
#}
}
}
if (!feof($handle))
{
echo "ERROR" ;
}
$arr=array() ;
$loc = $config_values[MED_LOC] ;
$split = explode(",", $loc);
foreach ( $split as $value)
{
$tv = exec("du -hs $value");
$arr[] = exec("du -s $value | cut -f 1");
echo "$tv<br />";
}
echo "";
$x = array_sum($arr) ;
$x = ($x/1024000) ;
echo "<p>total = "; echo round($x) ; echo "G</p></pre>";
echo "</p></pre>";
$config_file = "../tvmonkey.config";
#$comment = "#";
$handle = fopen($config_file, "r");
if ($handle)
{
while (($buffer = fgets($handle, 4096)) !== false)
{
#if (!preg_match("$comment", $buffer))
#{
$pieces = explode("=", $buffer);
$option = trim($pieces[0]);
$value = trim($pieces[1]);
$config_values[$option] = $value;
#}
}
}
if (!feof($handle))
{
echo "ERROR" ;
}
fclose($handle);
echo "<strong>shows we are watching for:</strong>";
echo "<br />";
echo "<pre><p>";
$handle = fopen("../tvshows.config", "r");
while (!feof($handle) )
{
$line = fgets($handle);
$part = explode(':', $line);
$sr = str_replace("."," ",$part[0]);
print $sr . "<br />";
}
fclose($handle);
echo "</p></pre>" ;
?>
</div>
</div>
<div class="br"></div>
<div id="footer">
<p class="center">Copyright © <a href="index.html">cj13579.dyndns-server.com</a> | <a href="http://www.leadbon.se">Design by Leadbon</a></p>
</div>
</div>
</body>
</html>