/asp/freeapps/topsitementor/admin_edac.asp
<!--#include file="inctopsite.asp"-->
<!--#include file="include_menu.inc"-->
<%
''''''''''' (C) Stefan Holmberg 1999
''''''''''' Free to use if these sourcecode lines is not deleted
''''''''''' Contact me at webmaster@sqlexperts.com
''''''''''' http://www.sqlexperts.com
''''''''''' AdMentor homepage at http://www.create-a-webshop.com
If Session("ts_admin") <> "1" Then
Response.Redirect "includeloginuser.asp"
Response.Flush
Response.End
End If
'''Globals
Dim sUID, sURL, sSiteName, sSiteDescr, sCatId, sEmailAddress
sUID = Request("id")
Call Main()
'Tries to save ( update/addnew ). Returns error string
Function TrySave( oConn )
'
' Now
Dim oRS
Set oRS = Server.CreateObject("ADODB.Recordset")
Set oRS.ActiveConnection = oConn
'Try to open it...
sURL = Request.Form("url")
sSiteName = Request.Form("sitename")
sSiteDescr = Left(Request.Form("SiteDescr"),255)
sCatId = Request.Form("Cat")
sEmailAddress = Request.Form("emailaddress")
oRS.Open "select * from " & IncTopsite_GetTablePrefix() & "site where id = " & sUID, ,1,3
'Now, make sure new passwords are correct
If Request.Form("pwdnew") <> Request.Form("pwdnew2") Then
TrySave = "PasswordError"
oRS.Close
Set oRS = Nothing
Exit Function
End If
If Request.Form("pwdnew") <> "" AND Len(Request.Form("pwdnew")) < 5 Then
TrySave = "PasswordError2"
oRS.Close
Set oRS = Nothing
Exit Function
End If
oRS("catid") = sCatid
oRS("sitedescr") = sSiteDescr
oRS("sitename") = sSiteName
oRS("url") = sURL
If Request.Form("pwdnew") <> "" Then
oRS("password") = Request.Form("pwdnew")
End If
oRS("email") = sEmailAddress
oRS.Update
oRS.Close
Set oRS = Nothing
End Function
Dim oConn, oMyRS, sError
Sub Main()
Set oConn = IncTopsite_GetDatabaseConn()
If Request.QueryString("save")= "yes" Then 'Yes we are saving...
sError = TrySave( oConn )
Else
'
Set oMyRS = oConn.Execute( "select * from " & IncTopsite_GetTablePrefix() & "site where id = " & sUID )
sUID = oMyRS("id").Value
sURL = oMyRS("url").Value
sSiteName = oMyRS("sitename").Value
sSiteDescr = oMyRS("SiteDescr").Value
sCatId = oMyRS("CatId").Value
sEmailAddress = oMyRS("email").Value
oMyRS.Close
End If
' oMyRS.Close
Set oMyRS = Nothing
End Sub
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Account management</title>
<style type="text/css">
<!--
body { font-family: Arial, Geneva, Helvetica, Verdana; font-size: smaller; color: #000000}
td { font-family: Arial, Geneva, Helvetica, Verdana; font-size: smaller; color: #000000}
th { font-family: Arial, Geneva, Helvetica, Verdana; font-size: smaller; color: #000000}
A:link {text-decoration: none;}
A:visited {text-decoration: none;}
A:hover {text-decoration: underline;}
-->
</style>
</head>
<body>
<table align="center" bgColor="#ECECD9" border="0" cellPadding="3" cellSpacing="0" height="100%" width="100%">
<tbody>
<tr>
<td vAlign="top" width="50%" height="60">
<h1>TopSiteMentor</h1>
</td>
<td vAlign="top" width="468" height="60">
<b><font face="verdana,arial,helvetica" size="+2">Administration
</font></b>
</td>
</tr>
<tr>
<td height="100%" vAlign="top" width="100%" colspan="2">
<table align="center" bgColor="#ffffff" border="0" cellPadding="0" cellSpacing="0" height="100%" width="100%">
<tbody>
<tr>
<td height="100%" vAlign="top" width="85%">
<table bgColor="#ffffff" border="0" cellPadding="10" cellSpacing="0" height="100%" width="100%">
<tbody>
<tr>
<td align="left" height="100%" vAlign="top" width="65%">
<table border="0" width="100%">
<tr>
<td width="50%">
<font color="#aa3333" face="verdana,arial,helvetica" size="+2"><b>Account
management </b></font>
</td>
<td width="50%"><%=FAQ_GetAd(1)%>
</td>
</tr>
</table>
<hr color="#000066" noShade SIZE="1">
<table border="0">
<tr>
<td width="160" valign="top"><%AdAdminWriteMenu%></td>
<td width="398">
<form method="POST" action="admin_edac.asp?Save=yes&id=<%=sUID%>">
<table border="0" width="100%">
<% If sError = "" And Request.QueryString("save") = "yes" Then %>
<tr>
<td width="22%"></td>
<td width="78%"><font color="#008000" size="1">Changes saved OK</font></td>
</tr>
<% End If %>
<tr>
<td width="22%"><b>Site name:</b></td>
<td width="78%"><input type="text" name="sitename" size="37" value="<%=ssitename%>" ></td>
</tr>
<tr>
<td width="22%"><b>Site url</b>:</td>
<td width="78%"><input type="text" name="url" size="37" value="<%=surl%>" ></td>
</tr>
<tr>
<td width="22%"><b>Site description:</b></td>
<td width="78%"><textarea rows="3" name="sitedescr" cols="32"><%=sSiteDescr%></textarea></td>
</tr>
<tr>
<td width="22%"><b>Category:</b></td>
<td width="78%"><select size="1" name="cat">
<% ListCategories sCatId, False %>
</select></td>
</tr>
<% If sError = "PasswordError" And Request.QueryString("save") = "yes" Then %>
<tr>
<td width="22%"></td>
<td width="78%"><font size="1" color="#FF0000">Password
and password again not identical</font> </td>
</tr>
<% End If%>
<% If sError = "PasswordError2" And Request.QueryString("save") = "yes" Then %>
<tr>
<td width="22%"></td>
<td width="78%"><font size="1" color="#FF0000">Use at least 5 characters in password</font> </td>
</tr>
<% End If%>
<tr>
<td width="22%"><b>New password</b>:</td>
<td width="78%"><input type="password" name="pwdnew" size="15">
<font size="1">(Leave empty if you want to
keep your old password )</font></td>
</tr>
<tr>
<td width="22%"><b>New password again</b>:</td>
<td width="78%"><input type="password" name="pwdnew2" size="15"><font size="1">(Leave
empty if you want to keep your old
password )</font></td>
</tr>
<tr>
<td width="22%"><b>Email address:</b></td>
<td width="78%"><input type="text"