<%
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1  
Response.cachecontrol = "no-cache"  
%>
<!--#INCLUDE FILE="setup.asp" -->
<!--#include file=checkuser.asp-->
<title><%=SchoolmateName%>--管理页面</title>
<link href="css.asp" rel="stylesheet" type="text/css">
<!--#include file=theme.css-->
<body alink=#333333 vlink=#333333 link=#333333 topmargin=0 class=adminbody>
<%
if  not sysadmin or session("adminlogin")<>"0K" Then
	Errmsg=Errmsg+"<br>"+"<li>本页面为管理员专用，请<a href=superindex.asp target=_top>登陆</a>后进入。"
	Call Error("Information",ErrMsg)
Else
	Call main()
End if

Call endconnection()


Sub main()
%>
<table cellpadding=5 cellspacing=1 border=0 width=100% Class=TableBorder align=center>
<tr>
	<th>欢迎<b><%=membername%></b>进入管理页面</th>
</tr>
</table>

		<%
		if Request("action")="update" Then
			Call updatepara()
		Else
			Call paraform()
		End if
		
End Sub


Sub paraform()
%>

<table border=0 width=85% align=center><tr><td class=mp><BR><B><a name=top>说明</a></B>：<br>
(1)如果使用Jmail.Message发送邮件，服务器需要安装w3 JMail 4.3或以上版本，版本较低时可以使用Jmail.SmtpMail,如果smtp服务器需要发信验证，可以设置参数形如：<font color=brown>Account:Password@MailServer</font>。<br>
<BR><BR></td></tr></table>


<BR>
<script language=JavaScript src=script/jsfun.asp></script>
<form method="POST" action=sysadm_para.asp name=paraform>
<input type=hidden name=action value=update>
<table width=85% Class=TableBorder cellspacing=1  cellpadding=5 align=center>
<tr Class=LightTableBody><th colspan=2>同学录基本参数</th></tr>
<tr Class=LightTableBody>
<td width="35%">学校名称</td>
<td width="65%"> 
<input type="text" name="StrVar0" size="35" value="<%=StrVar(0)%>">
</td>
</tr>
<tr Class=LightTableBody>
<td width="35%">同学录系统名称</td>
<td width="65%"> 
<input type="text" name="StrVar1" size="35" value="<%=StrVar(1)%>">
</td>
</tr>
<tr Class=LightTableBody>
<td width="35%">系统服务邮件地址</td>
<td width="65%"> 
<input type="text" name="StrVar2" size="35" value="<%=StrVar(2)%>">
</td>
</tr>

<tr Class=LightTableBody>
<td width="35%">是否打开新用户注册功能</td>
<td width="65%"> 
<input type="checkbox" name="BoolVar0" value="1" <%if BoolVar(0)=True Then Response.Write "checked"%>>允许新用户注册
</td>
</tr>
<tr Class=LightTableBody>
<td width="35%">是否开启声效</td>
<td width="65%"> 
<input type="checkbox" name="BoolVar1" value="1" <%if BoolVar(1)=True Then Response.Write "checked"%>>开启系统声效
</td>
</tr>
<tr Class=LightTableBody><th colspan=2>班级相关参数</th></tr>
<tr Class=LightTableBody>
<td width="35%">是否允许用户创建新班级</td>
<td width="65%"> 
<input type="checkbox" name="BoolVar2" value="1" <%if BoolVar(2)=True Then Response.Write "checked"%>>允许创建新班级
</td>
</tr>
<tr Class=LightTableBody>
<td width="35%">每位注册用户最多加入班级数</td>
<td width="65%"> 
<input type="text" name="IntVar0" size="35" value="<%=IntVar(0)%>">&nbsp;(建议不要超过5个)
</td>
</tr>
<tr Class=LightTableBody>
<td width="35%">缺省班级开放等级</td>
<td width="65%">
<SELECT NAME="IntVar6">
<option value=0 <%if IntVar(6)=0 Then Response.Write "selected"%>>完全开放</option>
<!-- <option value=1 <%if IntVar(6)=1 Then Response.Write "selected"%>>密码验证</option> -->
<option value=2 <%if IntVar(6)=2 Then Response.Write "selected"%>>班长审核</option>
<!-- <option value=3 <%if IntVar(6)=3 Then Response.Write "selected"%>>锁定班级</option> -->
</SELECT>
</td>
</tr>
<tr Class=LightTableBody>
<td width="35%">班级名称限定词(请用"|"隔开)</td>
<td width="65%"> 
<input type="text" name="StrVar3" size="35" value="<%=StrVar(3)%>">&nbsp;若不使用，请保留空白
</td>
</tr>
<tr Class=LightTableBody><th colspan=2>邮件相关参数</th></tr>

