forked from HackerspaceBielefeld/HSBot2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
84 lines (76 loc) · 2.31 KB
/
index.php
File metadata and controls
84 lines (76 loc) · 2.31 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
<?php
if($_SERVER['REMOTE_USER'] == 'gastwlan'){
$zeichen = "abcedfghijkmnopqrstuvwxyz23456789";
$pw = "GastimHS!";
/*@mt_srand ((double) microtime() * 1000000);
for ($i = 0; $i < 8; $i++ ) {
$r = mt_rand(0,strlen($zeichen)-1);
$pw .= $zeichen{$r};
}*/
$h = fopen('cache/gwp.txt',w);
flock($h,2);
fputs($h,'GAST-WLAN-Passwort: '. $pw);
flock($h,3);
fclose($h);
header('Content-type: plain/text');
header('Content-Disposition: attachment; filename="gastwlan.txt"');
echo $pw;
}else{
error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);
echo '<html><head></head><body>
<a href="index.php?a=infos">Infos</a><a href=""></a><hr/>';
if(isset($_GET['a'])) {
$a = $_GET['a'];
}else{
$a = '';
}
if($a == 'infos') {
if(isset($_GET['s'])) {
if($_GET['s'] == 'del') {
$f = str_replace('/','_',$_GET['f']);
unlink('info/'.$f.'.txt');
unset($_GET['f']);
}
if($_GET['s'] == 'act') {
$f = str_replace('/','_',$_GET['f']);
if(substr($f,0,1) == '.') {
rename('info/'.$f.'.txt','info/'.substr($f,1) .'.txt');
}else{
rename('info/'.$f.'.txt','info/.'. $f .'.txt');
}
unset($_GET['f']);
}
}
if(isset($_GET['f'])) {
$f = str_replace('/','_',$_GET['f']);
if(isset($_POST['submit'])) {
$h = fopen('info/'.$f.'.txt','w');
$content = str_replace("\r",'',$_POST['content']);
flock($h,2);
fputs($h, $content);
flock($h,3);
fclose($h);
}else{
$content = file('info/'.$f.'.txt');
echo '<h2>'.$f.'</h2><form action="index.php?a=infos&f='. $f .'" method="post">
<textarea name="content" cols="30" rows="10">'. implode('',$content) .'</textarea><br/>
<input type="submit" name="submit" value="Editieren" />
</form>';
}
}else{
$d = opendir("info/");
while($f = readdir($d)) {
if(!is_dir("info/".$f)) {
$f = substr($f,0,-4);
echo '<a href="index.php?a=infos&f='. $f .'">'.$f.'</a> [<a href="index.php?a=infos&f='. $f .'&s=del">Löschen</a> <a href="index.php?a=infos&f='. $f .'&s=act">(De)Aktivieren</a>]<br/>';
}
}
echo '<form action="index.php" method="get">
<input type="hidden" name="a" value="infos" />
<input type="text" name="f" /> <input type="submit" value="Anlegen" />
</form';
}
}
}
?>