Här kommer koden
<%@ Language=VBScript %>
<% Option Explicit %>
<!--#include file="nameday.inc"-->
<%
Dim dDate, dYear, Conn, rs,dMonth, dDaysInMonth, Output, iCounter, sClass, sMonthName, iCounter2
Dim iLinesize, sHead, sql, iWeekNo, sColor, sNclass, sValid
If Request.QueryString("datum") = "" Then
dDate = Date
Else
dDate = Request.QueryString("datum")
End If
dYear = Year(dDate)
dMonth = Month(dDate)
sMonthName = MonthName(dMonth)
dDaysInMonth = Day(DateAdd("d", -1, DateSerial(dYear, dMonth + 1, 1)))
Function dDayName(iCounter)
dDayName = WeekdayName(WeekDay(dYear & "-" & dMonth & "-" & iCounter),False,1)
dDayname = UCase(Left(dDayName,1)) & Right(dDayName, Len(dDayName) - 1)
End Function
Function sUpperMonthName(sMonth)
sUpperMonthName = UCase(Left(sMonth,1)) & Right(sMonth, Len(sMonth)-1)
End Function
Function DayCount(iCounter)
DayCount = DateDiff("d",dYear & "-01-01",dYear & "-" & dMonth & "-" & iCounter,2,1) + 1
End Function
Set Conn = Server.CreateObject("ADODB.Connection")
'********** Start Mysql ************
Conn.Open "Min mysqldatabaskoppling men skiver inte den här nu"
sql = " select id, rubrik, detalj, slutdatum, "
sql = sql & " DATE_FORMAT(startdatum, 'yyyy-mm-dd') as datum1,"
sql = sql & " DATE_FORMAT(frantid, 'hh:mm') as ftid,"
sql = sql & " DATE_FORMAT(tilltid, 'hh:mm') as ttid"
sql = sql & " from tbl_calender"
sql = sql & " where startdatum like '" & Left(dDate,7) & "%'"
sql = sql & " order by frantid asc"
'********** Slut mysql ************
RAd 47 - Set RS = Conn.Execute (sql)
%>
<html>
<head>
<style>
A:link {text-decoration: none; color:navy;}
A:visited {text-decoration: none; color:navy;}
A:active {text-decoration: none; color:#CC0000;}
A:hover {text-decoration: underline; color:#CC0000;}
.BoldRed {font-family : Arial, Helvetica; font-size : 16pt; color : Red; font-weight: bold}
.BoldNavy {font-family : Arial, Helvetica; font-size : 16pt; color : Navy; font-weight: bold}
.MediumNavy {font-family : Verdana, Arial, Helvetica; font-size : 12px; color : Navy;font-weight: bold;position: relative}
.Namn {font-family : Verdana, Arial, Helvetica; font-size : 11px; color : navy}
.rNamn {font-family : Verdana, Arial, Helvetica; font-size : 11px; color : red}
.CalenderTimeRubrik {font-family : Verdana, Arial, Helvetica; font-size : 11px; color : black; font-weight: bold}
.CalenderSmall {font-family : Verdana, Arial, Helvetica; font-size : 10px; color : black}
.CalenderTime {font-family : Verdana, Arial, Helvetica; font-size : 11px; color : brown}
.CalenderxSmall {font-family : Tahoma, Helvetica; font-size : 9px; color : black}
</style>
<title>Månadskalender</title>
</head>
<body bgcolor="#ffffff">
<center>
<table width=500 border=0 cellspacing=0 cellpadding=2>
<tr>
<td>
<table width=500 border=0 cellspacing=0 cellpadding=0>
<tr>
<td class=MediumNavy align=left width=100><a href="calender.asp?datum=<%= DateAdd("m",-1,dDate) %>&<%Request.QueryString("teamID")%>">«
<%= sUpperMonthName(MonthName(Month(DateAdd("m",-1,dDate)))) %></a></td>
<td align=center><span class=BoldNavy><%= sUpperMonthName(sMonthName) & " " & dYear %></span><br></td>
<td class=MediumNavy align=right width=100><a href="calender.asp?datum=<%= DateAdd("m",1,dDate) %>&<%Request.QueryString("teamID")%>">
<%= sUpperMonthName(MonthName(Month(DateAdd("m",1,dDate)))) %> »</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width=100% border=0 cellspacing=0 cellpadding=0>
<tr>
<%
iCounter = 1
Do While iCounter <= dDaysInMonth
Select Case dDayName(iCounter)
Case "Söndag"
sClass = "BoldRed"
sNclass = "rNamn"
sColor = "#EEEEEE"
iLinesize = 3
Case "Lördag"
sNclass = "rNamn"
sColor = "FFFFff"
iLinesize = 1
Case Else
sClass = "BoldNavy"
sNclass = "Namn"
sColor = "FFFFFF"
iLinesize = 1
End Select
If CInt(Month(Date) & Day(Date)) = CInt(dMonth & iCounter) Then
sColor = "#FFFFCC"
End If
Response.Write "<tr bgcolor=" & sColor & "><td align=center width=30>" & VbCrLf
Output = "" & VbCrLf
Output = Output & "<span class=" & sClass & ">" & iCounter & "</a></span></td>" & VbCrLf
Output = Output & "<td class=" & sNclass & " width=95 valign=top>" & dDayName(iCounter) & "</span>" & VbCrLf
Output = Output & "<span class=CalenderxSmall> " & DayCount(iCounter) & "<br>" & VbCrLf
Output = Output & "<span class=CalenderSmall>" & sNamn(dMonth,iCounter) & "</span></td>" & VbCrLf
Output = Output & "<td valign=top width=300>" & VbCrLf
If Not RS.BOF Then
RS.MoveFirst
Dim dStartdate, dEndDate, dTempDate
dStartDate = Cdate(RS("Datum1"))
dEndDate = Cdate(RS("slutdatum"))
for dTempDate = dStartDate to dEndDate
Do Until RS.EOF
If CInt(Right(RS("Datum1"),2)) = CInt(iCounter) Then
If CInt(Right(RS("Datum1"),2)) = CInt(Right(RS("slutdatum"),2)) THEN
if NOT RS("ttid") = "" Then
Output = Output & "<font class=CalenderTime>" & RS("ftid") & "-" & RS("ttid") & "</font>" & VbCrLf
Else
Output = Output & "<font class=CalenderTime>" & RS("ftid") & "</font>" & VbCrLf
End if
End if
Output = Output & "<font class=CalenderTimeRubrik>" & RS("rubrik") & "</font> " & VbCrLf
If not RS("detalj") = "" THEN
Output = Output & "<br><font class=CalenderSmall>" & RS("detalj") & "</font> " & VbCrLf
End if
Elseif not CInt(Right(RS("Datum1"),2)) = CInt(Right(RS("slutdatum"),2)) THEN
If CInt(iCounter) > CInt(Right(RS("Datum1"),2)) and CInt(iCounter) =< CInt(Right(RS("slutdatum"),2)) Then
Output = Output & "<font class=CalenderTimeRubrik>" & RS("rubrik") & "</font><br>" & VbCrLf
End if
End If
RS.MoveNext
Loop
next
End if
Response.Write Output
If dDayName(iCounter) = "Måndag" Then
iWeekNo = DatePart("ww",dYear & "-" & dMonth & "-" & iCounter,2,2)
Response.Write "</td><td class=CalenderSmall align=right width='60' valign=top>v." & iWeekNo & "</td></tr>" & VbCrLf
Response.Write "<tr><td colspan=4><hr size=" & iLinesize & " noshade color='#000000'></td></tr>" & VbCrLf
Else
Response.Write "</td><td> </td></tr><tr><td colspan=4>" & VbCrLf
Response.Write "<hr size=" & iLinesize & " noshade color='#000000'></td></tr>" & VbCrLf
End If
iCounter = iCounter + 1
Loop
RS.Close
Set RS = Nothing
Conn.Close
Set Conn = Nothing
%>
</table>
</td>
</tr>
</table>
</center>
</body>
</html>