<script language=javascript>
function relating(){
var cindex=document.paraform.IntVar5.selectedIndex;
if (cindex==0||cindex==3)
{server.style.display='none'}
else
{server.style.display=''}

if(cindex==1)
{account.style.display='';
pwd.style.display='';}
else
{account.style.display='none';
pwd.style.display='none'}

}
</script>
<tr Class=LightTableBody>
<td width="35%">发送邮件组件</td>
<td width="65%"> 
<Select name="IntVar5" onchange="relating()">
<option value="0" <%if IntVar(5)=0 Then%>selected<%End if%>>不支持 
<option value="4" <%if IntVar(5)=4 Then%>selected<%End if%>>JMAIL.Message 
<option value="1" <%if IntVar(5)=1 Then%>selected<%End if%>>JMAIL.SMTPMail 
<option value="2" <%if IntVar(5)=2 Then%>selected<%End if%>>CDONTS 
<option value="3" <%if IntVar(5)=3 Then%>selected<%End if%>>ASPEMAIL 
</Select>&nbsp;[<a style="cursor:help" href="javascript:openScript('help.asp?About=Object',455,230)">查看组件支持情况</a>]&nbsp;
</td></tr>

<tr Class=LightTableBody id="server" <%if IntVar(5)=0 or IntVar(5)=2 Then%>style="DISPLAY: none"<%End if%>>
<td width="35%">SMTP服务器地址</td>
<td width="65%"><input type="text" name="StrVar4" size="35" value="<%=StrVar(4)%>"></td>
</tr>

<tr Class=LightTableBody id="account" <%if IntVar(5)<>4 Then%>style="DISPLAY: none"<%End if%>>
<td width="35%">SMTP服务器登陆帐号</td>
<td width="65%"><input type="text" name="StrVar5" size="35" value="<%=StrVar(5)%>"></td>
</tr>

<tr Class=LightTableBody id="pwd" <%if IntVar(5)<>4 Then%>style="DISPLAY: none"<%End if%>>
<td width="35%">SMTP服务器登陆密码</td>
<td width="65%"><input type="text" name="StrVar6" size="35" value="<%=StrVar(6)%>"></td>
</tr>
<tr Class=LightTableBody>
<td width="35%">每次最多发送邮件数</td>
<td width="65%"><input type="text" name="IntVar7" size="35" value="<%=IntVar(7)%>">&nbsp;设为0时没有限制</td>
</tr>
<tr Class=LightTableBody>
<td width="35%">是否固定通知校友注册邮件内容</td>
<td width="65%"> 
<input type="checkbox" name="BoolVar8" value="1" <%if BoolVar(8)=True Then Response.Write "checked"%>>允许用户修改邮件内容</td>
</tr>
<tr Class=LightTableBody><th colspan=2>论坛、留言板相关参数</th></tr>
<tr Class=LightTableBody>
<td width="35%">允许的最大留言/帖子长度(KBytes)</td>
<td width="65%"><input type="text" name="IntVar1" size="35" value="<%=IntVar(1)%>"></td>
</tr>
<tr Class=LightTableBody>
<td width="35%">每页显示留言/帖子数</td>
<td width="65%"><input type="text" name="IntVar8" size="35" value="<%=IntVar(8)%>">&nbsp;(建议不要超过30)</td>
</tr>
<tr Class=LightTableBody>
<td width="35%">缺省签写留言/帖子模式</td>
<td width="65%"><INPUT TYPE="radio" NAME="BoolVar3" value=1 <%if BoolVar(3)=True Then Response.Write "checked"%>>高级模式&nbsp;&nbsp;<INPUT TYPE="radio" NAME="BoolVar3" value=0 <%if BoolVar(3)=false Then Response.Write "checked"%>>一般模式
</td>
</tr>

<tr Class=LightTableBody>
<td width="35%">是否开启UBB标签功能</td>
<td width="65%"> 
<input type="checkbox" name="BoolVar4" value="1" <%if BoolVar(4)=True Then Response.Write "checked"%>>允许使用UBB标签</td>
</tr>
<tr Class=LightTableBody>
<td width="35%">是否开启用户来源鉴定功能</td>
<td width="65%"> 
<input type="checkbox" name="BoolVar5" value="1" <%if BoolVar(5)=True Then Response.Write "checked"%>>显示用户来源&nbsp;(不推荐使用)

