<%@ Language=VBScript %> <% ' default.asp - Shows Today's Comic rips from various Internet pages ' Last updated 8 May 2003 (c) hacke@hacke.nu Dim ComicName(), ComicImageURL(), ComicSourceURL(), SelectedComicNames(), ComicCaption() Dim NumberOfComics, CCstring Redir = Request.QueryString("Redir") CurrentDate = Request.QueryString("Date") ShowAll = (Request.QueryString("Show") = "All") If Redir = "comics-settings.asp" Then ReadComics Session("ComicName") = ComicName Session("ComicImageURL") = ComicImageURL Session("ComicSourceURL") = ComicSourceURL Response.Redirect("comics-settings.asp") End If If CurrentDate = "" Then ' If no date sent by query, use today's date CurrentDate = FormatDateTime(date,2) ' Since most images are ripped from US, don't use today's date until +6 hours ' Note: VBScript does not support getting TimeZoneOffset, Jscript is needed %><% GMTHour = Hour(Time) + Session("TZDiff") If GMTHour < 6 Then CurrentDate = DateSerial(Year(CurrentDate), Month(CurrentDate), Day(CurrentDate) - 1) End If End If If CurrentDate <> FormatDateTime(date,2) Then NextDate = DateAdd("d", 1, CurrentDate) End If CurrentYear = Year(CurrentDate) CurrentShortYear = Cstr(Right(CurrentYear,2)) CurrentMonth = Month(CurrentDate) CurrentMonthName = MonthName(Month(CurrentDate)) CurrentDay = Day(CurrentDate) CurrentWeekday = Weekday(CurrentDate) CurrentWeekdayName = WeekdayName(weekday(CurrentDate)) PreviousDate = DateSerial(CurrentYear, CurrentMonth, CurrentDay - 1) StrPreviousDay = Cstr(CurrentDay - 1) If Len(StrPreviousDay) = 1 Then StrPreviousDay = "0" + StrPreviousDay End If strMonth = Cstr(CurrentMonth) If Len(strMonth) < 2 Then strMonth = "0" + strMonth strDay = CStr(CurrentDay) If Len(strDay) < 2 Then strDay = "0" + strDay %> ") Response.Write("") %>
 
     
 


 

Click here to reload Today's Comics

