Advertisement
UnaClocker

CGI Script for XMas2011

Jan 2nd, 2012
869
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.80 KB | None | 0 0
  1. #! /bin/bash
  2.  
  3. echo "Content-type: text/html"
  4. echo ""
  5. echo "<html>"
  6. echo "<head><title>XMas Mode and Speed Control</title></head>"
  7. echo "<body>"
  8. echo "<table width=100% cellpadding=0 cellspacing=10 border=0>"
  9. echo "<tr>"
  10. echo "<td width=50% valign=top>"
  11. echo "<form method=get>"
  12. echo "<input type=radio name=mode value=1> Chaser<br>"
  13. echo "<input type=radio name=mode value=2> In & Out<br>"
  14. echo "<input type=radio name=mode value=3> Knight Rider<br>"
  15. echo "<input type=radio name=mode value=4> Police Flasher<br>"
  16. echo "<input type=radio name=mode value=5> Bargraph<br>"
  17. echo "<input type=radio name=mode value=6> Double Chaser<br>"
  18. echo "<input type=radio name=mode value=7> Diving In<br>"
  19. echo "<input type=radio name=mode value=8> Binary Counter<br>"
  20. echo "<input type=submit value='Select Pattern'>"
  21. echo "</form>"
  22. echo "</td>"
  23. echo "<td width=50% valign=top>"
  24. echo "<form method=get>"
  25. echo "<input type=radio name=speed value=8> Very Very Slow<br>"
  26. echo "<input type=radio name=speed value=7> Very Slow<br>"
  27. echo "<input type=radio name=speed value=6> Slow<br>"
  28. echo "<input type=radio name=speed value=5> Moderate<br>"
  29. echo "<input type=radio name=speed value=4> Moderately Fast<br>"
  30. echo "<input type=radio name=speed value=3> Fast<br>"
  31. echo "<input type=radio name=speed value=2> Crazy Fast<br>"
  32. echo "<input type=radio name=speed value=1> Ludicrous Speed<br>"
  33. echo "<input type=submit value='Select Speed'>"
  34. echo "</form>"
  35. echo "</td>"
  36. echo "</body>"
  37. echo "</html>"
  38.  
  39.  
  40. SPEED=`echo "$QUERY_STRING" | sed -n 's/^.*speed=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
  41. MODE=`echo "$QUERY_STRING" | sed -n 's/^.*mode=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
  42.  
  43.  
  44. if [ $MODE ]
  45. then
  46. /usr/bin/wget -t 1 http://192.168.1.1:6058/m$MODE
  47. fi
  48.  
  49. if [ $SPEED ]
  50. then
  51. /usr/bin/wget -t 1 http://192.168.1.1:6058/s$SPEED
  52. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement