28. august 2003 - 12:17
#5
Jeg har lavet et tabel (badwords) og indsat nogle bande ord, jeg indsætter koden her, kan i så ikke lige fortælle hvor jeg laver replace?
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/Conn.asp" -->
<%
' *** Edit Operations: declare variables
MM_editAction = CStr(Request("URL"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert")) <> "") Then
MM_editConnection = MM_Conn_STRING
MM_editTable = "besked"
MM_editRedirectUrl = "defter.asp"
MM_fieldsStr = "navn|value|besked|value"
MM_columnsStr = "navn|',none,''|besked|',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
If (CStr(Request("MM_insert")) <> "") Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
FormVal = MM_fields(i+1)
MM_typeArray = Split(MM_columns(i+1),",")
Delim = MM_typeArray(0)
If (Delim = "none") Then Delim = ""
AltVal = MM_typeArray(1)
If (AltVal = "none") Then AltVal = ""
EmptyVal = MM_typeArray(2)
If (EmptyVal = "none") Then EmptyVal = ""
If (FormVal = "") Then
FormVal = EmptyVal
Else
If (AltVal <> "") Then
FormVal = AltVal
ElseIf (Delim = "'") Then ' escape quotes
FormVal = "'" & Replace(FormVal,"'","''") & "'"
Else
FormVal = Delim + FormVal + Delim
End If
End If
If (i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End if
MM_tableValues = MM_tableValues & MM_columns(i)
MM_dbValues = MM_dbValues & FormVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<%
set gaestebog = Server.CreateObject("ADODB.Recordset")
gaestebog.ActiveConnection = MM_Conn_STRING
gaestebog.Source = "SELECT * FROM besked ORDER BY id DESC"
gaestebog.CursorType = 0
gaestebog.CursorLocation = 2
gaestebog.LockType = 3
gaestebog.Open()
gaestebog_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
gaestebog_numRows = gaestebog_numRows + Repeat1__numRows
%>
<html>
<head>
<title>Default</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="css/body.css" type="text/css">
<link rel="stylesheet" href="css/border.css" type="text/css">
<script language="JavaScript">
<!--
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') {
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="" bottommargin="0" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
<tr>
<!--top banner -->
<td width="100%" height="100" align="center" colspan="2"><img src="billeder/banner2.gif" width="790" height="100"></td>
</tr>
<tr align="center">
<!--billeder -->
<td width="0%" height="80" bgcolor="000000"> </td>
<td width="100%" height="80" align="left" bgcolor="000000"><img src="billeder/banner.gif" width="795" height="80"></td>
</tr>
<tr>
<!-- indhold-->
<td bgcolor="006633" align="left" valign="top" height="100%">
<table width="118" border="0" cellspacing="0" cellpadding="2" height="160">
<tr>
<td width="22" height="18" align="center" valign="middle"> </td>
<td align="left" width="100" height="18"><a href="default.asp">Ana sayfa</a></td>
</tr>
<tr>
<td width="22" height="18"> </td>
<td align="left" width="100" height="18"><a href="tarih.htm">Tarih</a></td>
</tr>
<tr>
<td width="22" height="18"> </td>
<td align="left" width="100" height="18"><a href="deyimler.asp">Deyimler</a></td>
</tr>
<tr>
<td width="22" height="18"> </td>
<td align="left" width="100" height="18"><a href="sozluk.asp">Sözlük</a></td>
</tr>
<tr>
<td width="22" height="18"> </td>
<td align="left" width="100" height="18"><a href="turkuler.asp">Türküler</a></td>
</tr>
<tr>
<td width="22" height="9"> </td>
<td align="left" width="100" height="9"><a href="galleri/resimler.asp">Resimler</a></td>
</tr>
<tr>
<td width="22" height="9"> </td>
<td align="left" width="100" height="9"><a href="defter.asp">Ziyaretci
Defteri</a></td>
</tr>
<tr>
<td width="22" height="18"> </td>
<td align="left" width="100" height="18"><a href="chat/default.asp">Chat</a></td>
</tr>
<tr>
<td width="22" height="9"> </td>
<td align="left" width="100" height="9"><a href="muzik.htm">Müzik</a></td>
</tr>
<tr>
<td colspan="2" height="4"> </td>
</tr>
<tr>
<td colspan="2" height="50"> </td>
</tr>
<tr>
<td colspan="2" height="3" align="center" valign="middle"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFF00">Toplam
ziyaretci sayisi
!</font></b></td>
</tr>
</table>
</td>
<td width="100%" align="center" valign="top" height="100%" bgcolor="ffffff">
<br>
<%
While ((Repeat1__numRows <> 0) AND (NOT gaestebog.EOF))
%>
<table width="350" border="0" cellspacing="0" cellpadding="0" height="45">
<tr>
<td class="border1" height="15" align="left" valign="middle"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000"><%=(gaestebog.Fields.Item("dato").Value)%></font></td>
</tr>
<tr>
<td class="border2" height="15" align="center" valign="middle"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000"><b><%=(gaestebog.Fields.Item("navn").Value)%></b></font></td>
</tr>
<tr>
<td class="border2" height="15" align="left" valign="middle"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000"><%=(gaestebog.Fields.Item("besked").Value)%></font></td>
</tr>
</table>
<br>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
gaestebog.MoveNext()
Wend
%>
<br>
<form name="form1" method="POST" action="<%=MM_editAction%>" onSubmit="MM_validateForm('navn','','R','besked','','R');return document.MM_returnValue">
<table width="350" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">Isim</font></td>
<td colspan="2"> <font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">
<input type="text" name="navn">
</font></td>
</tr>
<tr>
<td width="80"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">Mesaj</font></td>
<td colspan="2"> <font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">
<textarea name="besked" cols="30" rows="8"></textarea>
</font></td>
</tr>
<tr>
<td width="80" height="20"> <font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">
<input type="submit" name="Submit" value="Gönder">
</font></td>
<td height="20" width="8"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000"></font></td>
<td height="20" width="262"> <font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">
<input type="reset" name="Submit2" value="Sil">
</font></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="true">
</form>
</td>
</tr>
</table>
</body>
</html>
<%
gaestebog.Close()
%>