HJÆLP!!!
Hejsa er der en der kan lave dette script igen, jeg har fået det ødelagt på en måde..Fejlen kan i se på http://www.ppm.dk/tekst1.asp
--
<%
'Siden man ryger ind paa naar man logger af:
Logafside = "login.html"
Sysopbruger = "Sysop"
Sysoppass = "System"
'Password til databasen (default er Pass) (for at aendre passwordet i databasen skal acces aabnes. Derefter vaelges "med uddelt adgang" i aaben-menuen. Funktioner>Skikkerhed>Fjern adgangskode til databasen>Funktioner>Sikkerhed>Andgiv adgangskode til databasen):
Databasepass = "Pass"
connection = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=d:\www2\ppm\banner.mdb; UID=Sysop; PWD=" & Databasepass
sub visbanner()
set conn = server.createobject("ADODB.connection")
conn.Open connection, adOpenStatic, adLockOptimistic
Sql = "SELECT * FROM banner WHERE vist BETWEEN 0 AND totalfremvisning-1 ORDER BY oprettet"
set RS = conn.execute( SQL )
ok = Array()
nr = 0
Do until rs.eof
if rs("vistid") = "fasttid" then
if not rs("ugedag") = "ligegyldigt" then
ugedag = rs("ugedag")
ugedag = Split(ugedag, ", ", -1, 1)
for x=0 to ubound(ugedag)
if ugedag(x) = WeekdayName(weekday(date)) then
Idag = True
end if
Next
if Idag then
if not rs("Startkltim") = "!" or rs("Startklmin") = "!" or rs("Slutkltim") = "!" or rs("Slutklmin") = "!" then
start = rs("Startkltim") & ":" & rs("Startklmin")
slut = rs("Slutkltim") & ":" & rs("Slutklmin")
kl = Left(time(), 5)
if start < slut then
if kl > start and kl < slut then
ReDim Preserve ok(nr)
ok(nr) = rs("id")
nr = nr + 1
end if
else
if kl < start and kl < slut then
ReDim Preserve ok(nr)
ok(nr) = rs("id")
nr = nr + 1
elseif kl > start and kl > slut then
ReDim Preserve ok(nr)
ok(nr) = rs("id")
nr = nr + 1
end if
end if
else
ReDim Preserve ok(nr)
ok(nr) = rs("id")
nr = nr + 1
end if
end if
elseif not rs("Startkltim") = "!" or rs("Startklmin") = "!" or rs("Slutkltim") = "!" or rs("Slutklmin") = "!" then
start = rs("Startkltim") & ":" & rs("Startklmin")
slut = rs("Slutkltim") & ":" & rs("Slutklmin")
kl = Left(time(), 5)
if start < slut then
if kl > start and kl < slut then
ReDim Preserve ok(nr)
ok(nr) = rs("id")
nr = nr + 1
end if
else
if kl < start and kl < slut then
ReDim Preserve ok(nr)
ok(nr) = rs("id")
nr = nr + 1
elseif kl > start and kl > slut then
ReDim Preserve ok(nr)
ok(nr) = rs("id")
nr = nr + 1
end if
end if
else
ReDim Preserve ok(nr)
ok(nr) = rs("id")
nr = nr + 1
end if
else
ReDim Preserve ok(nr)
ok(nr) = rs("id")
nr = nr + 1
end if
rs.MoveNext
Loop
Set rs = Nothing
if nr <> 0 then
Randomize
tal = Int(nr * Rnd)
Sql = "SELECT * FROM banner WHERE id=" & ok(tal) & " ORDER BY id"
set RS = conn.execute( SQL )
%>
<html>
<body>
<a href="http://<%=Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL") & "?mode=klik&id="& ok(tal)%>">
<img src="<%=rs("url") %>" width=250 height=60>
</a>
</body>
</html>
<%
vist = rs("vist") + 1
if rs("sidstevistdato") = date() then
Vistidag = rs("Vistidag") + 1
else
Vistidag = 1
end if
set rs = Nothing
conn.execute ( "UPDATE banner SET vist=" & vist & " WHERE id=" & ok(tal) )
conn.execute ( "UPDATE banner SET sidstevistdato='" & date() & "' WHERE id=" & ok(tal) )
conn.execute ( "UPDATE banner SET vistidag=" & Vistidag & " WHERE id=" & ok(tal) )
end if
conn.close
Set conn = Nothing
end sub
sub klik()
set conn = server.createobject("ADODB.connection")
conn.Open connection
SQL = "SELECT * FROM banner WHERE id=" & request.QueryString("id") & " ORDER BY id"
set RS = conn.execute( SQL )
link = rs("link")
Antalklik = rs("klik") + 1
if rs("sidsteklikdato") = date() then
klikidag = rs("klikidag") + 1
else
klikidag = 1
end if
set RS = Nothing
conn.execute ( "UPDATE banner SET klik=" & antalklik & " WHERE id=" & Request.QueryString("id") )
conn.execute ( "UPDATE banner SET sidsteklikdato='" & date() & "' WHERE id=" & Request.QueryString("id") )
conn.execute ( "UPDATE banner SET klikidag=" & klikidag & " WHERE id=" & Request.QueryString("id") )
conn.close
set conn = Nothing
response.redirect link
end sub
sub login()
set conn = server.createobject("ADODB.connection")
conn.Open connection
if request.form("AdminID") = Sysopbruger and request.form("password") = Sysoppass then
Session("Inde") = True
Session("AdminID") = Sysopbruger
Call sysop()
else
SQL = "SELECT * FROM banner WHERE AdminID='" & request.form("Adminid") & "' ORDER BY id"
Set rs = Conn.execute ( SQL )
if not rs.bof or rs.eof then
if request.form("password") = rs("AdminPassword") then
Session("Inde") = True
Session("AdminID") = rs("AdminID")
Response.redirect "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL") &"?mode=admin"
else
response.redirect "login.html"
end if
else
response.redirect "login.html"
end if
Set RS = Nothing
end if
Conn.Close
Set Conn = Nothing
end sub
sub admin()
if not session("inde") = True then
response.redirect "login.html"
end if
set conn = server.createobject("ADODB.connection")
conn.Open connection
SQL = "SELECT * FROM BANNER WHERE adminid='"& session("AdminID") & "' ORDER BY oprettet"
Set RS = Conn.execute ( SQL )
%>
<html>
<body>
<h3>
Dit banner har været vist antal gange: <%=rs("vist") %>
<br>
Dit banner har været vist antal gange idag: <%
if rs("sidstevistdato") = date() then
response.write rs("vistidag")
else
response.write 0
end if
%>
<br>
Antal folk har klikket på dit banner: <%=rs("klik") %>
<br>
Antal folk har klikket på dit banner i dag: <%
if rs("sidsteklikdato") = date() then
response.write rs("klikidag")
else
response.write 0
end if %>
<br>
Dette svare til en klik-rate på:
<%
if not rs("vist") = 0 then
if not rs("klik") = 0 then
response.write FormatNumber(rs("klik") / rs("vist") * 100, 2)
else
response.write 0
end if
else
response.write 0
end if
%>
%
<br>
Du har betalt for antal fremvisninger i alt: <%=rs("Totalfremvisning") %>
<br>
Deraf har du antal fremvisninger tilbage: <%=rs("Totalfremvisning") - rs("vist") %>
<br>
<br>
<br>
<a href="http://<%=Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL") %>?mode=opsatning">
Opsætning
</a>
<br>
<br>
<br>
<br>
<a href="http://<%=Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL")%>?mode=logaf">
Log af
</a>
</h3>
</body>
</html>
<%
Conn.Close
Set RS = Nothing
Set Conn = Nothing
end sub
sub opsatning()
if not session("inde") = True then
response.redirect login.html
end if
set conn = server.createobject("ADODB.connection")
conn.Open connection
SQL = "SELECT * FROM BANNER WHERE adminid='"& session("AdminID") & "' ORDER BY oprettet"
Set RS = Conn.execute ( SQL )
%>
<html>
<head>
<script language="JavaScript">
function check()
{
ikkeok = false
if (document.form.navn.value == "" && ikkeok == false)
{
alert("Du skal indtaste dit navn.")
ikkeok = "True"
return false
}
if (document.form.adresse.value == "" && ikkeok == false)
{
alert("Du skal indtaste din adresse.")
ikkeok = true
return false
}
if (document.form.postnummer.value == "" && ikkeok == false)
{
alert("Du skal indtaste dit postnummer.")
ikkeok = true
return false
}
if (document.form.by.value == "" && ikkeok == false)
{
alert("Du skal indtaste din by.")
ikkeok = true
return false
}
if (document.form.land.value == "" && ikkeok == false)
{
alert("Du skal indtaste dit land.")
ikkeok = true
return false
}
if (document.form.url.value == "" && ikkeok == false)
{
alert("Du skal indtaste en url til banneret.")
ikkeok = true
return false
}
if (document.form.link.value == "" && ikkeok == false)
{
alert("Du skal indtaste et link til banneret.")
ikkeok = true
return false
}
}
</script>
</head>
<body>
<form name="form" action="http://<%=Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL") %>?mode=submitopsatning" method="post">
<table border=2 width=50%>
<tr>
<td>
<h2>
Personlige oplysninger:
</h2>
<table width=100%>
<tr>
<td>
Navn:
</td>
<td>
<input name="navn" value="<%=rs("Navn") %>">
</td>
</tr>
<tr>
<td>
Adresse:
</td>
<td>
<input name="adresse" value="<%=rs("Adresse") %>">
</td>
</tr>
<tr>
<td>
Postnummer/by:
</td>
<td>
<input name="postnummer" size=4 value="<%=rs("Postnummer") %>">
<input name="by" value="<%=rs("Byby") %>">
</td>
</tr>
<tr>
<td>
Land:
</td>
<td>
<input name="land" value="<%=rs("Land") %>">
</td>
</tr>
</table>
</td>
</tr>
</table>
<table border=2 width=50%>
<tr>
<td>
<h2>
Opsætning omkring dit banner:
</h2>
<table width=100%>
<tr>
<td colspan=2>
<table width=100%>
<tr>
<td>
<input type="radio" name="vistid" value="altid"<%
if rs("vistid") = "altid" then
response.write "checked"
end if %> >
Vis altid
</td>
</tr>
<tr>
<td>
<input type="radio" name="vistid" value="fasttid"<%
if rs("vistid") = "fasttid" then
response.write "checked"
end if %> >
Vis kun på følgende tidspunkt:
<table>
<tr>
<td width=20% rowspan=4>
</td>
<td>
<h5>
Vælg dag:
<br>
(hold Ctrl nede for at foretage flere valg)
</h5>
</td>
<td colspan=3>
</td>
</tr>
<td rowspan=3>
<%
ugedag = rs("ugedag")
ugedag = Split(ugedag, ", ", -1, 1)
%>
<select name="ugedag" size=4 multiple>
<option value="ligegyldigt" <%
for x=0 to ubound(ugedag)
if ugedag(x) = "ligegyldigt" or ugedag(x) = "" then
response.write "selected"
end if
Next
%>>Ligegyldig</option>
<option value="mandag" <%
for x=0 to ubound(ugedag)
if ugedag(x) = "mandag" then
response.write "selected"
end if
Next
%>>Mandag</option>
<option value="tirsdag" <%
for x=0 to ubound(ugedag)
if ugedag(x) = "tirsdag" then
response.write "selected"
end if
Next
%>>Tirsdag</option>
<option value="onsdag" <%
for x=0 to ubound(ugedag)
if ugedag(x) = "onsdag" then
response.write "selected"
end if
Next
%>>Onsdag</option>
<option value="torsdag" <%
for x=0 to ubound(ugedag)
if ugedag(x) = "torsdag" then
response.write "selected"
end if
Next
%>>Torsdag</option>
<option value="fredag" <%
for x=0 to ubound(ugedag)
if ugedag(x) = "fredag" then
response.write "selected"
end if
Next
%>>Fredag</option>
<option value="lørdag" <%
for x=0 to ubound(ugedag)
if ugedag(x) = "lørdag" then
response.write "selected"
end if
Next
%>>Lørdag</option>
<option value="søndag" <%
for x=0 to ubound(ugedag)
if ugedag(x) = "søndag" then
response.write "selected"
end if
Next
%>>Søndag</option>
</select>
</td>
<td colspan=3>
<h5>
(lad stå tom hvis tidspunkt er ligegyldigt)
<br>
(der skal være skrevet et klokkeslet i alle felter før funktionen virker)
</h5>
</td>
</tr>
<tr>
<td>
<h5>
Fra kl.
</h5>
</td>
<td>
</td>
<td>
<h5>
Til kl.
</h5>
</td>
</tr>
<tr>
<td>
<input name="startkltim" size=2 value="<%
if not rs("startkltim") = "!" then
response.write rs("startkltim")
end if
%>">
:
<input name="startklmin" size=2 value="<%
if not rs("startklmin") = "!" then
response.write rs("startklmin")
end if
%>">
</td>
<td>
-
</td>
<td>
<input name="slutkltim" size=2 value="<%
if not rs("slutkltim") = "!" then
response.write rs("slutkltim")
end if
%>">
:
<input name="slutklmin" size=2 value="<%
if not rs("slutklmin") = "!" then
response.write rs("slutklmin")
end if
%>">
</td>
</tr>
</table>
</td>
</tr>
</table>
<tr>
<td>
<br>
<br>
Url til bannerfil (468*60 pixels):
</td>
<td>
<br>
<br>
<input name="url" value="<%=rs("url")%>">
</td>
</tr>
<tr>
<td>
Link til banner:
</td>
<td>
<input name="link" value="<%=rs("link")%>">
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<input type="submit" value="Gem indstillinger" onclick="return check()">
<input type="reset" value="Slet nye indtastniner">
<input type="button" value="Anuler og gå tilbage" onclick="location.href='banner.asp?mode=admin'">
</form>
</body>
</html>
<%
Conn.Close
Set RS = Nothing
Set Conn = Nothing
end sub
sub submitopsatning()
if not session("inde") = True then
response.redirect "login.html"
end if
set conn = server.createobject("ADODB.connection")
conn.Open connection
if request.form("startkltim") = "" then
startkltim = "!"
else
startkltim = request.form("startkltim")
end if
if request.form("startklmin") = "" then
startklmin = "!"
else
startklmin = request.form("startklmin")
end if
if request.form("slutkltim") = "" then
slutkltim = "!"
else
slutkltim = request.form("slutkltim")
end if
if request.form("slutklmin") = "" then
slutklmin = "!"
else
slutklmin = request.form("slutklmin")
end if
conn.execute ( "UPDATE banner SET Navn='" & request.form("navn") & "' WHERE adminid='" & Session("adminid") &"'" )
conn.execute ( "UPDATE banner SET adresse='" & request.form("adresse") & "' WHERE adminid='" & Session("adminid") &"'" )
conn.execute ( "UPDATE banner SET postnummer=" & request.form("postnummer") & " WHERE adminid='" & Session("adminid") &"'" )
conn.execute ( "UPDATE banner SET byby='" & request.form("by") & "' WHERE adminid='" & Session("adminid") &"'" )
conn.execute ( "UPDATE banner SET land='" & request.form("land") & "' WHERE adminid='" & Session("adminid") &"'" )
conn.execute ( "UPDATE banner SET vistid='" & request.form("vistid") & "' WHERE adminid='" & Session("adminid") &"'" )
conn.execute ( "UPDATE banner SET Ugedag='" & request.form("Ugedag") & "' WHERE adminid='" & Session("adminid") &"'" )
conn.execute ( "UPDATE banner SET startkltim='" & startkltim & "' WHERE adminid='" & Session("adminid") &"'" )
conn.execute ( "UPDATE banner SET startklmin='" & startklmin & "' WHERE adminid='" & Session("adminid") &"'" )
conn.execute ( "UPDATE banner SET slutkltim='" & slutkltim & "' WHERE adminid='" & Session("adminid") &"'" )
conn.execute ( "UPDATE banner SET slutklmin='" & slutklmin & "' WHERE adminid='" & Session("adminid") &"'" )
conn.execute ( "UPDATE banner SET url='" & request.form("url") & "' WHERE adminid='" & Session("adminid") &"'" )
conn.execute ( "UPDATE banner SET link='" & request.form("link") & "' WHERE adminid='" & Session("adminid") &"'" )
Conn.Close
Set RS = Nothing
Set Conn = Nothing
response.redirect "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL") & "?mode=admin"
end sub
sub sysop()
if session("Inde") <> True or session("AdminID") <> Sysopbruger then
response.redirect "login.html"
end if
%>
<html>
<body>
<h3>
<a href="http://<%=Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL")%>?mode=nybruger">
Tilføj ny bruger
</a>
<br>
<br>
<br>
Ret i følgende brugers profil:
<br>
<form action="http://<%=Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL")%>?mode=retbruger" method="post">
Bruger:
<input name="bruger">
<br>
<br>
<input type="submit" value=" OK ">
</form>
<br>
<br>
<br>
Slet følgende bruger:
<br>
<form action="http://<%=Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL")%>?mode=sletbruger" method="post">
Bruger:
<input name="bruger">
<br>
<br>
<input type="submit" value=" OK ">
</form>
<br>
<br>
<br>
<a href="http://<%=Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL")%>?mode=brugerliste">
Vis liste over brugere
</a>
<br>
<br>
<br>
<br>
<a href="http://<%=Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL")%>?mode=logaf">
Log af
</a>
</h3>
</body>
</html>
<%
end sub
sub nybruger()
if session("inde") <> True or session("AdminID") <> Sysopbruger then
response.redirect "login.html"
end if
%>
<html>
<head>
<script language="JavaScript">
function check()
{
ikkeok = false
if (document.form.AdminID.value == "" && ikkeok == false)
{
alert("Du skal indtaste brugernavnet.")
ikkeok = true
return false
}
if (document.form.AdminPass.value == "" && ikkeok == false)
{
alert("Du skal indtaste passwordet.")
ikkeok = true
return false
}
if (document.form.totalfremvisning.value == "" && ikkeok == false)
{
alert("Du skal indtaste antallet af totale fremvisninger.")
ikkeok = true
return false
}
if (document.form.navn.value == "" && ikkeok == false)
{
alert("Du skal indtaste dit navn.")
ikkeok = "True"
return false
}
if (document.form.adresse.value == "" && ikkeok == false)
{
alert("Du skal indtaste din adresse.")
ikkeok = true
return false
}
if (document.form.postnummer.value == "" && ikkeok == false)
{
alert("Du skal indtaste dit postnummer.")
ikkeok = true
return false
}
if (document.form.by.value == "" && ikkeok == false)
{
alert("Du skal indtaste din by.")
ikkeok = true
return false
}
if (document.form.land.value == "" && ikkeok == false)
{
alert("Du skal indtaste dit land.")
ikkeok = true
return false
}
if (document.form.url.value == "" && ikkeok == false)
{
alert("Du skal indtaste en url til banneret.")
ikkeok = true
return false
}
if (document.form.link.value == "" && ikkeok == false)
{
alert("Du skal indtaste et link til banneret.")
ikkeok = true
return false
}
}
</script>
</head>
<body>
<form name="form" action="http://<%=Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL") %>?mode=submitnybruger" method="post">
<table border=2 width=50%>
<tr>
<td>
<h2>
Admin:
</h2>
<table width=100%>
<tr>
<td width=30%>
Totale fremvisninger:
</td>
<td>
<input name="totalfremvisning" size=6>
</td>
</tr>
<tr>
<td>
Brugernavn:
</td>
<td>
<input name="AdminID">
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type="password" name="AdminPass">
</td>
</tr>
</table>
</td>
</tr>
</table>
<table border=2 width=50%>
<tr>
<td>
<h2>
Personlige oplysninger:
</h2>
<table width=100%>
<tr>
<td>
Navn:
</td>
<td>
<input name="navn">
</td>
</tr>
<tr>
<td>
Adresse:
</td>
<td>
<input name="adresse">
</td>
</tr>
<tr>
<td>
Postnummer/by:
</td>
<td>
<input name="postnummer" size=4>
<input name="by">
</td>
</tr>
<tr>
<td>
Land:
</td>
<td>
<input name="land">
</td>
</tr>
</table>
</td>
</tr>
</table>
<table border=2 width=50%>
<tr>
<td>
<h2>
Opsætning omkring dit banner:
</h2>
<table width=100%>
<tr>
<td colspan=2>
<table width=100%>
<tr>
<td>
<input type="radio" name="vistid" value="altid" checked>
Vis altid
</td>
</tr>
<tr>
<td>
<input type="radio" name="vistid">
Vis kun på følgende tidspunkt:
<table>
<tr>
<td width=20% rowspan=4>
</td>
<td>
<h5>
Vælg dag:
<br>
(hold Ctrl nede for at foretage flere valg)
</h5>
</td>
<td colspan=3>
</td>
</tr>
<td rowspan=3>
<select name="ugedag" size=4 multiple>
<option value="ligegyldigt" selected>Ligegyldig</option>
<option value="mandag">Mandag</option>
<option value="tirsdag">Tirsdag</option>
<option value="onsdag">Onsdag</option>
<option value="torsdag">Torsdag</option>
<option value="fredag">Fredag</option>
<option value="lørdag">Lørdag</option>
<option value="søndag">Søndag</option>
</select>
</td>
<td colspan=3>
<h5>
(lad stå tom hvis tidspunkt er ligegyldigt)
<br>
(der skal være skrevet et klokkeslet i alle felter før funktionen virker)
</h5>
</td>
</tr>
<tr>
<td>
<h5>
Fra kl.
</h5>
</td>
<td>
</td>
<td>
<h5>
Til kl.
</h5>
</td>
</tr>
<tr>
<td>
<input name="startkltim" size=2>
:
<input name="startklmin" size=2>
</td>
<td>
-
</td>
<td>
<input name="slutkltim" size=2>
:
<input name="slutklmin" size=2>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<br>
<br>
Url til bannerfil (468*60 pixels):
</td>
<td>
<br>
<br>
<input name="url">
</td>
</tr>
<tr>
<td>
Link til banner:
</td>
<td>
<input name="link">
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<input type="submit" value="Gem indstillinger" onclick="return check()">
<input type="reset" value="Slet nye indtastniner">
<input type="button" value="Anuler og gå tilbage" onclick="location.href='banner.asp?mode=sysop'">
</form>
</body>
</html>
<%
end sub
sub submitnybruger()
if session("inde") <> True or session("AdminID") <> Sysopbruger then
response.redirect "login.html"
end if
set conn = server.createobject("ADODB.connection")
conn.Open connection
if request.form("startkltim") = "" then
startkltim = "!"
else
startkltim = request.form("startkltim")
end if
if request.form("startklmin") = "" then
startklmin = "!"
else
startklmin = request.form("startklmin")
end if
if request.form("slutkltim") = "" then
slutkltim = "!"
else
slutkltim = request.form("slutkltim")
end if
if request.form("slutklmin") = "" then
slutklmin = "!"
else
slutklmin = request.form("slutklmin")
end if
SQL = "SELECT * FROM banner WHERE adminID='" & request.form("AdminID") & "' ORDER BY oprettet"
set rs = conn.execute ( SQL )
if rs.eof or rs.bof then
SQL = "INSERT INTO banner (AdminPassword, AdminID, Link, Totalfremvisning, url, Navn, Adresse, postnummer, byby, Land, vistid, ugedag, startkltim, startklmin, slutkltim, slutklmin) VALUES ('"
SQL = SQL & request.form("AdminPass") & "', '"
SQL = SQL & request.form("AdminID") & "', '"
SQL = SQL & request.form("Link") & "', "
SQL = SQL & request.form("Totalfremvisning") & ", '"
SQL = SQL & request.form("url") & "', '"
SQL = SQL & request.form("Navn") & "', '"
SQL = SQL & request.form("Adresse") & "', '"
SQL = SQL & request.form("Postnummer") & "', '"
SQL = SQL & request.form("by") & "', '"
SQL = SQL & request.form("Land") & "', '"
SQL = SQL & request.form("vistid") & "', '"
SQL = SQL & request.form("ugedag") & "', '"
SQL = SQL & startkltim & "', '"
SQL = SQL & startklmin & "', '"
SQL = SQL & slutkltim & "', '"
SQL = SQL & slutklmin & "')"
conn.execute ( SQL )
response.redirect "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL") & "?mode=sysop"
else
response.write "Brugernavn er allerede brugt"
end if
set rs = Nothing
conn.close
Set conn = Nothing
end sub
sub retbruger()
set conn = server.createobject("ADODB.connection")
conn.Open connection
Sql = "SELECT * FROM banner WHERE AdminID='" & request.form("bruger") & "' ORDER BY oprettet"
set RS = conn.execute( SQL )
if session("inde") <> True or session("AdminID") <> Sysopbruger then
response.redirect "login.html"
end if
if rs.eof or rs.bof then
Response.write "Bruger ikke fundet."
else
%>
<html>
<head>
<script language="JavaScript">
function check()
{
ikkeok = false
if (document.form.AdminID.value == "" && ikkeok == false)
{
alert("Du skal indtaste brugernavnet.")
ikkeok = true
return false
}
if (document.form.AdminPass.value == "" && ikkeok == false)
{
alert("Du skal indtaste passwordet.")
ikkeok = true
return false
}
if (document.form.totalfremvisning.value == "" && ikkeok == false)
{
alert("Du skal indtaste antallet af totale fremvisninger.")
ikkeok = true
return false
}
if (document.form.navn.value == "" && ikkeok == false)
{
alert("Du skal indtaste dit navn.")
ikkeok = "True"
return false
}
if (document.form.adresse.value == "" && ikkeok == false)
{
alert("Du skal indtaste din adresse.")
ikkeok = true
return false
}
if (document.form.postnummer.value == "" && ikkeok == false)
{
alert("Du skal indtaste dit postnummer.")
ikkeok = true
return false
}
if (document.form.by.value == "" && ikkeok == false)
{
alert("Du skal indtaste din by.")
ikkeok = true
return false
}
if (document.form.land.value == "" && ikkeok == false)
{
alert("Du skal indtaste dit land.")
ikkeok = true
return false
}
if (document.form.url.value == "" && ikkeok == false)
{
alert("Du skal indtaste en url til banneret.")
ikkeok = true
return false
}
if (document.form.link.value == "" && ikkeok == false)
{
alert("Du skal indtaste et link til banneret.")
ikkeok = true
return false
}
}
</script>
</head>
<body>
<form name="form" action="http://<%=Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL") %>?mode=submitsysopandringer&adminID=<%=Request.form("bruger")%>" method="post">
<table border=2 width=50%>
<tr>
<td>
<h2>
Admin:
</h2>
<table width=100%>
<tr>
<td width=30%>
Totale fremvisninger:
</td>
<td>
<input name="totalfremvisning" size=6 value="<%=rs("totalfremvisning") %>">
</td>
</tr>
<tr>
<td>
Brugernavn:
</td>
<td>
<input name="AdminID" value="<%=rs("AdminID") %>">
</td>
</tr>
<tr>
<td>
Gammelt password:
</td>
<td>
<input value="<%=rs("AdminPassword") %>">
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type="password" name="AdminPassword">
</td>
</tr>
<tr>
<td colspan=2>
(lad stå tom hvis det stadig skal forblive det gamle)
</td>
</tr>
</table>
</td>
</tr>
</table>
<table border=2 width=50%>
<tr>
<td>
<h2>
Personlige oplysninger:
</h2>
<table width=100%>
<tr>
<td>
Navn:
</td>
<td>
<input name="navn" value="<%=rs("Navn") %>">
</td>
</tr>
<tr>
<td>
Adresse:
</td>
<td>
<input name="adresse" value="<%=rs("Adresse") %>">
</td>
</tr>
<tr>
<td>
Postnummer/by:
</td>
<td>
<input name="postnummer" size=4 value="<%=rs("Postnummer") %>">
<input name="by" value="<%=rs("byby") %>">
</td>
</tr>
<tr>
<td>
Land:
</td>
<td>
<input name="land" value="<%=rs("land") %>">
</td>
</tr>
</table>
</td>
</tr>
</table>
<table border=2 width=50%>
<tr>
<td>
<h2>
Opsætning omkring banner:
</h2>
<table width=100%>
<tr>
<td colspan=2>
<table width=100%>
<tr>
<td>
<input type="radio" name="vistid" value="altid"<%
if rs("vistid") = "altid" then
response.write "checked"
end if %> >
Vis altid
</td>
</tr>
<tr>
<td>
<input type="radio" name="vistid" value="fasttid"<%
if rs("vistid") = "fasttid" then
response.write "checked"
end if %> >
Vis kun på følgende tidspunkt:
<table>
<tr>
<td width=20% rowspan=4>
</td>
<td>
<h5>
Vælg dag:
<br>
(hold Ctrl nede for at foretage flere valg)
</h5>
</td>
<td colspan=3>
</td>
</tr>
<td rowspan=3>
<%
ugedag = rs("ugedag")
ugedag = Split(ugedag, ", ", -1, 1)
%>
<select name="ugedag" size=4 multiple>
<option value="ligegyldigt" <%
for x=0 to ubound(ugedag)
if ugedag(x) = "ligegyldigt" or ugedag(x) = "" then
response.write "selected"
end if
Next
%>>Ligegyldig</option>
<option value="mandag" <%
for x=0 to ubound(ugedag)
if ugedag(x) = "mandag" then
response.write "selected"
end if
Next
%>>Mandag</option>
<option value="tirsdag" <%
for x=0 to ubound(ugedag)
if ugedag(x) = "tirsdag" then
response.write "selected"
end if
Next
%>>Tirsdag</option>
<option value="onsdag" <%
for x=0 to ubound(ugedag)
if ugedag(x) = "onsdag" then
response.write "selected"
end if
Next
%>>Onsdag</option>
<option value="torsdag" <%
for x=0 to ubound(ugedag)
if ugedag(x) = "torsdag" then
response.write "selected"
end if
Next
%>>Torsdag</option>
<option value="fredag" <%
for x=0 to ubound(ugedag)
if ugedag(x) = "fredag" then
response.write "selected"
end if
Next
%>>Fredag</option>
<option value="lørdag" <%
for x=0 to ubound(ugedag)
if ugedag(x) = "lørdag" then
response.write "selected"
end if
Next
%>>Lørdag</option>
<option value="søndag" <%
for x=0 to ubound(ugedag)
if ugedag(x) = "søndag" then
response.write "selected"
end if
Next
%>>Søndag</option>
</select>
</td>
<td colspan=3>
<h5>
(lad stå tom hvis tidspunkt er ligegyldigt)
<br>
(der skal være skrevet et klokkeslet i alle felter før funktionen virker)
</h5>
</td>
</tr>
<tr>
<td>
<h5>
Fra kl.
</h5>
</td>
<td>
</td>
<td>
<h5>
Til kl.
</h5>
</td>
</tr>
<tr>
<td>
<input name="startkltim" size=2 value="<%
if not rs("startkltim") = "!" then
response.write rs("startkltim")
end if
%>">
:
<input name="startklmin" size=2 value="<%
if not rs("startklmin") = "!" then
response.write rs("startklmin")
end if
%>">
</td>
<td>
-
</td>
<td>
<input name="slutkltim" size=2 value="<%
if not rs("slutkltim") = "!" then
response.write rs("slutkltim")
end if
%>">
:
<input name="slutklmin" size=2 value="<%
if not rs("slutklmin") = "!" then
response.write rs("slutklmin")
end if
%>">
</td>
</tr>
</table>
</td>
</tr>
</table>
<tr>
<td>
<br>
<br>
Url til bannerfil (468*60 pixels):
</td>
<td>
<br>
<br>
<input name="url" value="<%=rs("url")%>">
</td>
</tr>
<tr>
<td>
Link til banner:
</td>
<td>
<input name="link" value="<%=rs("link")%>">
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<input type="submit" value="Gem indstillinger" onclick="return check()">
<input type="reset" value="Slet nye indtastniner">
<input type="button" value="Anuler og gå tilbage" onclick="location.href='banner.asp?mode=sysop'">
</form>
</body>
</html>
<%
end if
end sub
sub submitsysopandringer()
if session("inde") <> True or session("AdminID") <> Sysopbruger then
response.redirect "login.html"
end if
set conn = server.createobject("ADODB.connection")
conn.Open connection
if request.form("startkltim") = "" then
startkltim = "!"
else
startkltim = request.form("startkltim")
end if
if request.form("startklmin") = "" then
startklmin = "!"
else
startklmin = request.form("startklmin")
end if
if request.form("slutkltim") = "" then
slutkltim = "!"
else
slutkltim = request.form("slutkltim")
end if
if request.form("slutklmin") = "" then
slutklmin = "!"
else
slutklmin = request.form("slutklmin")
end if
conn.execute ( "UPDATE banner SET AdminID='" & request.form("AdminID") & "' WHERE AdminID='" & Request.QueryString("adminid") &"'" )
if not request.form("AdminPassword") = "" then
conn.execute ( "UPDATE banner SET AdminPassword='" & request.form("AdminPassword") & "' WHERE AdminID='" & Request.QueryString("adminid") & "'" )
end if
conn.execute ( "UPDATE banner SET Navn='" & request.form("navn") & "' WHERE adminid='" & Request.QueryString("adminid") &"'" )
conn.execute ( "UPDATE banner SET adresse='" & request.form("adresse") & "' WHERE adminid='" & Request.QueryString("adminid") &"'" )
conn.execute ( "UPDATE banner SET postnummer=" & request.form("postnummer") & " WHERE adminid='" & Request.QueryString("adminid") &"'" )
conn.execute ( "UPDATE banner SET byby='" & request.form("by") & "' WHERE adminid='" & Request.QueryString("adminid") &"'" )
conn.execute ( "UPDATE banner SET land='" & request.form("land") & "' WHERE adminid='" & Request.QueryString("adminid") &"'" )
conn.execute ( "UPDATE banner SET vistid='" & request.form("vistid") & "' WHERE adminid='" & Request.QueryString("adminid") &"'" )
conn.execute ( "UPDATE banner SET Ugedag='" & request.form("Ugedag") & "' WHERE adminid='" & Request.QueryString("adminid") &"'" )
conn.execute ( "UPDATE banner SET startkltim='" & startkltim & "' WHERE adminid='" & Request.QueryString("adminid") &"'" )
conn.execute ( "UPDATE banner SET startklmin='" & startklmin & "' WHERE adminid='" & Request.QueryString("adminid") &"'" )
conn.execute ( "UPDATE banner SET slutkltim='" & slutkltim & "' WHERE adminid='" & Request.QueryString("adminid") &"'" )
conn.execute ( "UPDATE banner SET slutklmin='" & slutklmin & "' WHERE adminid='" & Request.QueryString("adminid") &"'" )
conn.execute ( "UPDATE banner SET url='" & request.form("url") & "' WHERE adminid='" & Request.QueryString("adminid") &"'" )
conn.execute ( "UPDATE banner SET link='" & request.form("link") & "' WHERE adminid='" & Request.QueryString("adminid") &"'" )
Conn.Close
Set RS = Nothing
Set Conn = Nothing
response.redirect "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL") & "?mode=sysop"
end sub
sub brugerliste()
if session("inde") <> True or session("AdminID") <> Sysopbruger then
response.redirect "login.html"
end if
set conn = server.createobject("ADODB.connection")
conn.Open connection
Sql = "SELECT * FROM banner ORDER BY oprettet DESC"
set RS = conn.execute( SQL )
%>
<html>
<body>
<h3>
<%
do until rs.eof or rs.bof
response.write rs("AdminID") & "<br>"
rs.MoveNext
Loop
%>
</h3>
</body>
</html>
<%
end sub
sub logaf()
Session("inde") = False
Session("AdminID") = ""
response.redirect logafside
end sub
sub sletbruger()
set conn = server.createobject("ADODB.connection")
conn.Open connection
Sql = "DELETE * FROM banner WHERE AdminID = '" & request.form("Bruger") & "'"
conn.execute( Sql )
conn.close
set conn = Nothing
response.write "Bruger " & request.form("Bruger") & " er nu slettet.<p><a href=""http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL") & "?mode=sysop"">Tilbage</a>"
end sub
if request.QueryString("mode") = "vis" then
Call visbanner()
elseif request.QueryString("mode") = "klik" then
Call klik()
elseif request.QueryString("mode") = "login" then
Call login()
elseif request.QueryString("mode") = "admin" then
Call Admin()
elseif request.QueryString("mode") = "opsatning" then
Call opsatning()
elseif request.QueryString("mode") = "submitopsatning" then
Call submitopsatning()
elseif request.QueryString("mode") = "nybruger" then
Call nybruger()
elseif request.QueryString("mode") = "submitnybruger" then
Call submitnybruger()
elseif request.QueryString("mode") = "retbruger" then
Call retbruger()
elseif request.QueryString("mode") = "sysop" then
Call sysop()
elseif request.QueryString("mode") = "submitsysopandringer" then
Call submitsysopandringer()
elseif request.QueryString("mode") = "brugerliste" then
Call brugerliste()
elseif request.QueryString("mode") = "logaf" then
Call logaf()
elseif request.QueryString("mode") = "sletbruger" then
Call sletbruger()
else
Call visbanner()
end if
%>