</td>
</tr>
<tr Class=LightTableBody>
<td width="35%">不良语句过滤(请用"|"隔开)</td>
<td width="65%"><input type="text" name="StrVar7" size="50" value="<%=StrVar(7)%>">&nbsp;若不使用，请保留空白</td>
</tr>
<tr Class=LightTableBody><th colspan=2>相册相关参数</th></tr>
<tr Class=LightTableBody>
<td width="35%">是否打开上传功能</td>
<td width="65%"> 
<input type="checkbox" name="BoolVar6" value="1" <%if BoolVar(6)=True Then Response.Write "checked"%>>允许用户上传图片
</td>
</tr>
<tr Class=LightTableBody>
<td width="35%">相片上传目录</td>
<td width="65%"><input type="text" name="StrVar8" size="35" value="<%=StrVar(8)%>"></td>
</tr>
<tr Class=LightTableBody>
<td width="35%">每次最多上传照片数</td>
<td width="65%"><input type="text" name="IntVar4" size="35" value="<%=IntVar(4)%>">&nbsp;设为0时没有限制</td>
</tr>
<tr Class=LightTableBody>
<td width="35%">最大上传图片大小(KBytes)</td>
<td width="65%"><input type="text" name="IntVar2" size="35" value="<%=IntVar(2)%>">&nbsp;设为0时没有限制</td>
</tr>
<tr Class=LightTableBody>
<td width="35%">班级相册大小(MBytes)</td>
<td width="65%"><input type="text" name="IntVar3" size="35" value="<%=IntVar(3)%>"></td>
</tr>
<tr Class=LightTableBody>
<td width="35%">是否使用照片审核功能</td>
<td width="65%"><input type="checkbox" name="BoolVar7" value="1" <%if BoolVar(7)=True Then Response.Write "checked"%>>启用照片审核&nbsp;(建议选中此项)</td>
</tr>
<tr Class=DarkTableBody> 
<td height="23" colspan="3" align=right >
<input type="submit" name="submit" value="修&nbsp;&nbsp;改" style="width:75px" class=button>
</td>
</tr>
</table>
</form>
<br>
<%
End Sub


Sub updatepara()
dim sql
dim BV,IV,SV

if Request("StrVar0")="" Then 
	ErrMsg = ErrMsg + "<br>" + "<li>请填学校名称！</li>"
	Founderr=True
End if

if trim(Request("StrVar1"))="" Then 
	ErrMsg = ErrMsg + "<br>" + "<li>请填同学录系统名称！</li>"
	Founderr=True
End if

if Request("StrVar2")="" Then 
	ErrMsg = ErrMsg + "<br>" + "<li>请填同学录系统服务邮件地址！</li>"
	Founderr=True
End if

if Request("IntVar0")="" or not isnumeric( Request("IntVar0"))Then 
	ErrMsg = ErrMsg + "<br>" + "<li>用户最多允许注册班级数输入错误！</li>"
	Founderr=True
End if


mailtype=Request("IntVar5")

if (mailtype<>0 and mailtype<>2) and Request("StrVar4")="" Then
	ErrMsg = ErrMsg + "<br>" + "<li>请填SMTP服务器地址！</li>"
	Founderr=True
End if

if Request("IntVar7")="" or not isnumeric(Request("IntVar7")) Then 
	ErrMsg = ErrMsg + "<br>" + "<li>每次最多发送邮件数输入有误！</li>"
	Founderr=True
End if

if Request("IntVar1")="" or not isnumeric(Request("IntVar1")) Then 
	ErrMsg = ErrMsg + "<br>" + "<li>最大留言/帖子长度输入有误！</li>"
	Founderr=True
End if

if Request("IntVar8")="" or not isnumeric(Request("IntVar8")) Then 
	ErrMsg = ErrMsg + "<br>" + "<li>每页显示留言/帖子数输入有误！</li>"
	Founderr=True
End if

if Request("StrVar8")="" Then 
	ErrMsg = ErrMsg + "<br>" + "<li>请输入上传图片目录！</li>"
	Founderr=True
End if

if Request("IntVar4")="" or not isnumeric(Request("IntVar4")) Then 
	ErrMsg = ErrMsg + "<br>" + "<li>每次最多上传图片数输入有误！</li>"
	Founderr=True
End if

if Request("IntVar2")="" or not isnumeric(Request("IntVar2")) Then 
	ErrMsg = ErrMsg + "<br>" + "<li>最大上传图片大小输入有误！</li>"
	Founderr=True
End if

if Request("IntVar3")="" or not isnumeric(Request("IntVar3")) Then 
	ErrMsg = ErrMsg + "<br>" + "<li>班级相册容量输入有误！</li>"
	Founderr=True
End if

if founderr=True Then
	Response.Write ErrMsg
	Exit Sub
End if


BV=""
for i=0 to 9 
	if request("BoolVar"&i)="1" then
		BV=BV&"1"
	else
		BV=BV&"0"
	end if
next

IV=""
for i=0 to 8
	IV=IV&trim(request("IntVar"&i))&","
next

SV=""
for i=0 to 8
	SV=SV&trim(request("StrVar"&i))&vbCr
next


sql="update config set BoolVar='"&BV&"',IntVar='"&IV&"',StrVar='"&SV&"'"

conn.execute(sql)

%>
<BR><BR><center>更新同学录参数成功！</center>
<%
End Sub
%>



