/ Forside / Teknologi / Udvikling / ASP / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
ASP
#NavnPoint
smorch 9259
Harlekin 1866
molokyle 1040
Steffanst.. 758
gandalf 657
smilly 564
gibson 560
cumano 530
MouseKeep.. 480
10  Random 410
Kun X antal bokse??
Fra : Brøggers Webdesign


Dato : 29-01-02 18:25

Hej Gruppe...

Jeg har et problem... Hvordan gør jeg hvis jeg gerne vil have at der kun
skal være 10 af de her tagwalls-beskeder???

Mvh.: Kenneth Brøgger

P.s.: Hvis du vil må du MEGET gerne skrive det til broegger@private.dk !


Option Explicit
Dim ConnDB, RS, nick, email, besked

Set ConnDB = Server.CreateObject("ADODB.Connection")
ConnDB.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
server.MapPath("db\database.mdb")
'Fjerner evt mellemrum i start og slut af input
nick = Trim(Request.Form("nick"))
email = Trim(Request.Form("email"))
besked = Trim(Request.Form("besked"))
'-----------------------------------------------------------
IF (len(nick) <> 0) or len(email) <> 0 or len(besked) <> 0 Then
'Der er indsendt data
IF (len(nick) <> 0) ANd len(email) <> 0 AND len(besked) <> 0 Then
IF ConnDB.Execute ("SELECT * FROM tagwall WHERE nick='" & nick & "' AND
email='" & email & "' AND besked='" & besked & "'").EOF Then
ConnDB.execute "INSERT INTO tagwall (nick,email,dato,besked) VALUES ('" &
nick & "','" & email & "','" & Now() & "','" & besked & "')"
Response.Redirect "index.asp"
ELSE
StartOfPage
InputForm
%><SPAN CLASS="almText" STYLE="color: red">Du er ved at spammer
TagWall'en<BR>STOP DET, tak</SPAN><P>
<%
tagwall
EndOfPage
End if
ELSE
'Alle felter er ikke udfyldt
StartOfPage
InputForm
%><SPAN CLASS="almText" STYLE="color: red">Du mangeler at udfylde nogle af
felterne!!!</SPAN><P>
<%
tagwall
EndOfPage
End if
Else
StartOfPage
InputForm
tagwall
EndOfPage
End if
'-----------------------------------------------------------
sub StartOfPage
%>
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
function open_window(url,sizeX,sizeY) {
mywin =
window.open(url,'smileyWin','toolbar=0,location=0,directories=0,status=0,men
ubar=0,scrollbars=0,resizable=0,width=' + sizeX +',height='+ sizeY + '');
}
-->
</SCRIPT>
<STYLE>
..almText{
FONT-FAMILY: Verdana;
FONT-SIZE: 11px;
}

A.link1{
FONT-FAMILY: Verdana;
FONT-SIZE: 11px;
color: red;
TEXT-DECORATION: none;
}

A.link1:hover{
FONT-FAMILY: Verdana;
FONT-SIZE: 11px;
color: red;
font-weight: none;
TEXT-DECORATION: underline;
}

..FlatButton{
font-family: Vendana;
font-size: 11px;
color: #FFFFFF;
background-color: red;
border: 1px solid;
border-color: #000000;
}

..FlatInput{
font-family: Vendana;
font-size: 11px;
background-color: #FFFFFF;
border: #000000;
border-style: solid;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
}
</STYLE>
<link rel='stylesheet' href='.../_css/css.css' type='text/css'>
</HEAD>
<BODY BGCOLOR="#FFFFFF" background=.../_images/bg.jpg marginheight="0"
topmargin="0" marginwidth="5" leftmargin="5">
<%
end sub
'-----------------------------------------------------------
sub EndOfPage
%>
<HR size=1 color="red">
<SPAN CLASS="almtext"><CENTER>Ved evt. fejl eller mangler, kontakt venligst
<br><a href=mailto:kenneth@kenjes.dk>Kenneth Brøgger</a>
</BODY>
</HTML>
<%
end sub
'-----------------------------------------------------------
sub InputForm
%>
<center><FORM action="index.asp" METHOD="post" NAME="tagwall"><BR>
<TABLE border=0 cellPadding=0 cellSpacing=0>
<TR>
<TD CLASS="almtext" width=50>Navn</TD>
<TD><INPUT TYPE="text" name="nick" SIZE="12" CLASS="Flatinput"
VALUE="<%=nick%>"></TD>
</TR>
<TR>
<TD CLASS="almtext">E-mail</TD>
<TD><INPUT TYPE="text" name="email" SIZE="12" MAXLENGTH="35"
CLASS="FlatInput" VALUE="<%=email%>"></TD>
</TR>
<TR>
<TD CLASS="almtext">Besked</TD>
<TD><INPUT TYPE="text" name="besked" SIZE="30" MAXLENGTH="200"
CLASS="FlatInput"></TD>
</TR>
<TR>
<TD>&nbsp;</TD>
<TD><INPUT TYPE="submit" VALUE="Skriv" CLASS="FlatButton" id=submit1
name=submit1>&nbsp;[&nbsp;<A
href="Javascripten_window('smiley.htm','375','350');" CLASS="link1">Vis
smiley hjælp</A>&nbsp;]</TD>
</TR>
</TABLE>
</FORM>
<%
end sub
'-----------------------------------------------------------
sub tagwall
Set RS = ConnDB.Execute("SELECT * FROM tagwall ORDER BY id DESC")
Do While Not Rs.eof
besked = RS("besked")
besked = Replace(besked,":)","<IMG SRC=gfx/s_yes.gif>")
besked = Replace(besked,"","<IMG SRC=gfx/s_yes.gif>")
besked = Replace(besked,"","<img src=gfx/s_no.gif>")
besked = Replace(besked,":(","<img src=gfx/s_no.gif>")
besked = Replace(besked,":)","<img src=gfx/s_yes.gif>")
besked = Replace(besked,":(","<img src=gfx/s_no.gif>")
besked = Replace(besked,">(","<img src=gfx/s_angry.gif>")
besked = Replace(besked,"8)","<img src=gfx/s_shade.gif>")
besked = Replace(besked,";)","<img src=gfx/s_wink.gif>")
besked = Replace(besked,":D","<img src=gfx/s_happy.gif>")
besked = Replace(besked,":P","<img src=gfx/s_tounge.gif>")
besked = Replace(besked,"#)","<img src=gfx/s_clown.gif>")
besked = Replace(besked,"[s_onfire]","<img src=gfx/s_fire.gif>")
besked = Replace(besked,"[s_angel]","<img src=gfx/s_angel.gif>")
besked = Replace(besked,"[s_finger]","<img src=gfx/s_finger.gif>")
besked = Replace(besked,"[s_finger2]","<img src=gfx/s_finger2.gif>")
besked = Replace(besked,"[s_puke]","<img src=gfx/s_puke.gif>")
besked = Replace(besked,"[s_sex]","<img src=gfx/s_sex.gif>")
besked = Replace(besked,"[s_silly]","<img src=gfx/s_silly.gif>")
besked = Replace(besked,"[s_shoot]","<img src=gfx/s_enforcer.gif>")
besked = Replace(besked,"[s_sniper]","<img src=gfx/s_camper.gif>")
besked = Replace(besked,"[s_chain]","<img src=gfx/s_shoot.gif>")
besked = Replace(besked,"[s_rocket]","<img src=gfx/s_rocket.gif>")
besked = Replace(besked,"[s_newbie]","<img src=gfx/s_newbie.gif>")
%>


<table width="351" border="0" cellspacing="0" cellpadding="0"
align="center" class="bottom">
<tr>
<td width="11" rowspan="2" class="left">&nbsp;</td>
<td width="209" height="12" class="top"><b class="text"><A
HREF=mailto:<%=RS("email")%>><%=RS("nick")%></a></b></td>
<td height="12" class="top" width="200">
<div align="right"><font size="1" face="Verdana, Arial,
Helvetica, sans-serif"><b>
<%=day(RS("dato"))%>/<%=month(RS("dato"))%></b></font></div>
</td>
<td width="11" rowspan="2" class="right">&nbsp;</td>
<td width="12" rowspan="2" valign="bottom"><img
src=".../_images/red.jpg" width="12" height="25"></td>
</tr>
<tr>
<td colspan="2" class="dotted" valign="top">
<p class="text"><%=besked%>
</p>
</td>
</tr>
</table>







</TD>
</TR>
</TABLE>
<BR>


<%
RS.movenext
Loop
end sub
%>




 
 
Jakob Andersen (29-01-2002)
Kommentar
Fra : Jakob Andersen


Dato : 29-01-02 18:34

"Brøggers Webdesign" <broegger@private.dk> wrote in message
news:3c56dbe5$0$266$d40e179e@nntp02.dk.telia.net...
> Jeg har et problem... Hvordan gør jeg hvis jeg gerne vil have at der kun
> skal være 10 af de her tagwalls-beskeder???

> IF ConnDB.Execute ("SELECT * FROM tagwall WHERE nick='" & nick & "' AND
> email='" & email & "' AND besked='" & besked & "'").EOF Then

If ConnDB.Execute( "SELECT TOP 10 * FROM tagwall WHERE nick='" & nick & "'
AND email='" & email & "' AND besked='" & besked & "' ORDER BY dato
DESC").EOF Then

så skulle den være der.

--
Jakob Andersen
Er du god til ASP og mangler du et job?
Så kontakt mig på jta@advice.dk



Søg
Reklame
Statistik
Spørgsmål : 177554
Tips : 31968
Nyheder : 719565
Indlæg : 6408852
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste