02-13-2005, 02:46 AM
Yay, I've had the bright Idea to make a HTML decrypter. Its not much now, but its somthing I'm playing around with for fun.. take a look...
(Reads TXT & HTM, but fails to read HTML dubbed files)
Text File or HTM file...
It is limited to <html>, <head>, <body>, <p>, <title>, and their reverse tags.. Also sofar the file has to be less than 199 charaters.. This is just a decrypter for now, not a veiwer, so no mouse function is present.
Note: If you also like to mess around and improve on it, its a great introduction to using the MID$() statment for scanning files for infomation, feel free to do so.. :wink:
(Reads TXT & HTM, but fails to read HTML dubbed files)
Code:
DECLARE SUB PARAread ()
DECLARE SUB BODYRead ()
DECLARE SUB HEADRead ()
DECLARE SUB TTLPRT ()
DECLARE SUB Overflow ()
DECLARE SUB TAGCheck ()
DECLARE SUB OpenHTML ()
DECLARE SUB HTMLread ()
DECLARE SUB HTMLCheck ()
DIM SHARED html$, cont, htm$, para$, header$, html2$
CLS
INPUT "Enter .HTM Document:", htm$
CLS
CALL HTMLCheck
CALL OpenHTML
CALL TAGCheck
cont = 0
CALL HTMLread
PRINT cont
SUB BODYRead
DO
cont = cont + 1
IF cont = LEN(html$) THEN END
IF MID$(UCASE$(html$), cont, 3) = "<P>" THEN cont = cont + 2: CALL PARAread
LOOP
END SUB
SUB HEADRead
DO
cont = cont + 1
IF cont = LEN(html$) THEN END
IF MID$(UCASE$(html$), cont, 7) = "<TITLE>" THEN cont = cont + 6: CALL TTLPRT
LOOP
END SUB
SUB HTMLCheck
cont = 0
DO
cont = cont + 1
IF cont = LEN(htm$) THEN PRINT " Not .HTM/.TXT Document ": END
IF MID$(UCASE$(htm$), cont, 3) = "TXT" THEN EXIT DO
IF MID$(UCASE$(htm$), cont, 3) = "HTM" THEN EXIT DO
LOOP
END SUB
SUB HTMLread
DO
cont = cont + 1
IF cont = LEN(html$) THEN END
IF MID$(UCASE$(html$), cont, 6) = "<HEAD>" THEN CALL HEADRead
IF MID$(UCASE$(html$), cont, 6) = "<BODY>" THEN CALL BODYRead
IF MID$(UCASE$(html$), cont, 7) = "</HTML>" THEN END
LOOP
END SUB
SUB OpenHTML
OPEN htm$ FOR INPUT AS #1
DO
IF EOF(1) = -1 THEN EXIT DO
LINE INPUT #1, a$
html$ = html$ + a$
IF LEN(html$) = 199 THEN PRINT " File To Big! ": END
LOOP
CLOSE #1
END SUB
SUB PARAread
DO
cont = cont + 1
IF cont = LEN(html$) THEN END
IF MID$(UCASE$(html$), cont, 4) = "</P>" THEN EXIT DO
phs$ = phs$ + MID$(html$, cont, 1)
LOOP
PRINT
PRINT phs$
CALL HTMLread
END SUB
SUB TAGCheck
cont = 0
DO
cont = cont + 1
IF cont = LEN(html$) THEN PRINT " No <html> tag located ": END
IF MID$(UCASE$(html$), cont, 6) = "<HTML>" THEN EXIT DO
LOOP
END SUB
SUB TTLPRT
DO
cont = cont + 1
IF cont = LEN(html$) THEN END
IF MID$(UCASE$(html$), cont, 8) = "</TITLE>" THEN EXIT DO
ttl$ = ttl$ + MID$(html$, cont, 1)
LOOP
PRINT ttl$
PRINT
CALL HTMLread
END SUB
Text File or HTM file...
Code:
<HTML>
<HEAD>
<TITLE>QB HTML READER!</TITLE>
</HEAD>
<BODY>
<P>This is a HTML paragraph being read by QBasic Yay!!</P>
</BODY>
</HTML>
It is limited to <html>, <head>, <body>, <p>, <title>, and their reverse tags.. Also sofar the file has to be less than 199 charaters.. This is just a decrypter for now, not a veiwer, so no mouse function is present.
Note: If you also like to mess around and improve on it, its a great introduction to using the MID$() statment for scanning files for infomation, feel free to do so.. :wink: