dynamic index site to list all active websites
This commit is contained in:
21
server/index.php
Normal file
21
server/index.php
Normal 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>
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user