<% Response.Write("" & " " & FormatDateTime(CurrentDate,1) & "") Response.Write("

") Response.Write("

") Response.Write("") Response.Write("<< | ") If NextDate <> "" Then Response.Write("") End If Response.Write(">> | ") Response.Write("my settings | ") Response.Write("help") Response.Write("") Response.Write("

   
 

<% ' Calculate Julian Date CalculateJDdate ' Load comics array ReadComics ' Show comics - all or selected If ShowAll = True Then ShowAllComics ShowHomePageButton Response.Write("top of page | show selected comics

") Response.Write("
") ElseIf GetCookies Then ShowComics ShowHomePageButton Response.Write("top of page | show all comics

") Response.Write("") Else Response.Write("

 You have not selected any comics - please configure your settings to do so!

") End If %> <%Sub ShowHomePageButton%>
Do you want to make Today`s Comics your home page? Simply click

<%End Sub%>

   
<% Function GetCookies CookieComicNames = Split(Request.Cookies("SelectedComicNames"), ",") For i = 1 To UBound(CookieComicNames) ReDim Preserve SelectedComicNames(i) SelectedComicNames(i) = CookieComicNames(i) Next GetCookies = i - 1 End Function Sub ShowAllComics Response.Write("

") For i = 1 To UBound(ComicName) Response.Write("") Next Response.Write("
") Response.Write(" & Chr(34) & Ucase(ComicName(i)) & ") Response.Write("

") End Sub Sub ShowComics Response.Write("

") For j = 1 To UBound(SelectedComicNames) For i = 1 To UBound(ComicName) If ComicName(i) = SelectedComicNames(j) Then Response.Write("") End If Next Next Response.Write("
") Response.Write(" & Chr(34) & Ucase(ComicName(i)) & ") Response.Write("

") End Sub Sub CalculateJDdate() ' ---- Calculate Julian Day D = CurrentDay M = CurrentMonth Y = CurrentYear If M < 3 Then M = M + 12 Y = Y - 1 End If JulianDay = D + (153 * M - 457) \ 5 + 365 * Y + (Y / 4) - (Y / 100) + (Y / 400) + 1721118.5 'JulianDay = Int(JulianDay) -- tveksamt om denna behövs?? JDoffset = JulianDay - 1721059 ' subtract Julian day corresponding to 1 Jan 0. JDweekday = CurrentWeekDay - 1 ' Monday is treated as 1st Day, etc If JDweekday = 0 Then JDweekday = 7 ' Sunday is treated as 7th day, not 0th ' Attempt to calculate the comics obfuscation number; ' First we calculate the month's "seed", which is the offset Julian day divided by the month. ' Then we count down from the current day to the first day of the month, adding one to the ' seed for each Wednesday we encounter. Finally, we divide the modified seed value by the ' current day of the week. JDseed = Int ((JDoffset - CurrentDay + 1) / CurrentMonth) ' Calculate Monthly seed For i = CurrentDay To 0 Step -1 JDseed = JDseed - (i / 7 = int(i / 7)) Next 'Response.Write "JDseed = " & JDseed & "
" 'Response.Write "JDweekday = " & JDweekday & "
" 'Response.Write "seed/day = " & (JDseed / JDweekday) & "
" 'JDseed = Int(JDseed / JDweekday) ' Had to replace line above with If statement below If (JDseed / JDweekday) = Int(JDseed / JDweekday) Then JDseed = Int(JDseed / JDweekday) - 1 Else JDseed = Int(JDseed / JDweekday) End If 'Response.Write "New JDseed = " & JDseed & "
" strDate = Cstr(CurrentYear) & strMonth & strDay CCfront = Mid(strDate, 1, JDweekday) ' split the YYYYMMDD string on the position CCtail = Mid(strDate, JDweekday + 1) ' corresponding the to number of the weekday CCstring = CCfront & JDseed & CCtail ' and insert the JDseed string in between End Sub Sub ReadComics() NumberOfComics = 13 ReDim Preserve ComicName(NumberOfComics), ComicImageURL(NumberOfComics), ComicSourceURL(NumberOfComics), ComicCaption(NumberOfComics) ' Dilbert ComicName(1) = "Dilbert" 'ComicImageURL(1) = "http://de-slumme.vv.no/dilbert/images/dilbert.com-" & CurrentYear & "-" & strMonth & "-" & strDay & ".png" 'ComicImageURL(1) = "http://www.contactor.se/~bjst/serier/dilbert/" & CurrentShortYear & StrMonth & StrDay & ".gif" 'ComicImageURL(1) = "http://vwww.gafware.com:81/news/dilbert/db-" & StrMonth & StrDay & CurrentShortYear & ".gif" ' ComicImageURL(1) = "http://www.bangm.dk/jbm_images/dilbertUK/dilbert" & StrMonth & StrDay & CurrentYear & ".gif" ComicImageURL(1) = "http://www.comics.com/comics/dilbert/archive/images/dilbert" & CCstring If CurrentWeekday = 1 Then ComicImageURL(1) = ComicImageURL(1) & ".jpg" Else ComicImageURL(1) = ComicImageURL(1) & ".gif" End If ComicSourceURL(1) = "http://www.dilbert.com" ' Garfield ComicName(2) = "Garfield" ComicImageURL(2) = "http://images.ucomics.com/comics/ga/" & CurrentYear & "/ga" & CurrentShortYear & StrMonth & StrDay & ".gif" ComicSourceURL(2) = "http://www.ucomics.com/garfield/" ' Calvin and Hobbes ComicName(3) = "Calvin & Hobbes" ComicImageURL(3) = "http://picayune.uclick.com/comics/ch/" & CurrentYear & "/ch" & CurrentShortYear & StrMonth & StrDay & ".gif" ComicSourceURL(3) = "http://www.gocomics.com/calvinandhobbes/" ' Baldo ComicName(4) = "Baldo" ComicImageURL(4) = "http://images.ucomics.com/comics/ba/" & CurrentYear & "/ba" & CurrentShortYear & StrMonth & StrDay & ".gif" ComicSourceURL(4) = "http://www.ucomics.com/baldo/" ' FoxTrot ComicName(5) = "FoxTrot" ComicImageURL(5) = "http://picayune.uclick.com/comics/ft/" & CurrentYear & "/ft" & CurrentShortYear & StrMonth & StrDay & ".gif" ComicSourceURL(5) = "http://www.ucomics.com/foxtrot/" ' Cleats ComicName(6) = "Cleats" ComicImageURL(6) = "http://images.ucomics.com/comics/cle/" & CurrentYear & "/cle" & CurrentShortYear & StrMonth & StrDay & ".gif" ComicSourceURL(6) = "http://www.ucomics.com/cleats/" ' Sherman's Lagoon ComicName(7) = "Sherman's Lagoon" ComicImageURL(7) = "http://www.slagoon.com/dailies/SL" & CurrentShortYear & StrMonth & StrDay & ".gif" ComicSourceURL(7) = "http://www.slagoon.com/" ' Monty ComicName(8) = "Monty" ComicImageURL(8) = "http://www.unitedmedia.com/comics/monty/archive/images/monty" & CCstring If CurrentWeekday = 1 Then ComicImageURL(8) = ComicImageURL(8) & ".jpg" Else ComicImageURL(8) = ComicImageURL(8) & ".gif" End If ComicSourceURL(8) = "http://www.unitedmedia.com/comics/monty/" ' Elvis (Swedish, from Metro) ComicName(9) = "Elvis (Swedish - N/A on Thu & Sun)" ComicImageURL(9) = "http://www.metro.se/content/cartoons/elvis/" & CurrentYear & strMonth & StrDay & ".jpg" ComicSourceURL(9) = "http://www.metro.se/site/metro/cartoons/?cartoon=0" ' B.C ComicName(10) = "B.C" ComicImageURL(10) = "http://seattlepi.nwsource.com/fun/bc/" & StrMonth & StrDay & CurrentYear & ".gif" ComicSourceURL(10) = "http://seattlepi.nwsource.com/fun/bc.asp" 'ComicSourceURL(10) = "http://www.creators.com/comics_show.cfm?comicname=bc" ' Cathy ComicName(11) = "Cathy" ComicImageURL(11) = "http://images.ucomics.com/comics/ca/" & CurrentYear & "/ca" & CurrentShortYear & StrMonth & StrDay & ".gif" ComicSourceURL(11) = "http://www.ucomics.com/cathy/" ' The Duplex ComicName(12) = "The Duplex" ComicImageURL(12) = "http://images.ucomics.com/comics/dp/" & CurrentYear & "/dp" & CurrentShortYear & StrMonth & StrDay & ".gif" ComicSourceURL(12) = "http://www.ucomics.com/duplex/" ' Adam @ Home ComicName(13) = "Adam @ Home" ComicImageURL(13) = "http://images.ucomics.com/comics/ad/" & CurrentYear & "/ad" & CurrentShortYear & StrMonth & StrDay & ".gif" ComicSourceURL(13) = "http://www.ucomics.com/adamathome/" ' ---- Discontinued comics ---- ' Rocky 'ComicName(11) = "Rocky (Swedish)" 'ComicImageURL(11) = "http://www.contactor.se/~bjst/serier/rocky/" & CurrentShortYear & strMonth & StrPreviousDay & ".jpg" 'ComicSourceURL(11) = "http://www.aftonbladet.se/humor/index.html" ' User Friendly 'ComicName(9) = "User Friendly" 'ComicImageURL(9) = "http://www.contactor.se/~bjst/serier/userfriendly/" & CurrentShortYear & StrMonth & StrDay & ".gif" 'ComicSourceURL(9) = "http://www.userfriendly.org/" ' Dilbert Classic 'ComicName(2) = "Dilbert (Classic)" 'ComicImageURL(2) = "http://www.uclick.com/feature/" & CurrentShortYear & "/" & StrMonth & "/" & StrDay & "/dt" & CurrentShortYear & StrMonth & StrDay & ".gif" 'ComicSourceURL(2) = "http://www.dilbert.com" End Sub ' ========================================== ' http://www.snec.se/strippar/strippar.pl ' http://www.azstarnet.com/comics/ ' Hagar the Horrible ' Beetle Bailey (Knasen) ' Blondie ' Noas Ark ' Rocky (från aftonbladet.se) ' - http://www.rocky-digital.com/ ' - www.aftonbladet.se ' - www.metro.se ' - ' Hälge - http://www.halge.com/svenska/strip/index.asp .. ' http://m.nu/serier/ ' http://www.bulls.se/SERIER/COMIX.HTM ' http://hem.passagen.se/pasjogr/serier.htm ' http://www.mammasgata.com ' http://www.indianchild.com/cartoons_and_comics.htm ' Elvis http://www.metro.se/content/cartoons/elvis/ ' ' scooped: ' http://www.supertwist.net/cgi-bin/scoopcomics.pl ' http://magnus.hoem.se/comic.cgi ' http://rdrop.com/users/half/General/Downloads/scoopcomics.pl ' %>