Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. import cgi
  2. import cgitb; cgitb.enable()
  3. import BaseHTTPServer
  4. from SimpleHTTPServer import SimpleHTTPRequestHandler
  5. # get the info from the html form
  6. form = cgi.FieldStorage()
  7. #set up the html stuff
  8. reshtml = """Content-Type: text/htmln
  9. <html>
  10. <head><title>login</title></head>
  11. <body>
  12. """
  13.  
  14. print reshtml
  15.  
  16. User_Name = form.getvalue('User_Name')
  17. password = form.getvalue('Pass_Word')
  18. log="info: "
  19. if User_Name == 'NAME' and password == 'passcode':
  20. log=log+"login passed "
  21. else:
  22. log=log+"login failed "
  23. print log
  24. print '</body>'
  25. print '</html>'
  26.  
  27. #!/Python27/python
  28. print "Content-type: text/html"
  29. print
  30. print """
  31. <html><head>
  32. <title>log in</title>
  33. </head><body>
  34. """
  35. import sha, time, Cookie, os, fileinput, cgi, cgitb
  36. import sys
  37. import BaseHTTPServer
  38. from SimpleHTTPServer import SimpleHTTPRequestHandler
  39. log = "info: "
  40. cookie = Cookie.SimpleCookie()
  41. string_cookie = os.environ.get('HTTP_COOKIE')
  42. string_cookie = str(string_cookie)
  43. infoform = """
  44. <link rel="stylesheet" type="text/css" href="styles/home.css" media="screen" />
  45. <div id="top" style=" height:50px;width:100%;position:absolute;left:0px;top:0px;" >
  46. <form action="router.py" method="post" target="_self">
  47. <div id="form" style="position:absolute;left:15px;top:20px;" >
  48. <input type="text" name="User_Name" value="User Name">
  49. <input type="password" name="Pass_Word" value="Password">
  50. <input type="hidden" name="status_url">
  51. <input type="submit" value="Log in">
  52. </div>
  53. </form>
  54. <div ID"home"></div>
  55. </div>
  56.  
  57. <div id="GBbody" style="position:absolute;left:1px;top:55px;height:100%;width:100%;" >
  58. <p id="disply">
  59. <center><h2>
  60. Hi, and welcome!
  61. </h2></center>
  62. <h4>
  63. Did you know: just the movie player and code that goes with it takes<br>
  64. 474 lines of code so-far, and may not work many web browsers (for the time being), however <br>
  65. Google chrome is fully compatible at this point.
  66. </h4>
  67. </p>
  68. </div>
  69. """
  70. loginas = """
  71. <form action="home.py" method="post" target="_self">
  72. <input type="submit" value="Continue last session" style="position:absolute;right:15px;top:20px;">
  73. </form>
  74. """
  75. if "sess" in string_cookie:
  76. infoform = infoform.replace('<div ID"home"></div>',loginas)
  77. print infoform
  78. else:
  79. print infoform
  80.  
  81. print "</body></html>"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement