db="bchat.mdb"
connStr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath(db)
'如果你的服务器采用较老版本Access驱动,请用下面连接方法
'connStr="driver={Microsoft Access Driver (*.mdb)};dbq="&Server.MapPath(db)
Set conn=Server.CreateObject("ADODB.Connection"
conn.Open connStr
Set rs=Server.CreateObject("ADODB.RecordSet"
serverIP=Request.ServerVariables("LOCAL_ADDR"
sql="SELECT * FROM room ORDER BY bPort"
rs.Open sql,conn,1,1
If rs.EOF Then
rs.Close
Set rs=Nothing
conn.Close
Set conn=Nothing
Response.Write "数据库中还没有记录呢!"
Response.End
End If
If Application("Bchat_Status"<>"running" Then
Call StartBchat()
rs.MoveFirst
End If
%>
<html>
<head>
<title>语音聊天室</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<s cript language="javas cript">
var wwwhost="<%=Request.ServerVariables("SERVER_NAME"%>";
function go(pport){
if(validname(document.form1.elements[0])){
document['form1'].action='http://'+wwwhost+':'+pport+'/';
launchchat();
document['form1'].method='post';
document.form1.submit();
}
}
function validname(str1)
{
var s,i,j;
if (str1.value.length <1) {
alert("请输入您的大名,名字不能为空!"
str1.focus();
return false;
}
return true;
}
var focusok=false;
if (navigator.appName == "Netscape" {
focusok=true;
}
vers = navigator.appVersion;
if (navigator.appName == "Microsoft Internet Explorer" {
pos = vers.lastIndexOf('.');
vers = vers.substring(pos-1,vers.length);
}
proper_version = parseFloat(vers);
Do While Not rs.EOF
targetFile=currentPath&"\"&rs("bPort")&".ini"
Set f1=Server.CreateObject("ADODB.Stream")
f1.Type=2
f1.Mode=3
f1.Charset="gb2312"
f1.Open
f1.LoadFromFile sourceFile
tempString=f1.ReadText
f1.Close
Set f1=Nothing
tempString=Replace(tempString,"聊圆",rs("bName"))
tempString=Replace(tempString,"D:\BChat",currentPath)
tempString=Replace(tempString,"2000",rs("bPort"))
tempString=Replace(tempString,"0.0.0.0",serverIP)
Set f2=Server.CreateObject("ADODB.Stream")
f2.Type=2
f2.Mode=3
f2.Charset="gb2312"
f2.Open
f2.WriteText tempString
f2.SaveToFile targetFile,2
f2.Close
Set f2=Nothing
Set f1=Server.CreateObject("ADODB.Stream")
f1.Type=2
f1.Mode=3
f1.Charset="gb2312"
f1.Open
f1.LoadFromFile currentPath&"\adminpass_2000.txt"
tempString=f1.ReadText
f1.Close
Set f1=Nothing
Set f2=Server.CreateObject("ADODB.Stream")
f2.Type=2
f2.Mode=3
f2.Charset="gb2312"
f2.Open
f2.WriteText tempString
f2.SaveToFile currentPath&"\adminpass_"&rs("bPort")&".txt",2
f2.Close
Set f2=Nothing
tempCommand=currentPath&"\bchat.exe "&targetFile
Set wsh=Server.CreateObject("Ws cript.Shell")
wsh.Run tempCommand,0,false
Set wsh=Nothing
rs.MoveNext
Loop
Application("Bchat_Status")="running"
End Sub