-
-
Save mikuta0407/9464d86a597b9a08660387e3a9dcdff1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ログイン処理 | |
curl -X POST https://call.off.tcu.ac.jp/index.php -d "uid=ログインID" -d "pass=パスワード" -d "menuname=%8Fo%90%C8" -d "module=Default" -d "action=Login" | nkf > /var/www/cgi-bin/htmlcache/selectkamoku.html | |
# selectkamoku.htmlがログイン後のページ全てなので、以下はすべてこれを利用して処理 | |
# ログイン可否判定 | |
cat /var/www/cgi-bin/htmlcache/selectkamoku.html | grep パスワード > /dev/null | |
if [ $? = 0 ]; then | |
# ログイン失敗 | |
echo "Content-Type: text/html; charset=UTF-8" | |
echo "" | |
cat /var/www/cgi-bin/htmlcache/selectkamoku.html | |
exit | |
else | |
# ログイン成功のとき | |
# 時間外かどうかを判定 | |
cat /var/www/cgi-bin/htmlcache/selectkamoku.html | grep 現在時間に > /dev/null | |
if [ $? = 0 ]; then | |
# 時間外のとき | |
echo "Content-Type: text/html; charset=UTF-8" | |
echo "" | |
echo "<b>時間外</b><br><br>" | |
cat /var/www/cgi-bin/htmlcache/selectkamoku.html | |
else | |
# 時間内で登録ができるとき | |
# セッションID持ってくる | |
sessid=`cat /var/www/cgi-bin/htmlcache/selectkamoku.html | grep "PHPSESSID" | sed -e 's/<form action="index.php" method="post"><input type="hidden" name="PHPSESSID" value="//g' | sed -e 's/" \/>//g'` | |
# 科目の番号 | |
selkamoku=`cat /var/www/cgi-bin/htmlcache/selectkamoku.html | grep '[0-9]\{4\},[0-9]\{8\}' | sed -e 's/<option value="//g' | sed -e 's/">.*//g'` | |
# 出席登録 | |
curl -X POST https://call.off.tcu.ac.jp/index.php --cookie "PHPSESSID=${sessid}" -d "module=Sk" -d "action=ProcedureAcc" -d "SelKamoku=${selkamoku}" -d "InpNo=${1}" -d "submitButtonName=%8Fo%90%C8%93o%98%5E" | nkf > /var/www/cgi-bin/htmlcache/success.html | |
# 最終結果表示 | |
echo "Content-Type: text/html; charset=UTF-8" | |
echo "" | |
echo "<b>登録処理</b><br><br>" | |
cat /var/www/cgi-bin/htmlcache/success.html | |
fi | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment