# rcp index.html root@$(TESTIP):/var/lib/asterisk/static-http/
test:
- rcp login.sh dashboard.sh network.sh network.js set_network.sh tooltip.js tooltip.css root@$(TESTIP):/www/cgi-bin
+ rcp logout.sh login.sh dashboard.sh dashboard.js network.sh network.js set_network.sh tooltip.js tooltip.css root@$(TESTIP):/www/cgi-bin
--- /dev/null
+function localInit() {
+ $('internet').innerHTML = init_internet;
+}
+
-#!/bin/sh
+#!/bin/sh -x
# dashboard.sh
# David Rowe 4 Jan 2010
# CGI for Easy Asterisk dashboard GUI
# Construct the web page -------------------------------
+echo $HTTP_COOKIE | grep "loggedin" > /dev/null
+if [ $? -eq 1 ]; then
+ echo "<html>"
+ echo "<head>"
+ echo '<meta http-equiv="REFRESH" content="0;url=http:login.sh">'
+ echo "</head>"
+ echo "</html>"
+ exit
+fi
+
cat <<EOF
<script src="prototype.js"></script>
<link href="astman.css" media="all" rel="Stylesheet" type="text/css" />
echo "<script>"
echo 'var init_internet="'$internet'";'
-cat network.js
+cat dashboard.js
echo "</script>"
cat << EOF
</tr>
</table>
</form>
+EOF
+
+echo $HTTP_COOKIE
+cat<<EOF
+</body>
</html>
EOF
if [ $? -eq 0 ]; then
# login sucessful
- cat <<EOF
- <html>
- <head>
- <title>Easy Asterisk - Login</title>
- <meta http-equiv="REFRESH" content="0;url=http:dashboard.sh">
- <body>
- Please wait a few seconds.....
- </body>
- </head>
- </html>
-EOF
+ echo "Content-type: text/html"
+ echo "Set-Cookie: loggedin=1"
+ echo ""
+ echo "<head>"
+ echo "<title>Easy Asterisk - Login</title>"
+ echo '<meta http-equiv="REFRESH" content="0;url=http:dashboard.sh">'
+ echo "<body>"
+ echo "Please wait a few seconds....."
+ echo "</body>"
+ echo "</head>"
else
# login failed
cat <<EOF
--- /dev/null
+#!/bin/sh
+# logout.sh
+# David Rowe 4 Jan 2010
+# CGI for Easy Asterisk logout GUI
+
+cat <<EOF
+Content-type: text/html
+Set-Cookie: loggedin=1; expires=Thursday, 01-Jan-98 12:00:00 GMT
+
+<title>Easy Asterisk - Logout</title>
+EOF
+echo $HTTP_COOKIE