本帖最后由 republican 于 2010-11-7 20:15 编辑
回复 5# pusofalse
P大想要开源哪些内容?
整个程序有95%的代码与本主题无关,主文件代码也达到了6000行,编译需要用的文件超过25个,所以不太现实。
如果单单要本贴功能,可以直接使用参考链接的代码,其实代码没什么就改,基本原封不动的copy来,只是把网页的指向改为程序生成。
附网页生成需要用到的过程(当然不能直接运行!):
Func _GetPage($Name,$Extr = "")
Local $PageContext
Switch $Name
Case $RT_err_auth
$PageContext = $Rt_MainPage[1] & $Rt_MainPage[8] & $Rt_MainPage[2] & $Rt_MainPage[3]
Case "index.html"
$PageContext = $Rt_MainPage[1] & $Rt_MainPage[5] & $Rt_MainPage[2] & _Rt_GetNow_User() &'</p>' & $Rt_MainPage[3]
Case "User.html"
Local $MoreText = ""
If IsArray($Extr) Then $MoreText ='已用流量: '&Round(Int($Extr[0]/(1024*1024)),1) & " MB"&' / 日总流量: '&Round(Int($Extr[1]/(1024*1024)),1) & " MB"
_WriteCMD($MoreText)
_INIPageVar()
$PageContext = $Rt_MainPage[1] & $Rt_MainPage[7] & $Rt_MainPage[2] & _Rt_GetNow_User() &'</p>'& $MoreText & $Rt_MainPage[3]
Case "Program.html"
_INIPageVar()
$PageContext = $Rt_MainPage[1] & $Rt_MainPage[6] & $Rt_MainPage[2] & _Rt_GetNow_User() &'</p>'& $Rt_MainPage[3]
Case $RT_err_404,$RT_err_dirlist
$PageContext = $Rt_MainPage[1] & $Rt_MainPage[9] & $Rt_MainPage[2] & $Rt_MainPage[3]
EndSwitch
Return $PageContext
EndFunc
Func _Rt_GetNow_User()
Switch $GlobalTemp[11]
Case 0
Return '<p>当前未有登录用户</p>'
Case 1
Return '<p>当前登录用户: '&$GlobalTemp[17]
EndSwitch
EndFunc
Func _RT_ValueToString($Index)
If $GlobalINI[$Index][1] = 1 Then Return 'checked'
EndFunc
Func _INIPageVar()
$Rt_MainPage[1]='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">' & _
'<html>' & _
'<head>' & _
'<meta http-equiv="Content-Type" content="text/html; charset=GB2312">' & _
'<!-- TemplateBeginEditable name="doctitle" -->' & _
'<title>STU FUSION 远程管理</title>' & _
'<!-- TemplateEndEditable -->' & _
'<!-- TemplateBeginEditable name="head" -->' & _
'<!-- TemplateEndEditable -->' & _
'<style type="text/css">' & _
'<!--' & _
'body {' & _
' font: 100% 宋体, 新宋体;' & _
' background: #666666;' & _
' margin: 0;' & _
' padding: 0;' & _
' text-align: center;' & _
' color: #000000;' & _
'}' & _
'' & _
'.oneColElsCtrHdr #container {' & _
' width: 46em;' & _
' background: #FFFFFF;' & _
' margin: 0 auto;' & _
' border: 1px solid #000000;' & _
' text-align: left; ' & _
'}' & _
'.oneColElsCtrHdr #header { ' & _
' background: #DDDDDD; ' & _
' padding: 0 10px 0 20px;' & _
'} ' & _
'.oneColElsCtrHdr #header h1 {' & _
' margin: 0;' & _
' padding: 10px 0;' & _
'}' & _
'.oneColElsCtrHdr #mainContent {' & _
' padding: 0 20px; ' & _
' background: #FFFFFF;' & _
'}' & _
'.oneColElsCtrHdr #footer { ' & _
' padding: 0 10px; ' & _
' background:#DDDDDD;' & _
'} ' & _
'.oneColElsCtrHdr #footer p {' & _
' margin: 0; ' & _
' padding: 10px 0; ' & _
'}' & _
'.oneColElsCtrHdr #container #mainContent form table tr th {' & _
' color: #426EB4;' & _
' font-family: "宋体";' & _
' font-size: 16px;' & _
'}' & _
'.sf {' & _
' font-family: "宋体";' & _
' font-size: 16px;' & _
' font-style: normal;' & _
' line-height: normal;' & _
'}' & _
'.oneColElsCtrHdr #container #mainContent form table tr .sf .sf {' & _
' font-size: 14px;' & _
' color: #000;' & _
'}' & _
'.Main {' & _
' font-family: "宋体";' & _
' font-size: 36px;' & _
' font-style: normal;' & _
' color: #03F;' & _
' font-weight: bold;' & _
' text-align: center;' & _
'}' & _
'-->' & _
'</style></head>' & _
'' & _
'' & _
'<body class="oneColElsCtrHdr">' & _
'' & _
'<div id="container">' & _
' <div id="header">' & _
'<h1>STU FUSION 远程管理</h1>' & _
'<!-- end #header --></div>'
$Rt_MainPage[4]=' <div id="mainContent">' & _
' <h1> </h1>' & _
' <!-- end #mainContent --></div>'
$Rt_MainPage[9] = '<div id="mainContent">' & _
'<h1>404 错误</h1>' & _
'<p>请求的页面不存在</p>' & _
'</div>'
$Rt_MainPage[2]=' <div id="footer">'
;~ '<p>当前登录用户: 08ymsu</p>' & _
$Rt_MainPage[3] = '<p>Copyright© Republican <a href="/">返回首页</a> </p>' & _
' <!-- end #footer --></div>' & _
'<!-- end #container --></div>' & _
'' & _
'</html>'
$Rt_MainPage[5]=' <div id="mainContent">' & _
' <table width="683" height="80" border="0">' & _
' <tr>' & _
' <th width="336" height="43" class="Main" scope="row"><a href="User.html">用户设置</a></th>' & _
' <td width="337" class="Main"><a href="Program.html">程序设置</a></td>' & _
' </tr>' & _
' </table>' & _
' <!-- end #mainContent -->' & _
' </div>'
$Rt_MainPage[6]=' <div id="mainContent">' & _
'<form name="form1" method="post" action="">' & _
' <table width="601" border="0">' & _
' <tr>' & _
' <th width="178" class="sf" scope="row"><span class="set">[1]始终在线模式</span></th>' & _
' <td width="53" align="center"><label>' & _
' <input name="Ck1" type="checkbox" id="Ck1" '&_RT_ValueToString(2)&'>' & _
' </label></td>' & _
' <td width="163" align="right" class="set">在线命令发送间隔</td>' & _
' <td width="179" align="left"><label>' & _
' <input name="tx1" type="text" id="tx1" value="'&$GlobalINI[13][1]&'">' & _
' </label></td>' & _
' </tr>' & _
' <tr>' & _
' <th scope="row"><span class="set">[2]自动注销</span></th>' & _
' <td align="center"><label>' & _
' <input name="ck2" type="checkbox" id="ck2" '&_RT_ValueToString(1)&'>' & _
' </label></td>' & _
' <td align="right" class="set">注销流量</td>' & _
' <td align="left"><label>' & _
' <input name="tx2" type="text" id="tx2" value="'&$GlobalINI[6][1]&'">' & _
' </label></td>' & _
' </tr>' & _
' <tr>' & _
' <th height="28" class="set" scope="row"><span class="set">[3]连接外网</span></th>' & _
' <td align="center"><label>' & _
' <input name="ck3" type="checkbox" id="ck3" '&_RT_ValueToString(25)&'>' & _
' </label></td>' & _
' <td align="right" class="set">网络超时</td>' & _
' <td align="left"><label>' & _
' <input name="tx3" type="text" id="tx3" value="'&$GlobalINI[11][1]&'">' & _
' </label></td>' & _
' </tr>' & _
' <tr>' & _
' <th class="set" scope="row"><span class="set">[4]定时关机</span></th>' & _
' <td align="center"><label>' & _
' <input name="ck4" type="checkbox" id="ck4" '&_RT_ValueToString(22)&'>' & _
' </label></td>' & _
' <td align="right" class="set">关机时间</td>' & _
' <td align="left"><label>' & _
' <input name="tx4" type="text" id="tx4" value="'&$GlobalINI[23][1]&'">' & _
' </label></td>' & _
' </tr>' & _
' <tr>' & _
' <th colspan="2" align="right" scope="row"><label>' & _
' <input type="submit" name="sub" id="sub" value="提交"> ' & _
' </label></th>' & _
' <td colspan="2" align="right"><label>' & _
' <input type="reset" name="rs" id="rs" value="重置">' & _
' </label></td>' & _
' </tr>' & _
' </table>' & _
'' & _
'</form>' & _
' </div>'
$Rt_MainPage[7]=' <div id="mainContent">' & _
'<form name="form1" method="post" action="">' & _
' <table width="690" height="124" border="0">' & _
' <tr>' & _
' <th width="160" class="oneColElsCtrHdr" scope="row">用户名:</th>' & _
' <td width="168" align="left"><label>' & _
' <select name="Dft0" size="1" id="Dft0">' & _Rt_UserName_String() & _
' </select>' & _
' </label></td>' & _
' <td width="348"><label>' & _
' <input type="submit" name="Del" id="Del" value="删除">' & _
' </label></td>' & _
' </tr>' & _
' <tr>' & _
' <th scope="row">密码:</th>' & _
' <td align="left"><label>' & _
' <input type="password" name="Dft1" id="Dft1" value="'&$UserValue[0][7]&'">' & _
' </label></td>' & _
' <td><a href="http://netms.stu.edu.cn/ModifyPassword.aspx">更改密码</a></td>' & _
' </tr>' & _
' <tr>' & _
' <th align="center" scope="row"><label>' & _
' <input type="submit" name="Login" id="Login" value="登录">' & _
' </label></th>' & _
' <td align="center"><label>' & _
' <input type="submit" name="Check" id="Check" value="查询">' & _
' </label></td>' & _
' <td align="center"><label>' & _
' <input type="submit" name="LogOff" id="LogOff" value="注销">' & _
' </label></td>' & _
' </tr>' & _
' </table>' & _
'</form>' & _
' </div>'
$Rt_MainPage[8]='<div id="mainContent">' & _
'<form id="form1" name="form1" method="post" action="">' & _
' <table width="400" border="1" align="center">' & _
' <tr>' & _
' <td width="107">用户名:</td>' & _
' <td width="277"><label>' & _
' <input type="text" name="user" id="user">' & _
' </label></td>' & _
' </tr>' & _
' <tr>' & _
' <td>密码:</td>' & _
' <td><label>' & _
' <input type="password" name="pass" id="pass">' & _
' </label></td>' & _
' </tr>' & _
' <tr>' & _
' <td> </td>' & _
' <td><label>' & _
' <input type="submit" name="bt1" id="bt1" value="登录">' & _
' <input type="reset" name="reset" id="reset" value="重置">' & _
' </label></td>' & _
' </tr>' & _
' </table>' & _
'</form>' & _
'<h1> </h1>' & _
' <!-- end #mainContent --></div>' & _
' <div id="footer">'
EndFunc
Func _Rt_UserName_String()
Local $Context = ""
For $i = 1 To $UserValue[0][0]
$Context &=' <option>'&$UserValue[$i][0]&'</option>'
Next
Return $Context
EndFunc
|