Advertisement
Guest User

cgi-bin bash apache termux

a guest
Apr 21st, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.62 KB | None | 0 0
  1. #!/data/data/com.termux/files/usr/bin/bash
  2. echo "Content-type: text/html"
  3. echo ""
  4. QUERY=$QUERY_STRING
  5. IFS="&"
  6. set -- $QUERY
  7. array=($@)
  8. declare -A get_post
  9. for i in "${array[@]}";do
  10. IFS="=" ;
  11. set -- $i;
  12. get_post[$1]=$2
  13. done
  14. QUERY_STRING=$(echo $QUERY_STRING | sed 's/&/ /')
  15. inp=`echo "${get_post['text']}" | sed 's/+/ /g'`
  16. cat << EOF
  17. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  18. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
  19. <div class="container">
  20. <h3>contoh input data dynamic</h3>
  21. <h4>bash cgi query string</h4>
  22.         <form method="get" class="form-horizontal">
  23.                 <div class="form-group">
  24.                         <div class="col-sm-10">
  25.                         <input name="text" value="$inp"></input>
  26.                         </div>
  27.                 </div>
  28.                 <div class="form-group">
  29.                         <div class="col-sm-offset-2 col-sm-10">
  30.                         <button class="btn" name="submit" type="submit" value="action" > action </button>
  31.                         </div>
  32.                 </div>
  33.         </form>
  34. </div>
  35. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
  36. EOF
  37. if [ ${get_post["submit"]} == "action" ];then
  38. printf "<div class=\"col-sm-offset-2 col-sm-10\"><p>anda menulis:</p> \
  39.        <p class="text-success">$inp</p></div>"
  40. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement