Hej,
Er der nogen der lige vil se koden igennem og se om programmeringen er fin
eller om der er nogen løse lykker eller lign.?
Slet fra listen:
<html>
<head>
<title>Mailliste</title>
</head>
<body>
<div align="center"><center>
<table border="0" width="600" cellspacing="0" cellpadding="3"
style="border-left: 1px solid rgb(0,0,0); border-right: 1px solid
rgb(0,0,0); border-top: 1px solid rgb(0,0,0); border-bottom: 2px solid
rgb(0,0,0)">
<tr>
<td width="100%" bgcolor="#000000"><p align="center"><font
face="verdana" size="4"
color="#FFFFFF"><strong>Mailliste</strong></font></td>
</tr>
<tr align="center">
<td width="100%">
<%
'Hvis der er mere end en markeret, så put dem i et array for en
sikkerheds skyld
selected = Request.Form("ids")
id = split(selected,",")
'Tilslut databasen
set conn = server.createobject("ADODB.connection")
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtemp=dsntemp & "DBQ=" & server.mappath("mailing.mdb")
conn.Open DSNtemp
For I = 0 To (UBound(id))
sqlstmt = "DELETE * from mailingliste WHERE ID=" & id(I)
set RS = conn.execute( sqlstmt )
Next
set conn = Nothing
%>
<center> <font face="verdana" size="2"><strong>Du har nu slettet
de markerede personer!</strong></font><br><br>
</strong></font></center>
<center> <a href="
http://sti.dk">
SRC="http://sti.dk/logud-blaablaa.gif">
</td>
</tr>
<tr align="center">
</tr>
</table>
</center></div>
</body>
Add/Slet fra listen:
<%
if request("mode") = "send" then
Navn = request.Form("navn")
Email = request.Form("email")
Dim DB_CONNECTIONSTRING
DB_CONNECTIONSTRING = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &
Server.Mappath("./mailing.mdb") & ";"
%>
<!--#include file="adovbs.inc"-->
<%
Set Connect = Server.CreateObject("ADODB.Connection")
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtemp=dsntemp & "DBQ=" & server.mappath("mailing.mdb")
Connect.Open DSNtemp
Set RS = Connect.Execute("SELECT * FROM mailingliste WHERE Email='" &
CStr(Email) & "'")
If RS.BOF or RS.EOF Then
'[KODE TIL AT OPRETTE BRUGER]
'Opdater liste med konkurrencer
if not Navn = "" OR Email = "" then
Dim objRecordset
Set objRecordset = Server.CreateObject("ADODB.Recordset")
objRecordset.Open "mailingliste", DB_CONNECTIONSTRING, adOpenStatic,
adLockPessimistic, adCmdTable
objRecordset.AddNew
objRecordset.Fields("Navn") = CStr(Navn)
objRecordset.Fields("Email") = CStr(Email)
objRecordset.Update
objRecordset.Close
Set objRecordset = Nothing
Response.Redirect "
http://www.xxx.dk"
else
Response.Write("Du har ikke udfyldt alle felter")
end if
Set Connect = Nothing
Set RS = Nothing
Else
Response.Write "E-mail adressen findes allerede"
End If
else
%>
<td align="left" valign="top">
<font face="arial" size=2>
<center><font size=4><b>Tilmeld & Afmeld dig
Mailing-Liste:</b></font></center>
<br>
Skriv din E-mail herunder og du vil blive Tilmeldt med det samme </center>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<CENTER>
<TABLE BORDER="0">
<form action="add.asp" METHOD="POST">
<INPUT TYPE="hidden" NAME="mode" VALUE="send">
<TR>
<TD ALIGN="LEFT">
<FONT FACE="Arial" SIZE="2" COLOR="#000000"><STRONG>
Navn:
</STRONG></FONT>
</TD>
<TD ALIGN="LEFT">
<INPUT TYPE="TEXT" NAME="navn" SIZE="50">
</TD>
</TR>
<TR>
<TD ALIGN="LEFT">
<FONT FACE="Arial" SIZE="2" COLOR="#000000"><STRONG>
E-mail:
</STRONG></FONT>
</TD>
<TD ALIGN="LEFT">
<INPUT TYPE="TEXT" NAME="email" SIZE="50">
</TD>
</TR>
<TR>
<TD ALIGN="LEFT">
</TD>
<TD ALIGN="RIGHT">
<input type="submit" value="-- TILMELD MIG --">
</TD>
</TR>
</FORM>
</TABLE>
<br><br>
Skriv din E-mail herunder og du vil blive afmeld med det samme ( Vær
opmærksom på, at det skal være den orginale email adresse.)<br><br>
</center>
<CENTER>
<TABLE BORDER="0">
<FORM Action="remove_from_list.asp" METHOD="POST">
<INPUT TYPE="hidden" NAME="mode" VALUE="send">
<TR>
<TD ALIGN="LEFT">
<FONT FACE="Arial" SIZE="2" COLOR="#000000"><STRONG>
Navn:
</STRONG></FONT>
</TD>
<TD ALIGN="LEFT">
<INPUT TYPE="TEXT" NAME="navn" SIZE="50">
</TD>
</TR>
<TR>
<TD ALIGN="LEFT">
<FONT FACE="Arial" SIZE="2" COLOR="#000000"><STRONG>
E-mail:
</STRONG></FONT>
</TD>
<TD ALIGN="LEFT">
<INPUT TYPE="Text" Name="Email" SIZE="50">
</TD>
</TR>
<TR>
<TD ALIGN="LEFT">
</TD>
<TD ALIGN="RIGHT">
<input type="submit" value="-- AFMELD MIG --">
</TD>
</TR>
</FORM>
</TABLE>
<br><br>
</font>
</td>
</tr>
</center>
</table>
</td>
</tr>
</table>
</body>
</html>
<% end if %>