Inital Commit

This commit is contained in:
aboutDavid 2021-03-08 21:19:58 -05:00
commit 7ff13afa94
1 changed files with 34 additions and 0 deletions

34
guestbook Normal file
View File

@ -0,0 +1,34 @@
#!/bin/bash
PATH_TO_GUESTBOOK="/home/aboutdavid/public_html/guestbook.txt"
PATH_TO_SCRIPT="/home/aboutdavid/guestbook"
URL="https://tilde.club/~aboutdavid/guestbook.txt"
TIMEZONE="EST"
# help page
if [ "$1" = "-h" ]
then
echo "Welcome to guestbook! This is a script made by ~aboutdavid (lol that's me) so people can comment on my website. Run $PATH_TO_SCRIPT [COMMENT] to comment."
exit 0
fi
# This probs isn't needed but idk
if [ "$LOGNAME" != "$USER" ]
then
echo "Failed authentication for guestbook. You may want to restart your SSH session to fix this error."
exit 1
fi
if [ "$1" != "" ]
then
TEXT=$1
TZ=$TIMEZONE
DATE=$(date +"%B %d, %Y (%r)")
echo "From $USER:" >> $PATH_TO_GUESTBOOK
echo $TEXT >> $PATH_TO_GUESTBOOK
echo "Written on $DATE" >> $PATH_TO_GUESTBOOK
echo "" >> $PATH_TO_GUESTBOOK
echo "Thanks for adding something to my guestbook! Visit $URL to see it!"
else
echo "You didn't give me any text to add to the guestbook :(. Run $PATH_TO_SCRIPT -h for more infomation."
exit 1
fi