<%
If Request.querystring("mode") = "updatedb" then
strUserName = Session("userName")
strHeading = Request.Form("txtHeading")
strContent = Request.Form("FCKeditor1")
strID = Clng(Request.Form("txtID"))
numStatus = Request.Form("numStatus")
strHeading = fieldReplace(strHeading)
strContent = fieldReplace(strContent)
numCategory = Request.Form("numCategory")
strSQL = "UPDATE tblnews SET tblnews.heading='" & strHeading & "',tblnews.content='" & strContent & "',tblnews.postedby='" & strUserName & "', tblnews.status='" & numStatus & "',tblnews.Timestamp='" & date() & "', tblnews.category='" & numCategory &"' WHERE ID =" & strID
adoCon.Execute(strSQL)
Set adoCon = Nothing
Response.Redirect"news.asp?mode=listnews"
End If
%>
<%
If Request.querystring("mode") = "view" then
userAdmin = Session("userAdmin")
Set rsSettings = Server.CreateObject("ADODB.Recordset")
strSettingsSQL = "SELECT shownum,contentbgcolor,infobgcolor,infotextcolor,bordercolor,headbgcolor FROM tblsettings"
rsSettings.Open strSettingsSQL, adoCon
Set rsViewNews = Server.CreateObject("ADODB.Recordset")
strViewSQL = "SELECT TOP " & rsSettings("shownum") & " heading, [ID], [Timestamp], postedby, content FROM tblnews WHERE status = 1 ORDER BY [ID] DESC"
rsViewNews.Open strViewSQL, adoCon
%>
<%
Do While NOT rsViewNews.EOF
%>
<center><table border='1' width='90%' bordercolor=<%=rsSettings("bordercolor")%> style='border-collapse:collapse;'><tr><td width='100%' colspan='2' bgColor=<%=rsSettings("headbgcolor")%> style='font-family:verdana;font-weight:bold;font-size:8pt;'><img border='0' src='images/postin.gif'>
<%Response.Write (rsViewNews("heading"))%>
</td></tr><tr><td width='100%' colspan='2' style='font-family:verdana;font-size:8pt;' bgColor=<%=rsSettings("contentbgcolor")%>>
<%Response.Write (rsViewNews("content"))%>
</td></tr><tr><td width='50%' style='font-family:verdana;font-size:7pt;' bgColor=<%=rsSettings("infobgcolor")%>><font color=<%=rsSettings("infotextcolor")%>>
<%Response.Write (rsViewNews("timestamp"))%>
</font></td><td width='50%' style='font-family:verdana;font-size:7pt;' align='right' bgColor=<%=rsSettings("infobgcolor")%>><font color=<%=rsSettings("infotextcolor")%>>Posted by
<%Response.Write (rsViewNews("postedby"))%>
<img src='images/user.gif'></font></td></tr></table></center><p>
<%
rsViewNews.MoveNext
Loop
Set rsViewNews = Nothing
Set rsSettings = Nothing
Set adoCon = Nothing
End If
%>
<%
If Request.querystring("mode") = "add" then
strUserName = Replace(Request.Form("txtUserName"), "'", "''")
strPassword = Replace(Request.Form("txtPassword"), "'", "''")
strEmail = Request.Form("txtEmail")
strEPassword = md5(strPassword)
strUserName = fieldReplace(strUserName)
strSQL = "INSERT INTO tblusers ([username],[password],[Timestamp],email) VALUES('" & strUserName & "', '" & strEPassword & "', '" & date() & "', '" & strEmail & "')"
strSQLCheck = "SELECT username from tblusers where username = '" & strUserName & "'"
Set rsAdminCheck = adoCon.Execute(strSQLCheck)
If Not rsAdminCheck.EOF then
Response.Redirect"news.asp?mode=addusertaken"
Set rsAdminCheck = Nothing
Set adoCon = Nothing
End If
Response.Write strSQL
adoCon.execute (strSQL)
Set adoCon = Nothing
Response.Redirect"news.asp?mode=listusers"
End If
%>
<%
If Request.querystring("mode") = "adduser" then
%>
<%
Response.Write ("<form name='User' method='post' action='news.asp?mode=add' onSubmit='return invalid();'>")
Response.Write ("<br>")
Response.Write ("<table><tr><td><b>UserName:</b> </td><td><input type='text' name='txtUserName' value='UserName'></td></tr>")
Response.Write ("<tr><td><b>Password:</b> </td><td><input type='password' name='txtPassword'</td></tr>")
Response.Write ("<tr><td><b>Confirm Password:</b> </td><td><input type='password' name='txtPassword2'</td></tr>")
Response.Write ("<tr><td><b>Email Address:</b> </td><td><input type='text' name='txtEmail'</td></tr>")
Response.Write ("<tr><td><input type='image' src='images/submit.jpg' name='Submit' value='Enter' alt='Enter'>")
Response.Write ("</td></tr></table></form>")
Response.Write ("<FORM><INPUT type=image src=images/back.gif value='Back' onClick='parent.history.back(); return false;'></FORM>")
End If
%>
<%
If Request.querystring("mode") = "addusertaken" then
%>
<%
Response.Write ("<font color='red'>Username is already in use.</font><br><br>")
Response.Write ("<form name='User' method='post' action='news.asp?mode=add' onSubmit='return invalid();'>")
Response.Write ("<br>")
Response.Write ("<table><tr><td><b>UserName:</b> </td><td><input type='text' name='txtUserName' value='UserName'></td></tr>")
Response.Write ("<tr><td><b>Password:</b> </td><td><input type='password' name='txtPassword'</td></tr>")
Response.Write ("<tr><td><b>Confirm Password:</b> </td><td><input type='password' name='txtPassword2'</td></tr>")
Response.Write ("<tr><td><input type='image' src='images/submit.jpg' name='Submit' value='Enter' alt='Enter'>")
Response.Write ("</td></tr></table></form>")
Response.Write ("<FORM><INPUT type=image src=images/back.gif value='Back' onClick='parent.history.back(); return false;'></FORM>")
End If
%>
<%
If Request.querystring("mode") = "listusers" then
Set rsUserAdmin = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT username, ID FROM tblusers ORDER BY username"
rsUserAdmin.Open strSQL, adoCon
%>
<%
Response.Write ("<table><tr><td><b><center>UserName</center></b></td><td><b><center>Delete User</center></b></td><td><b><center>Change Password</center></b></td></tr>")
strBGColor = "#EEEEEE"
Do While NOT rsUserAdmin.EOF
if strBGColor = "#EEEEEE" Then strBGColor = "#D7D7D7" Else strBGColor = "#EEEEEE" %>
<tr bgcolor="<%= Cstr(strBGColor) %>"><td><center>
<%
Response.Write (rsUserAdmin("username"))
Response.Write ("</center></td><td><center><a href=news.asp?mode=deleteuser&ID=")
Response.Write (rsUserAdmin("ID"))
Response.Write ("><img src='images/cancel.gif' border='0' Alt='Delete User'></a></center></td>")
Response.Write ("<td><center><a href=news.asp?mode=change&ID=")
Response.Write (rsUserAdmin("ID"))
Response.Write ("><img src='images/security.gif' border='0' Alt='Change Password'></a></center></td></tr>")
rsUserAdmin.MoveNext
Loop
Response.Write ("</table>")
Set rsUSerAdmin = Nothing
Set adoCon = Nothing
End If
%>
<%
If Request.querystring("mode") = "delete" then
numID = Clng(Request.querystring("ID"))
strSQL = "DELETE FROM tblnews WHERE ID =" & numID
adoCon.execute (strSQL)
Set adoCon = Nothing
Response.Redirect"news.asp?mode=listnews"
End If
If Request.querystring("mode") = "deleteuser" then
userID = Clng(Request.querystring("ID"))
strSQL = "DELETE FROM tblusers WHERE ID =" & userID
adoCon.execute (strSQL)
Set adoCon = Nothing
Response.Redirect"news.asp?mode=listusers"
End If
%>
<%
If Request.querystring("mode") = "change" then
%>
<%
userID = Request.querystring("ID")
Response.Write ("<form name='User' method='post' action='news.asp?mode=changepassword' onSubmit='return invalid();'>")
Response.Write ("<br><b>Change Password</b><br><br>")
Response.Write ("<input type='Password' name='txtPassword'><br>")
Response.Write ("<input type='Password' name='txtPassword2'><br>")
Response.Write ("<input type=hidden value='" & userID & "' name='txtID'><br><br><br>")
Response.Write ("<input type='image' src='images/submit.jpg' name='Submit' value='Enter' alt='Enter'>")
Response.Write ("</form>")
Response.Write ("<FORM><INPUT type=image src=images/back.gif value='Back' onClick='parent.history.back(); return false;'></FORM>")
End If
%>
<%
If Request.querystring("mode") = "changepassword" then
strUserID = Clng(Request.Form("txtID"))
strPassword = Replace(Request.Form("txtPassword"), "'", "''")
strEPassword = md5(strPassword)
strSQL = "UPDATE tblusers SET tblusers.password='" & strEPassword & "' WHERE ID =" & strUserID
adoCon.execute (strSQL)
Set adoCon = Nothing
Response.Redirect"news.asp?mode=listusers"
End If
%>
<%
If Request.querystring("mode") = "settings" then
%>
<script language=JavaScript src="colorpicker/picker.js" ></script>
<%
Set rsSettings = Server.CreateObject("ADODB.Recordset")
strSettingsSQL = "SELECT shownum,contentbgcolor,infobgcolor,infotextcolor,bordercolor,headbgcolor,sitetitle,sitelink,sitedesc,siteemail,emailserver,comments,tellafriend FROM tblsettings"
rsSettings.Open strSettingsSQL, adoCon
Response.Write ("<form name='Settings' method='post' action='news.asp?mode=settingsdb'>")
Response.Write ("<b>News Display Settings</b><br><br>")
Response.Write ("<table><tr><td># of News Entries to Show</td>")
Response.Write ("<td><select name='txtShowNum' size='1'>")
count = 0
Do While count < 100
if rsSettings("shownum") = count then
Response.Write ("<option value=" & count & " SELECTED>" & count & "</option>")
else
Response.Write ("<option value=" & count & ">" & count & "</option>")
end if
count = count +1
Loop
Response.Write ("</td></tr>")
Response.Write ("<tr><td>Border Color</td><td><input type='text' name='txtBorderColor' value=")
Response.Write (rsSettings("bordercolor"))
Response.Write ("> <a href='javascript:TCP.popup(document.Settings.txtBorderColor,1)'><img src='colorpicker/img/sel.gif' border='0' alt='Pick Color'></a></td></tr>")
Response.Write ("<tr><td>Header Background Color</td><td><input type='text' name='txtHeaderBgColor' value=")
Response.Write (rsSettings("headbgcolor"))
Response.Write ("> <a href='javascript:TCP.popup(document.Settings.txtHeaderBgColor,1)'><img src='colorpicker/img/sel.gif' border='0' alt='Pick Color'></a></td></tr>")
Response.Write ("<tr><td>Content Background Color</td><td><input type='text' name='txtContentBgColor' value=")
Response.Write (rsSettings("contentbgcolor"))
Response.Write ("> <a href='javascript:TCP.popup(document.Settings.txtContentBgColor,1)'><img src='colorpicker/img/sel.gif' border='0' alt='Pick Color'></a></td></tr>")
Response.Write ("<tr><td>News Information Background Color</td><td><input type='text' name='txtInfoBgColor' value=")
Response.Write (rsSettings("infobgcolor"))
Response.Write ("> <a href='javascript:TCP.popup(document.Settings.txtInfoBgColor,1)'><img src='colorpicker/img/sel.gif' border='0' alt='Pick Color'></a></td></tr>")
Response.Write ("<tr><td>News Information Color</td><td><input type='text' name='txtInfoTextColor' value=")
Response.Write (rsSettings("infotextcolor"))
Response.Write ("> <a href='javascript:TCP.popup(document.Settings.txtInfoTextColor,1)'><img src='colorpicker/img/sel.gif' border='0' alt='Pick Color'></a></td></tr>")
Response.Write ("<tr><td>Site Install Link</td><td><input type='text' name='txtLink' value=")
Response.Write (rsSettings("sitelink"))
Response.Write ("></td></tr>")
Response.Write ("<tr><td>RSS Title</td><td><input type='text' name='txtTitle' value='")
Response.Write (rsSettings("sitetitle"))
Response.Write ("'></td></tr>")
Response.Write ("<tr><td>RSS Description</td><td><textarea name='txtDesc' cols='40' rows='6'>")
Response.Write (rsSettings("sitedesc"))
Response.Write ("</textarea></td></tr>")
Response.Write ("<tr><td>Site Email Address</td><td><input type='text' name='txtEmailAdd' value=")
Response.Write (rsSettings("siteemail"))
Response.Write ("></td></tr>")
Response.Write ("<tr><td>Email Server</td><td><input type='text' name='txtEmailServer' value=")
Response.Write (rsSettings("emailserver"))
Response.Write ("></td></tr>")
Response.Write ("<tr><td>Allow Users to add comments</td><td>")
If rsSettings("comments") = 1 then
Response.Write ("<input type='radio' name='numComments' value='1' checked> On <input type='radio' name='numComments' value='0' > Off</td></tr>")
Else
Response.Write ("<input type='radio' name='numComments' value='1' > On <input type='radio' name='numComments' value='0' checked> Off </td></tr>")
End If
Response.Write ("<tr><td>Allow Users to Tell a Friend</td><td>")
If rsSettings("tellafriend") = 1 then
Response.Write ("<input type='radio' name='numTellAFriend' value='1' checked> On <input type='radio' name='numTellAFriend' value='0'> Off </td></tr>")
Else
Response.Write ("<input type='radio' name='numTellAFriend' value='1'>On <input type='radio' name='numTellAFriend' value='0' checked> Off </td></tr>")
End If
Response.Write ("</table>")
Response.Write ("<input type='image' src='images/submit.jpg' name='Submit' value='Enter' alt='Enter'>")
Response.Write ("</form>")
Response.Write ("<FORM><INPUT type=image src=images/back.gif value='Back' onClick='parent.history.back(); return false;'></FORM>")
Set rsSettings = Nothing
Set adoCon = Nothing
End If
%>
<%
If Request.querystring("mode") = "settingsdb" then
Set rsSettings = Server.CreateObject("ADODB.Recordset")
strShowNum = Request.Form("txtShowNum")
strHeaderBgColor = Request.Form("txtHeaderBgColor")
strContentBgColor = Request.Form("txtContentBgColor")
strBorderColor = Request.Form("txtBorderColor")
strInfoBgColor = Request.Form("txtInfoBgColor")
strInfoTextColor = Request.Form("txtInfoTextColor")
strTitle = fieldReplace(Request.Form("txtTitle"))
strLink = Request.Form("txtLink")
strDesc = fieldReplace(Request.Form("txtDesc"))
strEmailAdd = Request.Form("txtEmailAdd")
strEmailServer = Request.Form("txtEmailServer")
CommentsNum = Request.Form("numComments")
TellAFriendNum = Request.Form("numTellAFriend")
strSQL = "UPDATE tblsettings SET tblsettings.shownum='" & strShowNum & "', tblsettings.headbgcolor='" & strHeaderBgColor & "',tblsettings.contentbgcolor='" & strContentBgColor & "',tblsettings.bordercolor='" & strBorderColor & "',tblsettings.infobgcolor='" & strInfoBgColor & "',tblsettings.infotextcolor='" & strInfoTextColor & "', tblsettings.sitetitle='" & strTitle & "', tblsettings.sitelink='" & strLink & "', tblsettings.sitedesc='" & strDesc & "', tblsettings.siteemail='" & strEmailAdd & "', tblsettings.emailserver='" & strEmailServer & "', tblsettings.comments='" & CommentsNum & "', tblsettings.tellafriend='" & TellAFriendNum & "'"
rsSettings.Open strSQL, adoCon
Set rsSettings = Nothing
Set adoCon = Nothing
Response.Redirect"news.asp?mode=settings"
End If
........ resten är bara "katalogsaker" som har samma problem. de tar inte med å ä ö heller.