Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. #!/usr/bin/python
  2. import cgi
  3. import cgitb; cgitb.enable()
  4.  
  5. form = cgi.FieldStorage()
  6.  
  7. new = open("survey.ssv", "r+")
  8. new.write(form.getvalue("surveyQuestion")+"n")
  9. new.seek(0)
  10. lines = new.readlines()
  11. i = 0
  12.  
  13. print "Content-type:text/htmlrnrn"
  14. print "<html>"
  15. print "<head>"
  16. print "<title>Create-a-Survey!</title>"
  17. print "</head>"
  18. print "<body bgcolor='white' text='black'>"
  19. print "<center>"
  20. print "<h1>Create Survey Page</h>"
  21. print "</center>"
  22. print "To create a survey first input a title in the 'Survey Title' text box. To add questions, write a question in the 'Survey Question' text box and click the 'Add' button. If you want to create a new survey, write a new survey title and click 'New'. The 'Done' button will end the survey creation and return you to the welcome page."
  23. print "<br><br>"
  24.  
  25. for line in lines:
  26. if i == 0:
  27. print "Current Survey Title:<br>%s" % line
  28. print "<br><br>"
  29. print '<form action="newSurvey.py" method="post">'
  30. print 'Survey Title:<br><input type="text" name="surveyTitle">'
  31. print '<input type="submit" name="decision" value="New">'
  32. print '</form>'
  33. print '<br><br>'
  34.  
  35. else:
  36. print "Question %d:<br>%s" % i, % line
  37. print '<br><br>'
  38. i = i + 1
  39. new.close()
  40. print '<form action="addQuestion.py" method="post">'
  41. print 'Survey Question:<br><input type="text" name="surveyQuestion">'
  42. print '<br><br>'
  43. print '<input type="submit" name="decision" value="Add">'
  44. print '</form>'
  45. print '<form action="doneSurvey.py" method="post">'
  46. print '<input type="submit" name="decision" value="Done">'
  47. print '</form>'
  48. print '<a href="welcome.html">Back to welcome page</a>'
  49. print '</body>'
  50. print '</html>'
  51.  
  52. #!/usr/bin/python
  53. import cgi
  54. import cgitb; cgitb.enable() # enable debugging mode
  55.  
  56. form = cgi.FieldStorage()
  57.  
  58. new = open("survey.ssv", "r+")
  59. new.write(form.getvalue("surveyQuestion")+"n")
  60. lines = new.readlines()
  61. i = 0
  62.  
  63. print "Content-type:text/htmlrnrn"
  64. print "<html>"
  65. print "<head>"
  66. print "<title>Create-a-Survey!</title>"
  67. print "</head>"
  68. print "<body bgcolor='white' text='black'>"
  69. print "<center>"
  70. print "<h1>Create Survey Page</h>"
  71. print "</center>"
  72. print "To create a survey first input a title in the 'Survey Title' text box. To add questions, write a question in the 'Survey Question' text box and click the 'Add' button. If you want to create a new survey, write a new survey title and click 'New'. The 'Done' button will end the survey creation and return you to the welcome page."
  73. print "<br><br>"
  74.  
  75. for line in lines:
  76. if i == 0:
  77. print "Current Survey Title:<br>%s" % line
  78. print "<br><br>"
  79. print '<form action="newSurvey.py" method="post">'
  80. print 'Survey Title:<br><input type="text" name="surveyTitle">'
  81. print '<input type="submit" name="decision" value="New">'
  82. print '</form>'
  83. print '<br><br>'
  84.  
  85. else:
  86. print "Question %d:<br>%s" % i, % line
  87. print '<br><br>'
  88. i = i + 1
  89. new.close()
  90. print '<form action="addQuestion.py" method="post">'
  91. print 'Survey Question:<br><input type="text" name="surveyQuestion">'
  92. print '<br><br>'
  93. print '<input type="submit" name="decision" value="Add">'
  94. print '</form>'
  95. print '<form action="doneSurvey.py" method="post">'
  96. print '<input type="submit" name="decision" value="Done">'
  97. print '</form>'
  98. print '<a href="welcome.html">Back to welcome page</a>'
  99. print '</body>'
  100. print '</html>'
  101.  
  102. print "Question %d:<br>%s" % i, % line
  103.  
  104. print "Question %d:<br>%s" % (i, line)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement