dynamic index site to list all active websites

This commit is contained in:
2015-06-12 12:43:36 +03:00
parent 5b22e79d45
commit ddd9c989d0
2 changed files with 27 additions and 1 deletions

21
server/index.php Normal file
View File

@@ -0,0 +1,21 @@
<html>
<head>
<title>Welcome to MIT</title>
</head>
<body>
<h1>Welcome</h1>
<p>...to the internal website storage server of Moshi Institute of Technology.</p>
<h3>For Students</h3>
<p>To view the <strong>publicly shared files</strong>, please <a href="/public">click here</a>.</p>
<p>Please visit the students' own websites on this server for more.</p>
<p>There're currently following websites active:</p>
<ul>
<?php include 'websites.txt'; ?>
</ul>
<h3>For Teachers</h3>
<p>Teachers can visit the internal shared files (password protected). Please visit <a href="/teachers">this website</a>.<p>
</body>
</html>

View File

@@ -1,13 +1,18 @@
#!/bin/bash
# echo "* * * * * root /root/scripts/server/list-web-users.sh" > /etc/cron.d/list-web-users
DOMAINROOT="mit.tareo-tz.org"
WEBDIR="/var/www/html"
> $WEBDIR/websites.txt
find /var/www/* -maxdepth 0 -type d -print0 | while IFS= read -r -d $'\0' line; do
USER=$(basename $line)
DOMAIN="$USER.$DOMAINROOT"
if [ ! "$USER" == "html" ]; then
echo "<li><a href=\"http://$DOMAIN\">$DOMAIN</a></li>"
echo "<li><a href=\"http://$DOMAIN\">$DOMAIN</a></li>" >> $WEBDIR/websites.txt
fi
done