Guest User

Untitled

a guest
Oct 16th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.88 KB | None | 0 0
  1. import random
  2. import os, signal
  3. from datetime import datetime
  4. logfile = open('log.txt', 'r+')
  5. definitions = open('definitionsHtml.txt', 'r')
  6. rights = open ('rights.txt', 'r')
  7. #logfile.truncate()
  8. loglines = logfile.readlines()
  9. global deflines
  10. deflines = definitions.readlines()
  11.  
  12.  
  13. rlines = rights.readlines()
  14. rline1 = rlines[0]
  15. rline2 = rlines[1]
  16. rline3 = rlines[2]
  17. noRun = random.randrange(1, 100)
  18. if noRun == 50:
  19. print()
  20. print("The program just don't like you right now. It no want to run :P")
  21. print()
  22. os.kill(os.getpid(), signal.SIGTERM)
  23. def Start():
  24. logfile.write('Session started at: ' + datetime.now().ctime() + 'nn')
  25. print(logfile.readlines())
  26. print()
  27. print("This tool was made to help programmers, like myself,")
  28. print("with HTML tags. It takes your input, say you typed")
  29. print("<div>, it would give you an accurate description of")
  30. print("that tag and a list of its uses.")
  31. print()
  32. print("Guest users please login as 'Guest'")
  33. print()
  34. print("(Remember, type BASE tags -<p>- ONLY)")
  35. print()
  36.  
  37.  
  38.  
  39. while True:
  40. Username = input("Username: ")
  41. if Username == 'Guest':
  42. Username = 'Guest'
  43. logfile.write('User: Guest' + 'nn')
  44. print()
  45. print('CHECKING..')
  46. time.sleep(2)
  47. print('''
  48. Welcome, Guest!
  49. ''')
  50. Block()
  51. break
  52. elif Username == '/admin061503':
  53. Username = "Admin Chase"
  54. logfile.write('User: Admin Chase' + 'nn')
  55. Pass = input("Password: ")
  56. if Pass == '*************':
  57. Username = 'Admin Chase'
  58. logfile.write('logged in!' + 'nn')
  59. print()
  60. print('CHECKING..')
  61. time.sleep(2)
  62. print('''
  63. Welcome, Admin Chase!
  64. ''')
  65. Block()
  66. break
  67. else:
  68. print()
  69. print("The Input is Incorrect")
  70. print()
  71. logfile.write('Wrong Password has been inputed.' + 'nn')
  72. else:
  73. print()
  74. print('CHECKING..')
  75. time.sleep(2)
  76. print('''
  77. Incorrect Username
  78. ''')
  79.  
  80.  
  81.  
  82.  
  83. def Block():
  84. Input = input("TAG: ")
  85. if Input == 'exit':
  86. answerexit = input("Are you sure? ")
  87. if answerexit == 'yes':
  88. logfile.write('''session ended at: ''' +
  89. datetime.now().ctime() + 'nnn')
  90. logfile.close()
  91. print()
  92. print("SHUTTING DOWN..")
  93. print()
  94. time.sleep(2)
  95. os.kill(os.getpid(), signal.SIGTERM)
  96. elif answerexit == 'no':
  97. print()
  98. print("SHUTDOWN ABORTED..")
  99. print()
  100. Block()
  101. elif Input == 'restart':
  102. print()
  103. print("RESTARTING..")
  104. print()
  105. time.sleep(1.5)
  106. Start()
  107. elif Input == '':
  108. print()
  109. print("Please enter a tag or command.")
  110. print()
  111. Block()
  112. elif Input == 'credits':
  113. print()
  114. print(rline1)
  115. print(rline2)
  116. print(rline3)
  117. print()
  118. Block()
  119. elif Input == '<!DOCTYPE html>':
  120. print()
  121. print(deflines[0])
  122. time.sleep(1)
  123. Block()
  124. elif Input == '<p>':
  125. print()
  126. print(deflines[1], deflines[2], deflines[3], deflines[4], deflines[5], deflines[6], deflines[7], deflines[8])
  127. print()
  128. time.sleep(1)
  129. Block()
  130. elif Input == '<h>':
  131. print()
  132. print(deflines[9], deflines[10], deflines[11], deflines[12], deflines[13], deflines[14], deflines[15], deflines[16])
  133. print()
  134. time.sleep(1)
  135. Block()
  136. elif Input == '<a>':
  137. print()
  138. print(deflines[17], deflines[18], deflines[19], deflines[20], deflines[21], deflines[22], deflines[23], deflines[24], deflines[25])
  139. print()
  140. time.sleep(1)
  141. Block()
  142. elif Input == '<div>':
  143. print(deflines[26], deflines[27], deflines[28], deflines[29], deflines[30], deflines[31], deflines[32], deflines[33], deflines[34])
  144. time.sleep(1)
  145. Block()
  146. elif Input == '<link>':
  147. print(deflines[35], deflines[36], deflines[37])
  148. time.sleep(1)
  149. Block()
  150. elif Input == '<br>':
  151. print(deflines[38], deflines[39], deflines[40], deflines[41])
  152. time.sleep(1)
  153. Block()
  154. elif Input == '<button>':
  155. print(deflines[42], deflines[43], deflines[44])
  156. time.sleep(1)
  157. Block()
  158. elif Input == '<iframe>':
  159. print(deflines[45], deflines[46])
  160. time.sleep(1)
  161. Block()
  162. else:
  163. print()
  164. print('''The tag or command you entered is Not Recognized or is not yet
  165. supported by this tool.''')
  166. print()
  167. Block()
  168. Start()
  169.  
  170. <!DOCTYPE html> is the declaration tag for a standard HTML document. This is used to tell the browser what kind of HTML document it is.
  171. <p> This tag defines a PARAGRAPH. These are highly customisable in CSS, and can be used in any HTML version. There are variations of this tag, such as:
  172. <p1>
  173. <p2>
  174. <p3>
  175. <p4>
  176. <p5>
  177. <p6>
  178. and so on..
  179. <h> This tag defines a HEADER. These, like PARAGRAPHS (see <p>), are highly custonizable in CSS, and, like PARAGRAPHS, can be used in any HTML version. There are variations of this tag, such as:
  180. <h1>
  181. <h2>
  182. <h3>
  183. <h4>
  184. <h5>
  185. <h6>
  186. and so on..
  187. <a> This tag defines a HYPERLINK. This can be used to turn ANY block or peice of text into a clickable link. This has a variety of uses, such as:
  188. Redirection
  189. Buttons
  190. Drop down menus
  191. Navigations bars
  192. and many more.
  193. A hyperlink's syntax is as shows:
  194. <a href = "#" target = "(_blank, _parent, _self, and _top are your options)" type = "(specify the type of linked document.)"></a>
  195. The closing tag is nessesary for this to work with your given parameters.
  196. <div> This tag defines a DIVIDED BLOCK where you can store content, such as pictures, videos, buttons, text, and just about anything you can think of. This is mainly used for containing things such as:
  197. Navigation bars
  198. Buttons
  199. The entire page (Formally known as "Wrapper")
  200. ETC.
  201. This DIV's syntax is as shows:
  202. <div class = "#"></div>
  203. The closing tag is nessesary for this to work with your given parameters.
  204. <link> This tag will LINK (a) CSS file(s) to your HTML document. You can LINK multiple CSS files to a single HTML document. You can LINK files from Google, as well as your own .css files.
  205. The LINK's syntax is as shows:
  206. <link href = "#.css" (OR) "#.com" rel = "Stylesheet" type = "text/css">
  207. <br> This tag creates a LINE BREAK. Just like in any text-editor program, you can create a LINE BREAK using ENTER, or the RETURN KEY. This tag is a very basic one, and it takes like, 5 minutes to remember.
  208. The LINE BREAK's syntax is as shows:
  209. <br>
  210. Simple right?!
  211. <button> This tag defines a BUTTON. These BUTTONS, by default, are just derpy looking grey buttons, until they are customised using CSS.
  212. The BUTTON's syntax is as shows:
  213. <button class = "#"></button>
  214. <iframe> This tag defines an IFRAME. This is used to design webpages that include links to other sites and/or files. Using an IFRAME, you can display other webpages, such as google.com, w3schools.com, and youtube.com are a few. These are moderately customizable in CSS, and can be used virtually anywhere in a webpage, as long as there is enough space.
  215. The IFRAME's syntax is as follows:
  216. <iframe src = "#"></iframe>
  217.  
  218. Hey, You! Hello there! This programs function is to give information
  219. about HTML tags and their uss/functions.
  220.  
  221. CHANGELOG:
  222.  
  223. Version_1 (9/15/2017):
  224.  
  225. Login Feature added
  226. Six tags are added:
  227. <!DOCTYPE html>
  228. <p>
  229. <a>
  230. <h>
  231. <link>
  232. <div>
  233. Startup info added
  234. Shutdown feature added (Does not shutdown your computer, just the file)
  235. added TWO users:
  236. -Admin Chase
  237. -Guest
  238. MOVED INTO ALPHA STAGE
  239.  
  240. Version_2: (9/21/17)
  241. Created errfile.txt (Contains errs)
  242. Added error messages
  243. Restart feature fixed
  244. Login feature now checks for Username - Pointless at the moment.
  245. Compacted Login Feature
  246. Added protected passwords
  247. Added keywords:
  248. <br>
  249. <button>
  250. <iframe>
  251. MOVED INTO BETA STAGE
  252.  
  253. Version_3: (9/28/17)
  254. Moved all definitions into definitionsHtml.txt.
  255. Removed 4 bugs from the code:
  256. err1: The program ran into an unexpected error, and must now close. Sorry for the inconvenience.
  257. err2: Could not execute Block() = Function.
  258. err3: (Partally removed) Incorrect Username.
  259. err4: Program crashed while Reset was commencing. (%s +% completion)
  260. added one error for comedic purposes.
  261. fixed the pointless 46-line deflines block.
  262. fixed bug where program crashes when a tag that doesn't exist is inputed.
  263. fixed bug where program crashes when incorrect username is inputed.
  264. removed errfile.txt.
  265. log.txt now records ALL sessions, not most recent.
  266. added keyword(s):
  267. credits
  268. changed two keywords:
  269. /exit --> exit
  270. /reset --> restart
  271.  
  272. Secret: There are plans to make a "command mode"
  273.  
  274. MOVED INTO INDEV STAGE
  275.  
  276.  
  277. ---------------------------------------------------------------------------
  278.  
  279.  
  280. Users:
  281.  
  282. Username: Guest
  283. Password: -
  284.  
  285. Username: /admin061503
  286. Password: *************
  287.  
  288. ---------------------------------------------------------------------------
  289.  
  290. How To Use:
  291.  
  292. DO NOT open in pythons command prompt, open
  293. through IDLE or Python shell (IDLE)
  294.  
  295. Enter Username on startup, then password. (If set)
  296.  
  297. After you are logged in, Enter a tag or command!
  298.  
  299. List of all keywords:
  300.  
  301. <!DOCTYPE html>
  302. <p>
  303. <h>
  304. <a>
  305. <div>
  306. <link>
  307. <br>
  308. <button>
  309. <iframe>
  310. credits
  311. restart
  312. exit
  313. yes
  314. no
  315.  
  316. This tool was made by Chase Barnes
  317. @2017
  318. This is OPEN SOURCE software, free to edit and use by anybody.
Add Comment
Please, Sign In to add comment