File: D:/HostingSpaces/TWijnstra/wijnstra.com/dvd/dvdedit.asp
<%@ LANGUAGE="VBSCRIPT" %>
<% Option Explicit
Dim strSQL, rsDVDdetails, conDVD, strGetDetails, Foutmelding, leenkeer, lenernaam, test
If Request("invoer") = 1 Then
If Request("title") = "" Then
Foutmelding = "Je moet altijd een titel invullen!"
ElseIf Request("runningtime") = "" Then
Foutmelding = "Je moet altijd de speelduur invullen!"
ElseIf Request("genre") = "" Then
Foutmelding = "Je moet altijd een genre invullen!"
Else
Saven
End If
End If
If Request("what") = "editdvd" Then
' connectie maken om de juiste dvd op te halen
Init
End If %>
<html>
<head><title>Tjerk zijn DVD's (en van Hanneke)</title>
<link href="css/dvd.css" rel="STYLESHEET" type="text/css">
</head>
<body>
<table align="center" class="fullarea"><tr><td>
<!-- #include file="menu.asp" -->
<% If Request("what") = "newdvd" Then %>
<h1>Nieuwe dvd invoeren <span class="attention"><%= Foutmelding %></span></h1>
<form action="dvdedit.asp" method="POST" id=form2 name=form2>
<% ElseIf Request("what") = "editdvd" Then %>
<h1>Aanpassen dvd <span class="attention"><%= Foutmelding %></span></h1>
<form action="dvdedit.asp?dvdid=<%= Request("dvdid") %>&what=editdvd" method="POST" id=form1 name=form1>
<% End If %>
<input type="hidden" name="invoer" value="1">
<table class="tbl" align="center" cellpadding="0" cellspacing="0" border="0">
<% If Request("what") = "newdvd" Then %>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG><span class="attention"> *</span> Titel</STRONG></td>
<td VALIGN="TOP" class="blauw"><input type="text" name="title" size="50"></td>
</tr>
<tr>
<TD VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Omschrijving</STRONG></TD>
<TD VALIGN="TOP" class="geel"><textarea cols="100" rows="10" name="about"></textarea></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG><span class="attention"> *</span> Speelduur</STRONG></td>
<TD VALIGN="TOP" class="geel">ca. <input type="text" name="runningtime" size="30"> minuten</TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Regio code</STRONG></td>
<TD VALIGN="TOP" class="geel"><input type="text" name="regiocode" size="50"></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG><span class="attention"> *</span> Genre</STRONG></td>
<TD VALIGN="TOP" class="geel"><input type="text" name="genre" size="50"></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Taal</STRONG></td>
<TD VALIGN="TOP" class="geel"><input type="text" name="language" size="50"></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Ondertiteling</STRONG></td>
<TD VALIGN="TOP" class="geel"><input type="text" name="subtitling" size="50"></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Video aspect ratio</STRONG></td>
<TD VALIGN="TOP" class="geel"><input type="text" name="videoaspectratio" size="50"> <span class="clsExplain">(2.35:1 / 16:9)</span></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Audio</STRONG></td>
<TD VALIGN="TOP" class="geel"><input type="text" name="audio" size="50"> <span class="clsExplain">(Dolby digital 5.1)</span></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Disctype</STRONG></td>
<TD VALIGN="TOP" class="geel"><input type="text" name="disctype" size="50"></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Extra features</STRONG></td>
<TD VALIGN="TOP" class="geel"><textarea cols="100" rows="5" name="features"></textarea></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Plaatje</STRONG></td>
<TD VALIGN="TOP" class="geel"><input type="text" name="picture" size="50"></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>DVDzone2 code</STRONG></td>
<TD VALIGN="TOP" class="geel"><input type="text" name="dvdzoneID" size="50"></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Uitgeleend aan</STRONG>
<TD VALIGN="TOP" class="geel"><input type="text" name="lonername" size="50"></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG><span class="attention"> *</span> Eigenaar</STRONG></td>
<TD VALIGN="TOP" class="geel"><select name="ownername">
<option value="Hanneke Hornes">Hanneke Hornes</option>
<option value="Tjerk Wijnstra" SELECTED>Tjerk Wijnstra</option>
</select></TD>
</tr>
<% ElseIf Request("what") = "editdvd" Then
While not rsDVDdetails.EOF %>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG><span class="attention"> *</span> Titel</STRONG></td>
<td VALIGN="TOP" class="blauw"><input type="text" name="title" value="<%= rsDVDdetails("title") %>" size="50"></td>
</tr>
<tr>
<TD VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Omschrijving</STRONG></TD>
<TD VALIGN="TOP" class="geel"><textarea cols="100" rows="10" name="about"><%= rsDVDdetails("about") %></textarea></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG><span class="attention"> *</span> Speelduur</STRONG></td>
<TD VALIGN="TOP" class="geel">ca. <input type="text" value="<%= rsDVDdetails("runningtime") %>" name="runningtime" size="30"> minuten</TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Regio code</STRONG></td>
<TD VALIGN="TOP" class="geel"><input type="text" value="<%= rsDVDdetails("regiocode") %>" name="regiocode" size="50"></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG><span class="attention"> *</span> Genre</STRONG></td>
<TD VALIGN="TOP" class="geel"><input type="text" value="<%= rsDVDdetails("genre") %>" name="genre" size="50"></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Taal</STRONG></td>
<TD VALIGN="TOP" class="geel"><input type="text" value="<%= rsDVDdetails("language") %>" name="language" size="50"></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Ondertiteling</STRONG></td>
<TD VALIGN="TOP" class="geel"><input type="text" value="<%= rsDVDdetails("subtitling") %>" name="subtitling" size="50"></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Video aspect ratio</STRONG></td>
<TD VALIGN="TOP" class="geel"><input type="text" value="<%= rsDVDdetails("videoaspectratio") %>" name="videoaspectratio" size="50"> <span class="clsExplain">(2.35:1 / 16:9)</span></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Audio</STRONG></td>
<TD VALIGN="TOP" class="geel"><input type="text" value="<%= rsDVDdetails("audio") %>" name="audio" size="50"> <span class="clsExplain">(Dolby digital 5.1)</span></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Disctype</STRONG></td>
<TD VALIGN="TOP" class="geel"><input type="text" value="<%= rsDVDdetails("disctype") %>" name="disctype" size="50"></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Extra features</STRONG></td>
<TD VALIGN="TOP" class="geel"><textarea cols="100" rows="5" name="features"><%= rsDVDdetails("features") %></textarea></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Plaatje</STRONG></td>
<TD VALIGN="TOP" class="geel"><input type="text" value="<%= rsDVDdetails("picture") %>" name="picture" size="50"></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>DVDzone2 code</STRONG></td>
<TD VALIGN="TOP" class="geel"><input type="text" value="<%= rsDVDdetails("dvdzoneID") %>" name="dvdzoneID" size="50"></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG>Uitgeleend aan</STRONG><br>
<% leenkeer = rsDVDdetails("lonertime") %>
(totaal: <%= leenkeer %>)</td>
<% lenernaam = rsDVDdetails("lonername") %>
<TD VALIGN="TOP" class="geel"><input type="text" value="<%= rsDVDdetails("lonername") %>" name="lonername" size="50"></TD>
</tr>
<tr>
<td VALIGN="TOP" align="right" class="donkerblauw"><STRONG><span class="attention"> *</span> Eigenaar</STRONG></td>
<TD VALIGN="TOP" class="geel"><input type="text" value="<%= rsDVDdetails("ownername") %>" name="ownername" size="50"></TD>
</tr>
<% rsDVDdetails.MoveNext
Wend
End If %>
</table>
<br><span class="attention"> *</span> = verplicht invullen
<div align="center"><input id="send" type="submit" name="add" value="Bewaren">
<INPUT type="reset" value="Toch maar niet" id="send" name=reset1></div>
</form>
</td></tr></table></body></html>
<% If Request("what") = "editdvd" Then
Close
End If
Sub Init() %>
<!-- #include file="includeCon.asp" -->
<% strGetDetails = "SELECT * FROM tbl_dvd WHERE dvdid = " & Request("dvdid")
Set rsDVDdetails = conDVD.Execute(strGetDetails)
Set strGetDetails = Nothing
End Sub
Sub Saven()
Dim strtitle, strabout, strownername, strregiocode, strgenre, strlanguage, strsubtitling, strvideoaspectratio, straudio, strdisctype, strfeatures, strpicture, strlonername, lnglonertime
strtitle = replace(Request("title"),"'","''")
strabout = replace(Request("about"),"'","''")
strownername = replace(Request("ownername"),"'","''")
strregiocode = replace(Request("regiocode"),"'","''")
strgenre = replace(Request("genre"),"'","''")
strlanguage = replace(Request("language"),"'","''")
strsubtitling = replace(Request("subtitling"),"'","''")
strvideoaspectratio = replace(Request("videoaspectratio"),"'","''")
straudio = replace(Request("audio"),"'","''")
strdisctype = replace(Request("disctype"),"'","''")
strfeatures = replace(Request("features"),"'","''")
strpicture = replace(Request("picture"),"'","''")
Dim rtime
If Request("runningtime") = "" Then
rtime = 0
Else
rtime = Request("runningtime")
End If
Dim devedezoneID
If Request("dvdzoneID") = "" Then
devedezoneID = 10101
Else
devedezoneID = Request("dvdzoneID")
End If
'If Request("what") = "newdvd" Then
'ElseIf Request("what") = "editdvd" Then
'End If
If trim(Request("lonername")) = "" Then
strlonername = "nietuitgeleend"
Else
If not trim(Request("lonername")) = lenernaam Then
lnglonertime = leenkeer + 1
End If
strlonername = replace(Request("lonername"),"'","''")
End If
SaveDVD devedezoneID, strtitle, strabout, strownername, rtime, strregiocode, strgenre, strlanguage, strsubtitling, strvideoaspectratio, straudio, strdisctype, strfeatures, strpicture, strlonername, lnglonertime
End Sub
Function SaveDVD(lngdvdzoneID, strtitle, strabout, strownername, lngrunningtime, strregiocode, strgenre, strlanguage, strsubtitling, strvideoaspectratio, straudio, strdisctype, strfeatures, strpicture, strlonername, lnglonertime)
Dim strSaveDVD, strGetID, rstItem %>
<!-- #include file="includeCon.asp" -->
<%
If Request("what") = "newdvd" Then
strSaveDVD = " INSERT INTO tbl_dvd (dvdzoneID, title, about, ownername, runningtime, regiocode, genre, language, subtitling, videoaspectratio, audio, disctype, features, lonername, lonertime, picture) "
strSaveDVD = strSaveDVD & "VALUES('" & lngdevedezoneid & "','" & strtitle & "','" & strabout & "','" & strownername & "'," & lngrunningtime & ",'" & strregiocode & "','" & strgenre & "','" & strlanguage & "','" & strsubtitling & "','" & strvideoaspectratio & "','" & straudio & "','" & strdisctype & "','" & strfeatures & "','" & strlonername & "','" & lnglonertime & "','" & strpicture & "') "
ElseIf Request("what") = "editdvd" Then
strSaveDVD = " UPDATE tbl_dvd SET dvdzoneID = '" & lngdvdzoneID & "', title = '" & strtitle & "', about = '" & strabout & "', ownername = '" & strownername & "', runningtime = " & lngrunningtime & ", regiocode = '" & strregiocode & "', genre = '" & strgenre & "', language = '" & strlanguage & "', subtitling = '" & strsubtitling & "', videoaspectratio = '" & strvideoaspectratio & "', audio = '" & straudio & "', disctype = '" & strdisctype & "', features = '" & strfeatures & "', picture = '" & strpicture & "', lonername = '" & strlonername & "', lonertime = '" & lnglonertime & "' WHERE dvdid = " & Request("dvdid") & ""
End If
Response.Write strSaveDVD
conDVD.Execute(strSaveDVD)
strSaveDVD = ""
Close
' Weer ophalen van de bovenstaande weggeschreven ID %>
<!-- #include file="includeCon.asp" -->
<% strGetID = " SELECT dvdid FROM tbl_dvd WHERE title = '" & replace(Request("title"),"'","''") & "' AND runningtime = " & lngrunningtime & ""
Set rstItem = conDVD.Execute(strGetID)
strGetID = ""
' Bouw de url op voor de redirect
strGetID = "details.asp?dvdid=" & rstItem("dvdid")
Response.redirect strGetID
Close
End Function
Sub Close
conDVD.Close
Set conDVD = Nothing
End Sub %>