-
Notifications
You must be signed in to change notification settings - Fork 1
/
irclogger_password
executable file
·75 lines (66 loc) · 1.56 KB
/
irclogger_password
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
#!/bin/bash
set -a
. irclogger_cgiparse
. irclogger_common
CHAN=${PATH_INFO#/}
STYLE=
cd $logsdir
if [ -e style.css ]; then STYLE="`cat style.css`";fi
cd $logsdir/$CHAN
if [ -e style.css ]; then STYLE="$STYLE`cat style.css`";fi
pass="$FORM_pass"
main() {
if acces_protected "$CHAN"
then action=change
else
if protectable "$CHAN"
then action=set
else echo "Location: ${SCRIPT_NAME%/*}/irclogger_logs/$CHAN";echo
exit 0
fi
fi
if [ -z "$pass" ]
then show_form "$CHAN"
else perform_password_change "$CHAN" "$pass"
fi
}
show_form () {
echo "Content-type: text/html; charset: ISO-8859-1
<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">
<html>
<head>
<title>#$CHAN irc log $action password</title>
<style type='text/css'> $STYLE </style>
</head>
<body>
<h1>#$CHAN irc log $action password</h1>
<a href='${SCRIPT_NAME%/*}/irclogger_logs/$CHAN'>↑back</a>
<form>
<input type=text name=pass size=32>
<input type=submit value='Set new password'>
</form>
</body></html>"
}
perform_password_change () {
echo "Content-type: text/html; charset: ISO-8859-1
<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">
<html>
<head>
<title>#$CHAN irc log $action password</title>
<style type='text/css'> $STYLE </style>
</head>
<body>
<h1>#$CHAN irc log $action password</h1>
<a href='${SCRIPT_NAME%/*}/irclogger_logs/$CHAN'>↑back</a>
<p>Changing passwords:
<pre>"
htpasswd -b $passfile "$1" "$2" 2>&1
htpasswd -b $passfile "#$1" "$2" 2>&1
echo "</pre>
Done.</body></html>"
}
main
### EMACS MODES
### Local Variables: ***
### mode:ksh ***
### End: ***